Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Closed Thread
 
Thread Tools Search this Thread
Old 01-14-2023, 12:40 PM   #31
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,439
Karma: 5702578
Join Date: Nov 2009
Device: many
Updated LOI-Generator Proof of Concept

Okay I added in basic support for images with svg parents that have a title or desc child. It seems to work based on the debug output.

I have added a new version of this debug loi generator below in case anyone wants to play around with it themselves.

Last edited by KevinH; 01-17-2023 at 03:41 PM. Reason: Remove now outdated version of plugin
KevinH is offline  
Old 01-14-2023, 12:49 PM   #32
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,439
Karma: 5702578
Join Date: Nov 2009
Device: many
Some addition thoughts/questions for those following along:

1. Since some people place the loi immediately after the toc near the front of the book and some want it at the end (standardebooks), I am just going to append the loi.xhtml file to the end of the spine if a new one is needed. The user can drag and drop it to wherever they want it after the plugin completes.

2. Updating the ncx or nav toc will depend on final position of loi in the spine depending on the user's choice. So users will have to remember to regenerate the nav/ncx table of contents so they will match after running this plugin.

3. The plugin will add the "loi" semantics on the new file to the opf guide for epub2 and nav landmarks for epub3 so that repeat use without constant new files is possible.

4. I am think of looking for user created loi_template_2.xhtml and loi_template_3.xhtml in the sigil preferences folder for use when having to create a new loi.xhtml file.
That way users can customize those files and use a properly translated heading for "List of Illustrations" for their chosen language.

5. Instead of generating a log file of the images found that were *not* considered suitable for the loi, perhaps we should simply add them to the loi.xhtml in the proper found order but wrap each one in xhtml comments to hide them from the reader.

That way anyone can edit the newly created file and uncomment any mistakes easily or use it as a list of potential images to fix. (or to quickly link to each to visually check things out).
This could be controlled by a plugin preference setting.

Thoughts on any or all of this welcomed.

Last edited by KevinH; 01-14-2023 at 12:59 PM.
KevinH is offline  
Advert
Old 01-16-2023, 12:52 PM   #33
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,439
Karma: 5702578
Join Date: Nov 2009
Device: many
Beta Version of LOI-Generator plugin

Hi All,

Attached is an beta version of the LOI-Generator plugin.

This version will actually make changes and insert the generated loi file if needed or will overwrite only the contents of the ol tag in any file with "loi' listed in the guide or the nav landmarks.

It looks for img or svg image tags wrapped in:

- figure tags with child figcaption (epub3)
- div with child p caption/title
- div with child div caption/title
- svg tag with title or desc child


The generated loi file includes all images considered to be possible targets but xml comments out the ones without any descriptive information available so you can look at the source to see why it has not been added. It uses the first opf dc:language metadata to determine language and translate the "List of Illustrations" string.

This should be good enough to use for testing and feedback.

The user should drag and drop any newly generated loi files to where desired in BookBrowser and when satisfied regenerate any and all TOCs.

Notes:

If the epub has an existing loi, please check it is properly listed in the guide or nav landmarks with the type "loi". If not, use BookBrowser Add Semantics on that file to set it.

In addition, if a loi already exists but does *not* use "ol" tags to hold the list, add an empty ol tag (open and close pair) where you want the list of illustrations to be injected.


All comments welcome.

Update: This plugin now now has been released and has its own thread here:

https://www.mobileread.com/forums/sh...d.php?t=351658

Last edited by KevinH; 01-19-2023 at 04:27 PM. Reason: Remove old version and redirect to official LOI-Generator plugin thread for latest downloads
KevinH is offline  
Old 01-16-2023, 08:35 PM   #34
Tenome
Enthusiast
Tenome began at the beginning.
 
