Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 04-20-2024, 10:40 AM   #526
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
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.
KevinH is offline   Reply With Quote
Old 08-09-2024, 07:19 AM   #527
PubFut
Junior Member
PubFut began at the beginning.
 
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
PubFut is offline   Reply With Quote
Advert
Old 08-09-2024, 09:55 AM   #528
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
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?
DiapDealer is offline   Reply With Quote
Old 08-09-2024, 01:51 PM   #529
PubFut
Junior Member
PubFut began at the beginning.
 
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>
PubFut is offline   Reply With Quote
Old 08-09-2024, 02:45 PM   #530
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by PubFut View Post
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?
Sure. That should be possible for someone. But you're talking about adding code to the end of every file/chapter, where you said pages. That's what I was looking to clarify.
DiapDealer is offline   Reply With Quote
Advert
Old 08-09-2024, 03:05 PM   #531
PubFut
Junior Member
PubFut began at the beginning.
 
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.
PubFut is offline   Reply With Quote
Old 08-09-2024, 03:07 PM   #532
PubFut
Junior Member
PubFut began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Aug 2024
Device: Sigil
Quote:
Originally Posted by DiapDealer View Post
you're talking about adding code to the end of every file/chapter, where you said pages. That's what I was looking to clarify.
Correct, "page" referred to the HTML output that I produce where every EPUB file/chapter results in an html page.
PubFut is offline   Reply With Quote
Old 08-09-2024, 06:27 PM   #533
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 783
Karma: 2298438
Join Date: Jan 2017
Location: Poland
Device: Various
Try this.
Quick & dirty, but it should work.
Attached Files
File Type: zip PrevNext_v001.zip (1.1 KB, 228 views)
File Type: epub PrevNextTest.epub (3.5 KB, 160 views)
BeckyEbook is offline   Reply With Quote
Old 08-10-2024, 04:39 AM   #534
PubFut
Junior Member
PubFut began at the beginning.
 
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?
PubFut is offline   Reply With Quote
Old 08-10-2024, 09:34 AM   #535
PubFut
Junior Member
PubFut began at the beginning.
 
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.
PubFut is offline   Reply With Quote
Old 08-10-2024, 09:45 AM   #536
PubFut
Junior Member
PubFut began at the beginning.
 
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.
PubFut is offline   Reply With Quote
Old 09-18-2024, 06:03 PM   #537
Coleccionista
Connoisseur
Coleccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to behold
 
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.
Coleccionista is offline   Reply With Quote
Old 09-18-2024, 07:02 PM   #538
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
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.
BeckyEbook is offline   Reply With Quote
Old 09-19-2024, 05:43 AM   #539
Coleccionista
Connoisseur
Coleccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to behold
 
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>
If i do say a <em> to <i> replacement in the plugin and just print the soup as string it will print as expected:
Code:
<i>Text with <strong></strong> an empty tag <span></span> here</i>
But if I want to indent the code and use the prettyprint_xhtml it will return self-closing tags.
Code:
<i>Text with <strong/> an empty tag <span/> here</i>
Now, Sigil doesn't complain about those. File preview works OK, saving the book has no problems and the moment you run "Mend and prettify" it will go back to this:

Code:
<i>Text with <strong></strong> an empty tag <span></span> here</i>
But I find it curious since those elements are not supposed to be self-closing AFAIK.
Coleccionista is offline   Reply With Quote
Old 09-19-2024, 06:12 AM   #540
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
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
KevinH is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 02:38 AM.


MobileRead.com is a privately owned, operated and funded community.