04-20-2024, 10:40 AM | #526 |
Sigil Developer
Posts: 8,160
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Ignoring the AI aspect of all of this.
Although a plugin like this is doable, there really is not a lot of need for one. Let me explain. Normally, authors of books write and do primary editing of their books in a Word Processor like LibreOffice or Word remembering to properly specify and use styles. Then the epub dev person can either export that word document as html to load it into Sigil or use one of the existing Sigil import plugins to load it. There is very little need to create lots of html by hand. Next Sigil has the ability to use user supplied text Clips. Many users assign a few of the most common html tags to the clip so they can insert them with a single click on any of the 40 clip icons Sigil supports. Sigil already starts every page with the proper xhtml framework that is equivalent to what your example haml code would produce but for Sigil, since epubs need proper xhtml, Sigil uses that not the more loosely formatted xhtml. So rarely do epub developers need to hand create large blocks of html/xhtml code. They in fact spend a large part of their time cleaning up the poor html most other programs create, adding the proper css styling, reformatting footnotes, adding images, cover, etc and even javascript if needed. Now if you know of a good html editor that produces haml, then by all means you could create and use a plugin to read it in and convert it to xhtml. Alternatively you could run a standalone program to convert haml to html and then import that to Sigil right now. Hope this explains things better. |
08-09-2024, 07:19 AM | #527 |
Junior Member
Posts: 9
Karma: 10
Join Date: Aug 2024
Device: Sigil
|
Developer for little Sigil Plugin
Hello, I am looking for a developer who can build a little Sigil plugin that adds "Back" and "Forward" buttons at the end of every page to navigate through a book in an HTML export from an EPUB. Is there anyone interested in doing this as a work for hire?
If this is not the right place for this request, I am sorry and grateful for any advice where to post it. Best regards, Bertram |
Advert | |
|
08-09-2024, 09:55 AM | #528 |
Grand Sorcerer
Posts: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
This is the right place. I'm just not sure it's doable (or that I understand correctly). Unless it's a fixed layout (pretty rare), epubs don't have "pages." They reflow based on font size and margin/line-height preferences. So there would be no programmatically definable "end of every page." And an HTML export would be in the same boat. An HTML book would endlessly scroll--with no need for page buttons. Unless you're talking chapters or sections?
|
08-09-2024, 01:51 PM | #529 |
Junior Member
Posts: 9
Karma: 10
Join Date: Aug 2024
Device: Sigil
|
Thank you for your fast reply
If it is possible to retrieve the file name of the previous and following xhtml file within the file list of the EPUB than it shoud be doable. In this case in the following html snippet only in the "href="XXX.xhtml" the "XXX.xhtml" needs to be replaced once by the file name of the previous file and once by the file name of the following file. Inserting this code snippet in every file before the </body> tag should do the job. Shouldn't it?
Code:
<div class="wh_prev_next"><a class="wh_prev_next_link" href="XXX.xhtml"><span class="icon-arrow-left"> </span><span style="vertical-align:top; font-size:large;">Previous</span></a><a class="wh_prev_next_link" href="XXX.xhtml"><span style="vertical-align:top; font-size:large; padding-right: 1em;">Next</span><span class="icon-arrow-right"> </span></a></div> |
08-09-2024, 02:45 PM | #530 | |
Grand Sorcerer
Posts: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
|
|
Advert | |
|
08-09-2024, 03:05 PM | #531 |
Junior Member
Posts: 9
Karma: 10
Join Date: Aug 2024
Device: Sigil
|
Essentially, what I am looking for is a function that replaces some string like "Previous.xhtml" by the file name of the previous file in the file list and "Next.xhtml" by the file name of the following file. Everything else is still in place. Just this part is missing.
|
08-09-2024, 03:07 PM | #532 |
Junior Member
Posts: 9
Karma: 10
Join Date: Aug 2024
Device: Sigil
|
|
08-09-2024, 06:27 PM | #533 |
Guru
Posts: 783
Karma: 2298438
Join Date: Jan 2017
Location: Poland
Device: Various
|
Try this.
Quick & dirty, but it should work. |
08-10-2024, 04:39 AM | #534 |
Junior Member
Posts: 9
Karma: 10
Join Date: Aug 2024
Device: Sigil
|
Thank you very much!
Great job, works like a charm! How may I express my gratitude?
|
08-10-2024, 09:34 AM | #535 |
Junior Member
Posts: 9
Karma: 10
Join Date: Aug 2024
Device: Sigil
|
Create chapter TOCs
I have another little task that may be a bit more complicated but also not too difficult: I would like to auto-generate a litte TOC in a <nav> section of every chapter/html file. It shall include entries for the current file itself and for all subordinated files and their headings from H1 to H3 with classes from the sgc-toc.css.
So steps could be: 1. Create a TOC entry for the current chapter in the <nav> section of the current file 2. Create additional entries for every subordinated file/chapter with correct classes from sgc-toc.css 3. Go to next file: If it is subordinated just copy the created TOC from the <nav> section of the previous file 4. If it is NOT subordinated, start with 1. Perhaps it can also be done based on the existing HTML-TOC generation. But as I am not a developer I do not have enough insight. |
08-10-2024, 09:45 AM | #536 |
Junior Member
Posts: 9
Karma: 10
Join Date: Aug 2024
Device: Sigil
|
Generate chapter TOCs
I have another need for a small feature: It should auto-generate a linked chapter TOC in the <nav> section of every chapter/html file including an entry for the current file itself and for all subordinated chapters/files with headings H1 to H3 using classes from sgc-toc.css.
Perhaps this can be done based on the exiting feature for generating a HTML TOC for an entire ebook. But I am not a developer and do not have enough insight. Otherwise the steps could be: 1. Generate an entry / several entries for the H1-H3 heading of the current file in its <nav> section 2. Add entries for H1-H3 headings of all subordinated files 3. Go to next file: If it is subordinated just copy the generated list from the previous file 4. If it is not subordinated restart with 1. |
09-18-2024, 06:03 PM | #537 |
Connoisseur
Posts: 73
Karma: 11638
Join Date: Aug 2010
Location: Spain
Device: iPad, Kindle Paperwhite, Kobo Libra 2
|
This is more of a curiosity. I'm writing a plugin that writes to the XHTML files.I'd like to leave the markup as Sigil's own "Mend and Prettify..." does.
I use Sigil bs4 html parser, by default it just outputs lines with no indentantion and no blank lines between block elements. The best I've got is by using oup.prettyprint_xhtml that at least indents the code but the blank lines were already lost when the original HTML was parsed and it doesn't add them back. So, is there any other method or whatever that does that. Or is there no way for a plugin to access that functionality? I'm not interested in writing my own parser or do elaborate shenanigans to the HTML. It's just in case I missed something obvious. Last edited by Coleccionista; 09-19-2024 at 02:32 AM. |
09-18-2024, 07:02 PM | #538 |
Guru
Posts: 783
Karma: 2298438
Join Date: Jan 2017
Location: Poland
Device: Various
|
As far as I know – there is no such possibility.
I also struggled with this, but I thought, Whatever, because I never managed to achieve the effect as established in Sigil. But personally, I use many plugins every day that create or change XHTML files, and I simply call the Mend and Prettify all XHtml files function after using the plugin. I set myself a keyboard shortcut, so it is one click. |
09-19-2024, 05:43 AM | #539 |
Connoisseur
Posts: 73
Karma: 11638
Join Date: Aug 2010
Location: Spain
Device: iPad, Kindle Paperwhite, Kobo Libra 2
|
Thanks Becky, that's what I wanted to know. Anything involving more than a cursory change and it's better to run "Mend and prettify" as you said.
On the subject of sigil bs4 another oddity that I found is that I have this markup. Code:
<em>Text with <strong></strong> an empty tag <span></span> here</em> Code:
<i>Text with <strong></strong> an empty tag <span></span> here</i> Code:
<i>Text with <strong/> an empty tag <span/> here</i> Code:
<i>Text with <strong></strong> an empty tag <span></span> here</i> |
09-19-2024, 06:12 AM | #540 |
Sigil Developer
Posts: 8,160
Karma: 5450818
Join Date: Nov 2009
Device: many
|
It is xhtml not html and so follow the rules of xml and so all tags with no content can be self closed. That said, some ereaders think xhtml and html are the same and can not deal with that
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Loading Plugin in development | Sladd | Development | 6 | 06-17-2014 07:57 PM |
Question for plugin development gurus | DiapDealer | Plugins | 2 | 02-05-2012 12:33 AM |
DR800 Plugin development for DR800/DR1000 | yuri_b | iRex Developer's Corner | 0 | 09-18-2010 10:46 AM |
Device plugin development | reader42 | Plugins | 10 | 03-29-2010 01:39 PM |
Calibre plugin development - Newbie problems | minstrel | Plugins | 5 | 04-12-2009 01:44 PM |