Posts: 49
Karma: 26
Join Date: Jan 2022
Device: none
When I run it, it's adding its own ID for the hyperlinking (chapter-1.xhtml#loichapter-1.xhtml0) rather than using the ID I set for the image (<figure id="illustration-2"> parent with an SVG inside etc.), so it doesn't properly work when you click on the hyperlink. Do I have the image IDs in the wrong spot or something? Here's an example image format I use.

Spoiler:

Code:
<figure class="pbafter" id="illustration-1">
	<svg 
	role="img"	aria-describedby="svgtitle svgdesc"	xmlns="http://www.w3.org/2000/svg"
	height="100%"  width="100%"
	preserveAspectRatio="xMidYMid meet" version="1.1"
	viewBox="0 0 1120 1600"
	xmlns:xlink="http://www.w3.org/1999/xlink">
	<image width="1120" height="1600" xlink:href="../Images/c01-1.png" epub:type="z3998:illustration"/>
	<title id="svgtitle">Fana del Moral</title>
	<desc id="svgdesc"></desc>
	</svg>
</figure>

Last edited by Tenome; 01-16-2023 at 08:59 PM.
Tenome is offline  
Old 01-16-2023, 09:27 PM   #35
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,439
Karma: 5702578
Join Date: Nov 2009
Device: many
You are embedding an svg inside a figure tag which is in turn embedding an image. This is not a common pattern.

Try moving the id to the svg tag instead of the figure tag.

The plugin should have added it to that svg tag but something must we wrong if that did not happen. The link should work even with the generated tag.

Last edited by KevinH; 01-16-2023 at 09:32 PM.
KevinH is offline  
Advert
Old 01-16-2023, 09:36 PM   #36
Tenome
Enthusiast
Tenome began at the beginning.
 
Posts: 49
Karma: 26
Join Date: Jan 2022
Device: none
That's not a common pattern? I use the InsertSVG plugin which defaults to that but with <div> if I recall. I changed it to <figure> because I read that it was better to use that instead of a generic <div> tag for inserting images (for accessibility or whatever, I'm still figuring this stuff out). I'll try editing it a bit and see how it goes, thanks.

Moving the ID to the SVG instead fixes it, but does it matter if the ID is on the image itself rather than the figure container then?

Last edited by Tenome; 01-16-2023 at 09:40 PM.
Tenome is offline  
Old 01-16-2023, 09:40 PM   #37
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,439
Karma: 5702578
Join Date: Nov 2009
Device: many
From a semantic standpoint the svg tag already indicates this is a graphic which mitigates the need for a duplicate semantic tag like figure, which is why insertsvg uses divs
KevinH is offline  
Old 01-16-2023, 09:41 PM   #38
Tenome
Enthusiast
Tenome began at the beginning.
 
Posts: 49
Karma: 26
Join Date: Jan 2022
Device: none
Hmm, I see. Should I just switch it back to div then? I don't have any e-readers to test this stuff out on so I'm just groping in the dark.
Tenome is offline  
Old 01-16-2023, 09:51 PM   #39
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,439
Karma: 5702578
Join Date: Nov 2009
Device: many
There is a typo in the plugin code that prevents the added id from being saved.

There is a single line that says:

Code:
tree_modified = True
that needs to be changed to:

Code:
file_modified = True
Plus some needed related fixes as well.

This will be fixed tomorrow when I release a beta quality version of the plugin. Then for your pattern the id will be added to the svg tag and all links will work as is with no changes on your part. But that said, putting your own id on the svg tag instead of the figure tag, will work around this issue until the fix is released.

Last edited by KevinH; 01-17-2023 at 12:22 PM.
KevinH is offline  
Old 01-16-2023, 09:53 PM   #40
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,439
Karma: 5702578
Join Date: Nov 2009
Device: many
No need to change to div, just move your id to the svg tag, and it should work just fine.

FYI, the id is used to identify a node in the DOM tree in a fully laid out page that is scrolled to. It is not as if the link is like a "goto" that leaps to that place and starts reading from there on.

So putting the id on the figure tag or its child svg tag makes no difference to what is shown on the screen as a result of the link.

