|
|
#151 | |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 29,284
Karma: 211540138
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
I'm curious why when right-clicking in Code View and choosing to Mend and Prettify the current file, the cursor always moves to the opening body tag? To be clear: this happened in previous versions of Sigil as well (and I don't think it's a huge deal by any means). I just wondered if there's a reason behind it? |
|
|
|
|
|
|
#152 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,555
Karma: 6774048
Join Date: Nov 2009
Device: many
|
Mend and Prettify both are based on parsing the complete xhtml file into its gumbo DOM tree of nodes and then serializing it back to xhtml following specific rules. So as a guess only ... when you prettify, you can change lines and add or remove chars, etc, so any character offset stored before we prettify will typically be wrong so maybe we just store the line?
Or maybe we try storing a webpath and hope to get close upon return? Will have to check the code on that. |
|
|
|
|
|
#153 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,555
Karma: 6774048
Join Date: Nov 2009
Device: many
|
Okay, I took a closer look at the gitee code to do prettyrint after spending hours updating its use of QRegExp (which was removed for Qt6 but still in Qt5 compat) to use QRegularExpression and getting it to compile it became clear it basically punts and never condenses any text no matter what.
That is not something I consider an actual prettyprint tool. It is more like a lint tool of some sort. So imho it is not worth adding to Sigil either. So we are have only one user controllable PrettyPrint option, not two. So please give what is in master a try, and let me know if it does what you need. Thanks. |
|
|
|
|
|
#154 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,555
Karma: 6774048
Join Date: Nov 2009
Device: many
|
I am thinking of adding a safety check to our PrettyPrint which will walk all linked css files and internal xhtml style tags looking for the use of the white-space property with any value other than "normal" and refuse to prettyprint that file. FWIW, pre tags contents will properly not be condensed but not eveyone uses pre tags in their html.
Thoughts? Update: This safer prettprint approach has now been pushed to master. Last edited by KevinH; 04-08-2026 at 05:05 PM. |
|
|
|
|
|
#155 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,555
Karma: 6774048
Join Date: Nov 2009
Device: many
|
I have also revisited the prettyprint code from that gitee sigil-modified site. I was able to extract and fix it to properly condense text. I will add create a plugin version of it (once translated to python) for people to try out as an alternative to our built in gumbo based prettyprinting.
Last edited by KevinH; 04-08-2026 at 05:07 PM. |
|
|
|
|
|
#156 |
|
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 51,273
Karma: 179232776
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
For anyone interested in testing the new code, here's a link to my compile of the latest code from Sigil's Github repository: Sigil-2.7.6-Windows-x64-Setup.exe.
|
|
|
|
|
|
#157 |
|
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 102
Karma: 21870
Join Date: Apr 2021
Location: Spain
Device: Kobo Libra 2
|
Hi Kevin and the Sigil team,
First of all, I would like to apologize for my English. Since I am not fluent, I have asked Gemini to help me draft this request to ensure I can explain myself clearly. I am writing to suggest a feature for the Find & Replace engine. Currently, if we want to insert the name of the current file (e.g., chapter01.xhtml) into a replacement string, we must use the Python Function mode in Saved Searches. While this works, it is quite complex for users who are not familiar with programming. The Proposal: Introduce a special placeholder or variable (such as \f, ${FILENAME}, or similar) in the Replace field. This variable would dynamically resolve to the name of the file currently being processed during a "Replace All" across "All HTML Files". The Main Use Case: Massive Footnotes This feature would be incredibly useful when dealing with epubs that have a massive amount of footnotes. Often, we need to prefix IDs or links with the filename to ensure they are unique across the entire book or to fix broken cross-references in large-scale projects. Manually editing hundreds of files to include the filename in the anchor tags is prone to error and extremely time-consuming. Other Use Cases:
I believe this addition would make Sigil even more powerful for power-users and beginners alike, especially those of us working with complex academic or heavily annotated books. Thank you for your time and for all the work you do on Sigil! Best regards, repilo |
|
|
|
|
|
#158 |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 82,909
Karma: 153071045
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
One thing I would like is some way to easily merge all the CSS into one file when there are multiple CSS files. I know there could be duplicate classes. So a way to deal with that would have to be figured out.
Another feature would do the the specific amazon media queries in the CSS. That would be any media queries with amzn-kf8 or amzn-mobi even if not is used. Last edited by JSWolf; Yesterday at 06:32 AM. |
|
|
|
|
|
#159 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 29,284
Karma: 211540138
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I'm not following. Anchor names for footnotes (or for anything) don't need to be unique across all xhtml files in an epub. They only have to be unique to the file they are in. So if the anchor name is not already unique within an xhtml file, prefixing it with the current file name will not make it so. Besides... duplicate file names are permitted inside of an epub if they are in different folders.
|
|
|
|
|
|
#160 | |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,555
Karma: 6774048
Join Date: Nov 2009
Device: many
|
Hi repilo,
Since filenames alone may not be unique (the exact same filename may exist in two different folders in the same epub and often do in epubs that are collections), and since all id attributes only have to be unique within its file and can be reused in other files, and since filenames can and do change, I can not see any benefit to making a special replacement for it. Sorry. FYI, you should look at our Sigil plugin index to see what if any footnote related plugins may help. Quote:
Last edited by KevinH; Yesterday at 11:49 AM. |
|
|
|
|
|
|
#161 | ||
|
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 102
Karma: 21870
Join Date: Apr 2021
Location: Spain
Device: Kobo Libra 2
|
Thanks, DiapDealer and KevinH for your replies.
After analyzing the situation further, I’ve realized that my previous request wouldn't actually solve my problem. Let me explain my specific case better. I have a book with almost 1,000 footnotes. Each chapter has about 100 notes at the end. I find this extremely annoying as it breaks the flow of reading; it makes no sense to read notes in a sequence outside of their original context. My problems start when I try to move all these notes to a single notes.xhtml file at the end of the EPUB. For example, in the file I-1.xhtml, note 1 looks like this: Quote:
Quote:
Thank you for your time and for the help anyway. |
||
|
|
|
|
|
#162 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,555
Karma: 6774048
Join Date: Nov 2009
Device: many
|
No Sigil does *not* "automatically removes the ../Text/I-1.xhtml part from the href".
Period. Mend will not do that. Nothing in Sigil will do that based on a simple save and reload. I have just tried it repeatedly. So you are either using a really old or modified version of Sigil or some other tool you are using is removing that text. Sigil does not auto update links unless you use move or rename. Assuming your code looks like the following: Code:
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops"> <head> <title></title> </head> <body> <p>*</p> <p>some text <a id="fn-021-bk" href="#fn-021"><sup>[1]</sup></a></p> <p>more text <a id="fn-022-bk" href="#fn-022"><sup>[2]</sup></a></p> <p>even more text <a id="fn-023-bk" href="#fn-023"><sup>[3]</sup></a></p> <p><a id="fn-021" href="#fn-021-bk"><sup>[1]</sup> footnote 1</a></p> <p><a id="fn-022" href="#fn-021-bk"><sup>[2]</sup> footnote 2</a></p> <p><a id="fn-023" href="#fn-021-bk"><sup>[3]</sup> footnote 3</a></p> </body> </html> 1. insert Sigil SplitMarkers immediately before the footnotes section in all of your files and then split all on Sigil split markers. 2. Then manually drag and drop just the footnotes files that were split off back down to the bottom of BookBrowser (keeping their relative order) 3. Then selecting just those footnotes files, Merge them to create your EndNotes.xhtml file. The act of Sigil's merge will take care of making ids unique and keeping all links going to where they should go. I have attached a test epub here for you to play around with. I have already inserted the Sigil split marker (but you could do that using find and replace for something just before the start of the footnotes or manually using the Insert->Split Marker menu item So give things a try to prove to yourself it all works. |
|
|
|
|
|
#163 | |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,817
Karma: 24222221
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
|
|
|
|
|
|
|
#164 | |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,555
Karma: 6774048
Join Date: Nov 2009
Device: many
|
Quote:
You can only generally merge css files that are linked in every single xhtml file and in the exact same order otherwise you are changing things. If that is the case, feel free to append those files in link order and replace those multiple link tags with just one. No removal of duplicate selectors can generally be done as again order matters. As for amazon media queries, given they are not part of the epub spec, so Sigil will always leave them untouched. So neither of these ideas are something for Sigil. Last edited by KevinH; Yesterday at 09:42 PM. |
|
|
|
|
|
|
#165 | ||
|
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 102
Karma: 21870
Join Date: Apr 2021
Location: Spain
Device: Kobo Libra 2
|
Quote:
Just so you can reproduce the situation I encountered (even though I won't be doing it this way again), here is how the EPUB2 was structured and the steps to trigger the behavior I mentioned:
In any case, thanks for the answers and, I repeat, I won't be doing it the way I described again, as the method you propose is much better. |
||
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Suggestions for Sigil Improvements or New Features | KevinH | Sigil | 241 | 03-02-2026 01:09 PM |
| Suggestions for Sigil Improvements or New Features | KevinH | Sigil | 168 | 11-18-2025 12:23 PM |
| Ideas for New Improvements or Features | KevinH | Sigil | 97 | 04-09-2025 09:45 AM |
| What Features or Tools does Sigil Still Need Yet? | KevinH | Sigil | 175 | 03-06-2021 09:11 PM |
| Improvements/bugs/features | dontcrash | KOReader | 10 | 10-23-2019 10:05 AM |