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-09-2023, 04:26 PM   #1
Tenome
Enthusiast
Tenome began at the beginning.
 
Posts: 49
Karma: 26
Join Date: Jan 2022
Device: none
Is there a way or plugin/script to generate a list of images in the epub (loi.xhtml)?

loi.xhtml is the list of illustrations that's sometimes included at the end of the epub. In its basic form, it's just a list of hyperlinked images. Is there a way to generate that in Sigil?

I found the same question on StackExchange, but no one answered him.

https://ebooks.stackexchange.com/que...-illustrations
Tenome is offline  
Old 01-09-2023, 05:36 PM   #2
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,445
Karma: 5703082
Join Date: Nov 2009
Device: many
I assume you mean in an automated manner. If so, the only way I can think of would be by a custom plugin.

If you had to do it manually, you could run Reports and look at the Images report and grab a quick list of links by saving the report as csv and working it into xhtml with a text editor.

You might be able to generate a list of img src attribute values using Find and Replace and copy and paste the selected text into a separate document.

Or just copy the opf manifest and strip out everything but the images you want and edit it to create the loi.xhtml.

There might also be a way to trick the Index tool into creating a set of src urls for images as well.

People may have other ideas.

Creating a plugin to do that would be very straight forward if you are familiar with plugin programming in python via the plugin interface. So perhaps someone has created one already.
KevinH is online now  
Advert
Old 01-09-2023, 06:16 PM   #3
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,611
Karma: 29710338
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by Tenome View Post
loi.xhtml is the list of illustrations that's sometimes included at the end of the epub. In its basic form, it's just a list of hyperlinked images. Is there a way to generate that in Sigil?

I found the same question on StackExchange, but no one answered him.

https://ebooks.stackexchange.com/que...-illustrations
Perhaps DaltonSt's new plugin for calibre can/could do some/all of it ==>> [GUI Plugin] Extract People & Other Metadata

BR
BetterRed is offline  
Old 01-09-2023, 07:13 PM   #4
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,445
Karma: 5703082
Join Date: Nov 2009
Device: many
But Tenome explicitly asked for a way to do this in Sigil?
KevinH is online now  
Old 01-09-2023, 08:26 PM   #5
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,344
Karma: 203719646
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Yep. Let's exhaust the "can I do this with Sigil" discussion before we move on to how it might be done with calibre, please. Even the Stack Exchange question they linked to was Sigil specific.
DiapDealer is online now  
Advert
Old 01-09-2023, 10:52 PM   #6
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,611
Karma: 29710338
Join Date: Mar 2012
Location: Sydney Australia
Device: none
If I do a Search in the calibre editor forum with Keyword Sigil by BetterRed I get a list of 98 posts. Many of them start with "Try the Sigil blah blah". I don't recall any reaction from Kovid - other than by implementing the feature I cited in the calibre editor.

BR
BetterRed is offline  
Old 01-09-2023, 10:52 PM   #7
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,445
Karma: 5703082
Join Date: Nov 2009
Device: many
Wouldn't a list of images need a descriptive field for each image? Maybe it could look for a figcaption tag immediately after each image or use that img alt info? A list of links to images as found in spine order would need something to act as the anchor. Unless a thumbnail becomes the descriptor.

Just thinking about what makes sense here. I may even take a shot at a plugin myself if exactly what it entails could be mapped out.
KevinH is online now  
Old 01-09-2023, 11:00 PM   #8
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,445
Karma: 5703082
Join Date: Nov 2009
Device: many
Quote:
Originally Posted by BetterRed View Post
If I do a Search in the calibre editor forum with Keyword Sigil by BetterRed I get a list of 98 posts. Many of them start with "Try the Sigil blah blah". I don't recall any reaction from Kovid - other than by implementing the feature I cited in the calibre editor.

BR
But in this case the op asked for a Sigil solution, not just a solution. If none exists, and calibre can do it, we can and do point them at calibre. But unlike calibre, we do not work full time for Sigil, we instead volunteer our limited free time to maintain Sigil and do not take donations nor live off the proceeds.

So we can not always be responsive to feature requests when all ways of handling the issue in question in Sigil have not yet been explored. So when a person asks for a Sigil solution, we like to explore those options first instead of pointing people to a calibre plugin that may or may not do what the op asked for.

Hope that explains things.
KevinH is online now  
Old 01-10-2023, 12:42 PM   #9
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,445
Karma: 5703082
Join Date: Nov 2009
Device: many
If there is general interest and if anyone has ideas on how to or where to scrape tags to create title / descriptions for each entry in the loi.xhtml list.

Various possibilities include:
  • h1 on standalone image page
  • figcaption contents
  • img alt value
  • any h1 to h6 within the div or figure tag holding the image
  • title attribute on figure tag
  • something else?

I would be happy to create a plugin to do something like one or two of these.

Last edited by KevinH; 01-10-2023 at 07:08 PM.
KevinH is online now  
Old 01-10-2023, 07:47 PM   #10
Tenome
Enthusiast
Tenome began at the beginning.
 