Last edited by KevinH; 01-16-2023 at 10:51 PM.
KevinH is offline  
Old 01-17-2023, 03:36 PM   #41
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,439
Karma: 5702578
Join Date: Nov 2009
Device: many
New version of LOI-Generator_v030.zip now available

Hi All,

Thanks to Doitsu and Tenome, and others, a few more bugs were squashed related to properly injecting ids when no id is found on the parent or the image/img tag.

In addition Plugin Preferences for mode of operation for the plugin are now used:

LOI-Generator.json

Code:
{
  "mode": "comment"
  "tabwidth": 4
}
The possible mode values are:[LIST][*]"keep" - use url as desc and treat it as a valid entry even if no caption or title or alt found
[*]"drop" - remove entries where no desc can be found in captions, titles, or alt
[*]"comment" - wrap any entries where no desc can be found in comments


In addition, proper indentation for injected code is now handled and if "drop" is selected as the mode, no ids are added for items when no desc (caption or title or alt) can be found.

After the first run of the plugin, it will default to "comment" mode but the user can edit the LOI-Generator.json to suit their taste.

This plugin should now be usable/

Download LOI-Generator_v030.zip from the attachments of this is post:

https://www.mobileread.com/forums/sh...7&postcount=33

Last edited by KevinH; 01-18-2023 at 11:05 AM.
KevinH is offline  
Old 01-17-2023, 04:16 PM   #42
Tenome
Enthusiast
Tenome began at the beginning.
 
Posts: 49
Karma: 26
Join Date: Jan 2022
Device: none
Nice. Thanks for helping me out with that, I didn't think we'd get a plugin so soon! I'm sure it'll be used often. I'll try it out in my next epub and leave any feedback.
Tenome is offline  
Old 01-18-2023, 11:11 AM   #43
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,439
Karma: 5702578
Join Date: Nov 2009
Device: many
LOI-Generator_v030 now available

I have tracked down and fixed more bugs, improved indentation, made some code tweaks, extended the preferences to include tabwidth settings, cleaned up the plugin log output to make it easier to see what is going on, etc.

And Thanks to BeckyEbook, this plugin now has its own icon!

Hopefully this plugin is now in a reasonable state to be released after a bit more testing.

When that happens, I will be sure to add lots of documentation about how the plugin works, what tag patterns it detects and how to customize the output.

Please give this one a try and let me know if you see bugs.

The plugin can be grabbed from this earlier post in this thread:
https://www.mobileread.com/forums/sh...7&postcount=33

Once ready to be released, I will move it to the Plugin Thread and update the Plugin Index.

Hope this helps,

KevinH

ps: I plan to yet add Preference settings for heading level to use for "The List of Illustrations", and for if "list-style-type: none" is used or not in the ol tag when creating a loi.xhtml from scratch.

Last edited by KevinH; 01-18-2023 at 06:43 PM.
KevinH is offline  
Old 01-19-2023, 04:25 PM   #44
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,439
Karma: 5702578
Join Date: Nov 2009
Device: many
Okay, after some final changes, I have made an official release for this plugin:

Its thread can be found here:

https://www.mobileread.com/forums/sh...d.php?t=351658

Please move all discussion about this plugin to that thread.

Last edited by KevinH; 01-19-2023 at 04:27 PM.
KevinH is offline  
Closed Thread


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tools Script generate WordWise for all type of ebook xnohat Kindle Developer's Corner 22 04-01-2025 04:32 AM
plugin that can generate NCX/Guide for epub-2 e-readers? hobnail Calibre 4 11-29-2019 05:09 PM
PRS-T2 script to generate collections stegro Sony Reader Dev Corner 8 01-05-2018 03:58 AM
Conversion from xhtml to epub loose svg images pwessel Conversion 3 05-24-2015 11:29 PM
Script to generate thumbnails Jellby Bookeen 0 01-02-2010 11:51 AM


All times are GMT -4. The time now is 12:54 PM.


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