![]() |
#1 |
Connoisseur
![]() Posts: 67
Karma: 10
Join Date: Jul 2023
Device: none
|
Small Sigil bug
I have been converting scanned texts to epubs and it occurred to me that if I put the original page numbers in a html comment, it would make finding the source of the text easier. There is one minor problem. If the comment appears in the middle of a paragraph and I click after the comment, it syncs the preview window to the top of the file. I have attached a small file to show the problem. Rename to .html and load the file into sigil and click on the word 'always' at the end of the file.
|
![]() |
![]() |
![]() |
#2 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,443
Karma: 5703082
Join Date: Nov 2009
Device: many
|
Not a bug but expected behaviour. XHTML comments are not part of the parsed DOM tree. They are stripped out during parsing by the Chrome/Blink engine used by Preview so there is nothing in Preview to navigate to and visa-versa.
The correct way to indicate page numbers is with either an empty span with id to the upcoming page, or with the span wrapping the first word of a page with an id to that page. Not with xhtml comments. These in turn can be used to build actual page list links for the ncx or nav. I have seen people use "a" tags as well with no contents, just an id to act as the link destination. And the best way to exactly sync Preview's location to CodeView and the reverse is to click on visible text shared by both. Last edited by KevinH; 08-08-2023 at 07:31 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Connoisseur
![]() Posts: 67
Karma: 10
Join Date: Jul 2023
Device: none
|
I must not have explained myself very well. The page numbers are only for proofreading, so I can find the scanned image that goes with the text in Sigil, and the problem occurs when I click on visible text that is after the html comment, but in the same paragraph.
|
![]() |
![]() |
![]() |
#4 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,626
Karma: 168431739
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
I can't duplicate your results here. If I open the preview window and click on the 'always' after the comment, that line is highlighted in CodeView. If I click on the text before the comment, CodeView highlights the line that starts the paragraph. See attached images.
Last edited by DNSB; 08-09-2023 at 01:05 AM. |
![]() |
![]() |
![]() |
#5 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,443
Karma: 5703082
Join Date: Nov 2009
Device: many
|
I also tried your test case and I am seeing the exact same things as DNSB. If I click on the first "always" in Preview I get the start that paragraph in CodeView. In Preview if I click on the second "always" I get that line highlighted in CodeView.
Going the reverse direction, In CodeView if I click on the first "always": Preview moves to show it. If I click on the second "always", I do see Preview flick to the top. But I can still see that final line. Is that what you are referring to? If additional tags with text exist after the xhtml-comment then Preview will properly reposition itself if you click on that text. Again, the issue is that the xhtml comment does not have a node or position in the parsed DOM tree. So anything appended to the end of that missing node simply does not have a valid position to make Preview scroll to. It is effectivly attached to the end of the previous node's contents. A new tag pair after that will allow Preview to find things again as it has a node in the parsed DOM tree. You just can not scroll Preview to something that does not exist. This is how all web browsers work. I can not change that. To make Preview scroll you have to tell it which "node" in its internal DOM tree to scroll to. A node is a valid tag not an inline xhtml comment that gets stripped out. As I explained before, If you want something unseen to mark places in your text instead of using xhtml comments use an empty span with a page number as the id, or an empty "a" tag with an id for the page number, or wrap the first word on the new page with a span tag and id based on page number instead of using xhtml comments. This has the added advantage of actually allowing you to jump directly to specific pages in final PageLists in the ncx and nav. It is easy with TagMechanic or even Sigil using find and replace to find empty span tags with specific id formats and remove them if you no longer want them after editing. Hope this explains things more clearly. Last edited by KevinH; 08-09-2023 at 10:31 AM. |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Connoisseur
![]() Posts: 67
Karma: 10
Join Date: Jul 2023
Device: none
|
Quote:
|
|
![]() |
![]() |
![]() |
#7 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,443
Karma: 5703082
Join Date: Nov 2009
Device: many
|
Okay from looking at your new test case:
1. clicking in Preview to sync CodeView works just fine as DNSB reported. 2. But clicking in CodeView to sync Preview, the command to scroll Preview will not be able to reach text immediately past an inline xhtml comment as the xhtml comment just does not exist in the Preview DOM tree. I was able to "fix" this by ignoring inline xhtml comments when figuring out where to scroll Preview to. With this change, clicking in CodeView on the first "always" and clicking in CodeView on the second "always" will tell Preview to scroll to the parent p tag and not a missing inline xhtml comment. That way Preview will not skip to the "top" which is what it is supposed to do when the sync location fails. I have pushed this change to master. It will appear in the upcoming release Sigil-2.0.0. |
![]() |
![]() |
![]() |
#8 | |
Connoisseur
![]() Posts: 67
Karma: 10
Join Date: Jul 2023
Device: none
|
Quote:
<!-- Page 96 --> <hr style="width:10%;text-align:left; margin-top: 1em;margin-left:0"/> |
|
![]() |
![]() |
![]() |
#9 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,443
Karma: 5703082
Join Date: Nov 2009
Device: many
|
Again clicking on Text shown in both not void tags is the best way to sync back and forth.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Small bug report | Turtle91 | Sigil | 10 | 07-21-2017 07:15 PM |
very small bug report | cybmole | Calibre Companion | 10 | 05-22-2014 06:21 AM |
Small cosmetic 'bug' | At_Libitum | Marvin | 3 | 09-27-2013 05:10 PM |
Small bug? Case-insensitive tags. | Arrghus | Calibre | 9 | 07-12-2011 01:03 AM |
Small html/css bug | twaits | Calibre | 5 | 01-12-2010 10:26 AM |