html read : additional tables misplaced
Scenario
The "html read" feature has several nice properties, including the fact that it can accept HTML containing multiple tables. This produces multiple gnumeric sheets. Here is an example input:
It contains three main tables, all of which should be identical except for the caption. (There are also three daughter tables, due to included sub-tables.)
Observed Bug
Here is a screenshot of the Second of the three main sheets. The data is shifted down by 4 rows (i.e. the height of the First table). Not shown is the Third sheet, which is shifted down 8 rows. Evidently the row-counter needs to get re-initialized inside the loop.
I conjecture that the fix may be as simple as shown in the following patch, but somebody who understand the code a lot better than I do ought to investigate.
--- a/plugins/html/html_read.c
+++ b/plugins/html/html_read.c
@@ -473,6 +473,7 @@ html_search_for_tables (htmlNodePtr cur, htmlDocPtr doc,
html_read_table (tnode, doc, wb_view, tc);
} else {
for (ptr = cur->children; ptr != NULL ; ptr = ptr->next) {
+ tc->row = -1;
html_search_for_tables (ptr, doc, wb_view, tc);
/* ptr may now have been pushed down in the tree,
* if so, ptr->next is not the right pointer to
Remarks
This is 100% reproducible chez moi.
It is observed with a very recent gnumeric version '1.12.53' compiled from freshly-pulled git sources. It is also observed with an older gnumeric version '1.12.38' from the ubuntu "focal" distro. I suspect the bug has been there since Day One.