Skip to content

Commit c897072

Browse files
committed
Fix handling of missing close TRs (Issue #494)
1 parent 4620dee commit c897072

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Changes in HTMLDOC v1.9.18
22

3+
- Fixed table rendering when there are missing `</tr>` (Issue #494)
34
- Fixed support for links of the form "filename.html#anchor" in PDF output
45
(Issue #514)
56
- Fixed `--header1` support for web page output (Issue #515)

htmldoc/htmllib.cxx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* HTML parsing routines for HTMLDOC, a HTML document processing program.
33
*
4-
* Copyright 2011-2023 by Michael R Sweet.
4+
* Copyright 2011-2024 by Michael R Sweet.
55
* Copyright 1997-2010 by Easy Software Products. All rights reserved.
66
*
77
* This program is free software. Distribution and use rights are outlined in
@@ -571,9 +571,23 @@ htmlReadFile(tree_t *parent, // I - Parent tree entry
571571
break;
572572
}
573573
}
574+
else if (t->markup == MARKUP_TR)
575+
{
576+
for (temp = parent; temp != NULL; temp = temp->parent)
577+
{
578+
if (temp->markup == MARKUP_TR)
579+
break;
580+
else if (temp->markup == MARKUP_TABLE || t->markup == MARKUP_THEAD || t->markup == MARKUP_TBODY || t->markup == MARKUP_TFOOT || temp->markup == MARKUP_EMBED)
581+
{
582+
temp = NULL;
583+
break;
584+
}
585+
}
586+
}
574587
else if (istentry(t->markup))
575588
{
576589
for (temp = parent; temp != NULL; temp = temp->parent)
590+
{
577591
if (istentry(temp->markup))
578592
break;
579593
else if (temp->markup == MARKUP_TABLE || istable(temp->markup) ||
@@ -598,6 +612,7 @@ htmlReadFile(tree_t *parent, // I - Parent tree entry
598612
temp = NULL;
599613
break;
600614
}
615+
}
601616
}
602617
else
603618
temp = NULL;

0 commit comments

Comments
 (0)