Posts: 49
Karma: 26
Join Date: Jan 2022
Device: none
Quote:
Originally Posted by KevinH View Post
If there is general interest and if anyone has ideas on how to or where to scrape tags to create title / descriptions for each entry in the loi.xhtml list.

Various possibilities include:
  • h1 on standalone image page
  • figcaption contents
  • img alt value
  • any h1 to h6 within the div or figure tag holding the image
  • title attribute on figure tag
  • something else?

I would be happy to create a plugin to do something like one or two of these.
Personally, since I started using SVG image wrappers with Aria assisted reading code, mine would be
<title id="svgtitle"></title>
<desc id="svgdesc"></desc>.

but I think if you just allow for customization it'll work out.

I don't know how many people would use the plugin, but I do know at least that standardebooks.org utilizes loi.xhtml (you can see an example of how they handle images here) and they make a lot of epubs, so it would be used pretty often I think if they know about it.
Tenome is offline  
Old 01-10-2023, 10:28 PM   #11
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,445
Karma: 5703082
Join Date: Nov 2009
Device: many
From that link, there is this example:

Code:
<p>...</p>
<figure id="illustration-10">
	<img alt="An apple and a pear inside a bowl, resting on a table." src="../images/illustration-10.jpg" epub:type="z3998:photograph"/>
	<figcaption>The Monk’s Repast</figcaption>
</figure>
In this case there is no svg wrapper, and no title or desc fields (aria or otherwise), wouldn't the figcaption be a better short descriptor than the img alt?

Since the title attribute is allowed on the figure tag, perhaps using that would be best since it would not be seen directly while at the same time allowing its value to be different from the alt value, and if need be longer or shorter than the figcaption itself. The epub editor can easily choose to fill that in however they want before running the plugin.

So perhaps the order is look for title attribute on figure tag, and if exists, use it, if not then use the figcaption that is a child of that figure tag.

This would probably be helpful to the most people.

I would need to see an exact examples with svg wrappers if you wanted that case handled as well.

Last edited by KevinH; 01-10-2023 at 10:33 PM.
KevinH is online now  
Old 01-10-2023, 11:31 PM   #12
Tenome
Enthusiast
Tenome began at the beginning.
 
Posts: 49
Karma: 26
Join Date: Jan 2022
Device: none
Mine is definitely an edge case, so I wouldn't worry about it. I'm still not even sure if I'll use this format anyway, I'm still fairly new to this and I swear I've seen like 4 different methods for giving images titles/captions/alt text/etc. It's a bit overwhelming.
Tenome is offline  
Old 01-11-2023, 10:23 AM   #13
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,445
Karma: 5703082
Join Date: Nov 2009
Device: many
Took a look at the loi.xhtml spec from standardepubs you linked to and it is a bit of a mess. In general, epub:type attributes should not be placed on body tags as that prevents aria role tags from being added, vocabulary need not be prefixed as xhtml namespaces as no elements or attributes need prefixes in this case, file names as well as locations need not be fixed, the landmarks should be in the nav landmarks section not in the body of the file, etc.

I'd say that standardepubs are a bit over the top with their "standardization".

So if I do create a list of illustrations plugin for Sigil, it would not match what standardepubs specifies, as their spec is not correct technically with their use of epub:type on a body tag and is way over the top. It completely ignores what the NAV landmarks section is for.

Lets first hear from others about what they think about the idea of a list of illustrations plugin for Sigil and how it should work if we made one.

Last edited by KevinH; 01-11-2023 at 10:26 AM.
KevinH is online now  
Old 01-11-2023, 04:42 PM   #14
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,680
Karma: 23983815
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by KevinH View Post
Lets first hear from others about what they think about the idea of a list of illustrations plugin for Sigil and how it should work if we made one.
IMHO, the most difficult task for non-programmers is to add sequential ids to all images and to create hyperlinks from the list of illustration chapter to them.

How about creating a simple proof-of-concept plugin that does the following:
  • Look for <img> tags in all xhtml files except for files with cover page semantics.
  • If an image has a <figure> parent, look for a <figcaption> sibling and use its string as the title.
  • If no <figcaption> sibling exists or the <figcaption> string is empty, use the alt attribute value.
  • If no alt attribute exists or it's empty, use the image basename as the title.
  • Add a unique id attribute to the <img> tag, if it doesn't already exist.
  • Add a new loi.xhtml file at the end of the book or update an existing version so that the plugin can be run repeatedly.
  • Add a List of illustrations <h1> tag.
  • Add hyperlinks to all images.
  • Add/update loi NAV/NCX landmark/guide entries.
This should cover most use cases. As a preference only the loi heading string should be needed, so that French users could for example, define it as "Liste des illustrations."

As a test case, you could use Mutiny of the Bounty and story of Pitcairn Island, which already contains a list of illustrations.
Doitsu is offline  
Old 01-11-2023, 05:49 PM   #15
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,445
Karma: 5703082
Join Date: Nov 2009
Device: many
In case of figure or div or svg parent of the img tag, shouldn't the id be added to that parent and not the img tag itself?

Also a template_loi.xhtml might prove useful, don't you think?

Last edited by KevinH; 01-11-2023 at 06:25 PM.
KevinH is online now  
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 09:18 AM.


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