Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 10-06-2024, 02:36 PM   #1
foosion
Evangelist
foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.
 
Posts: 448
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
Why so complicated?

I found this at the top of chapter 1 of a book and I'm wondering why all of this is needed. Wouldn't it be simpler to just label everything that is to go into the TOC with h#s? Sect1 could be a higher h# so it wouldn't get put into the TOC.

If the page should have a few lines, but the TOC only one line per chapter, use the title attribute.

Text:
Chapter One
Words words
Some more words

TOC:
Chapter One: Words words "Some more words"

Code:
<section aria-labelledby="hd-chapter001" epub:type="bodymatter chapter" id="chapter001" role="doc-chapter">

      <h1 class="chapter-number" id="hd-chapter001"><span epub:type="pagebreak" id="page12" role="doc-pagebreak" title="12"></span><a href="toc.xhtml#toc-chapter001"><span epub:type="pagebreak" id="page13" role="doc-pagebreak" title="13"></span>CHAPTER ONE</a></h1>

      <h1 class="chapter-title"><a href="toc.xhtml#toc-chapter001">Words words</a></h1>

      <h2 class="chapter-subtitle"><a href="toc.xhtml#toc-chapter001">“SOME MORE WORDS.”</a></h2>

      <h1 class="sect1" id="a001">1.</h1>
Also, what does the "section" part accomplish?

Given no index and the ability to generate a TOC from major Hs, what does "id" accomplish?

Why an href to the TOC in an epub?

Finally, why epub:type="pagebreak" or ="bodymatter chapter" or role="doc-pagebreak"?

Last edited by foosion; 10-06-2024 at 02:41 PM.
foosion is offline   Reply With Quote
Old 10-06-2024, 09:26 PM   #2
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 40,524
Karma: 156983616
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Section is similar to a div but used to group related content. You will notice that the section in your quoted text has no classes but does include identifiers, roles, epub-type, etc.

The ID is likely used in the ToC instead of pointing to the chapter file, you would get href="part0007.html#hd-chapter001". Add further ids for subchapter entries.

The href to the ToC allows you to go back to the ToC by tapping on that entry. A vestige of old practices. Remember when you would see Last:Next:ToC at the top and bottom of chapters?

An epub-type is part of ePub3 attributes allowing improved semantics. Originally, it was hoped/hyped that epub-type would improve accessibility but other than some limited success with footnotes, this did not happen.

OTOH, a role is an ARIA attribute used to expose information to assistive technology. There is a lot of overlap which is why it was originally hoped to use epub-type but support never materialized.

See the EPUB Type to ARIA Role Authoring Guide for more information.
DNSB is offline   Reply With Quote
Advert
Old 10-06-2024, 10:35 PM   #3
foosion
Evangelist
foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.
 
Posts: 448
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
That's very helpful. Thank you!

It appears that if I'm editing a commercial work for personal use, want to make the appearance more pleasing to me and don't use assistive technology, I could just enclose each part of the text in bare h# tags, style those as desired in the CSS and delete the rest. I could then generate a ToC from the h# tags, using a title attribute if desired, without needing any href or id.

Deleting the "excess" would make things simpler and easier to understand for me.
foosion is offline   Reply With Quote
Old 10-07-2024, 01:52 AM   #4
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,393
Karma: 12408443
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
If you want to remove different elements in different files in an easy way, I recommend this plugin.
Terisa de morgan is offline   Reply With Quote
Old 10-07-2024, 02:40 AM   #5
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 40,524
Karma: 156983616
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by foosion View Post
That's very helpful. Thank you!

It appears that if I'm editing a commercial work for personal use, want to make the appearance more pleasing to me and don't use assistive technology, I could just enclose each part of the text in bare h# tags, style those as desired in the CSS and delete the rest. I could then generate a ToC from the h# tags, using a title attribute if desired, without needing any href or id.

Deleting the "excess" would make things simpler and easier to understand for me.
It is not all that difficult using regex/TagMechanic/etc. to remove the unwanted elements. For me, it is more if they do not interfere with viewing the text, I do not worry about them. After all, I am not going to be looking at the innards of an ePub while reading it.

I also tend to use regex to combine the various elements of a multi-part header into a single title element. At the same time, I prefer to use one header tag and change the rest to <p> tags.

I do prefer simplicity but, at this time, I prefer not to trade the ability to use assistive technology for simplicity.

One recent book used h1, h2 and h3 for the chapter title information and yes, the author loved using all caps all too often:

Code:
<h1>CHAPTER ONE</h1>
<h2>IN WHICH WE SPEAK</h2>
<h3>OF THE VARIOUS NAMES OF GOD</h3>
becomes

Code:
<h3 title="Chapter One: In Which We Speak of the Various Names of God">CHAPTER ONE</h1>
<p class=subhead1>IN WHICH WE SPEAK</p>
<p class=subhead2>OF THE VARIOUS NAMES OF GOD</p>
My standard for header tags is <h1> is for books in a omnibus, <h2> is for parts in a book and <h3> is used for chapters. I have occasionally used h4 for subsections of a chapter. Only once have I used <h5> and <h6> and that was a fun bit of work on a university textbook where the author had lost his original manuscript and we had to convert and cleanup a PDF copy.

Last edited by DNSB; 10-07-2024 at 02:46 AM.
DNSB is offline   Reply With Quote
Advert
Old 10-07-2024, 06:36 AM   #6
foosion
Evangelist
foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.
 
Posts: 448
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
Quote:
Originally Posted by Terisa de morgan View Post
If you want to remove different elements in different files in an easy way, I recommend this plugin.
I prefer just using regex, perhaps because I'm more familiar with it.
foosion is offline   Reply With Quote
Old 10-07-2024, 06:45 AM   #7
foosion
Evangelist
foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.
 
Posts: 448
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
Quote:
Originally Posted by DNSB View Post
Code:
<h3 title="Chapter One: In Which We Speak of the Various Names of God">CHAPTER ONE</h1>
<p class=subhead1>IN WHICH WE SPEAK</p>
<p class=subhead2>OF THE VARIOUS NAMES OF GOD</p>
Yes, actually making the changes is easy. I do find it easier to change the text I posted in the OP to something similar to what you posted above than to parse out what all of its elements are doing. I have been a bit hesitant to remove things I don't fully understand (a motivation for this thread).

I don't use assistive technology and am not editing for others.

<p class=subhead2> seems to be good semantics as well as syntax.

Last edited by foosion; 10-07-2024 at 06:49 AM.
foosion is offline   Reply With Quote
Old 10-07-2024, 06:51 AM   #8
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 76,404
Karma: 136466962
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by foosion View Post
I prefer just using regex, perhaps because I'm more familiar with it.
I use Diaps Editing Toolbag a lot. It really does work well.
JSWolf is offline   Reply With Quote
Old 10-07-2024, 07:22 AM   #9
foosion
Evangelist
foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.
 
Posts: 448
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
Quote:
Originally Posted by JSWolf View Post
I use Diaps Editing Toolbag a lot. It really does work well.
It does work well and I'm glad Terisa recommended it, but regex seems to allow for more detailed control and, as noted, I'm more familiar with it. De gustibus ...
foosion is offline   Reply With Quote
Old 10-07-2024, 07:26 AM   #10
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,393
Karma: 12408443
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Quote:
Originally Posted by foosion View Post
It does work well and I'm glad Terisa recommended it, but regex seems to allow for more detailed control and, as noted, I'm more familiar with it. De gustibus ...
Yes, I agree it gives more control.
Terisa de morgan is offline   Reply With Quote
Old 10-07-2024, 08:19 AM   #11
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 76,404
Karma: 136466962
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by foosion View Post
It does work well and I'm glad Terisa recommended it, but regex seems to allow for more detailed control and, as noted, I'm more familiar with it. De gustibus ...
You can use regex for the search parameter(s) with the plugin.
JSWolf is offline   Reply With Quote
Old 10-07-2024, 09:05 AM   #12
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,393
Karma: 12408443
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Quote:
Originally Posted by JSWolf View Post
You can use regex for the search parameter(s) with the plugin.
It's not the same to use a regex expression to define the tag parameter than using a regex expression to find the tags. I've had had to change the plugin, for example, to add more tags. With regex, you can do it on the fly.
Terisa de morgan is offline   Reply With Quote
Old 10-07-2024, 10:18 AM   #13
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 76,404
Karma: 136466962
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Terisa de morgan View Post
It's not the same to use a regex expression to define the tag parameter than using a regex expression to find the tags. I've had had to change the plugin, for example, to add more tags. With regex, you can do it on the fly.
What tags have you added in? I know I could use some more tags.
JSWolf is offline   Reply With Quote
Old 10-07-2024, 11:20 AM   #14
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
Using regex alone to do this sort of work is certainly anyone's prerogative (and I'm not hyping my own plugins for more usage). Just know that regex alone is more prone to break things -- especially where nested tags are concerned. Hence the reason I created my plugins in the first place. It uses an a html parser to eliminate the possibility of breaking nested situations. Whereas regex alone will happily crash through nested spans and divs like a bull in a china shop--because it doesn't parse.
DiapDealer is offline   Reply With Quote
Old 10-07-2024, 11:37 AM   #15
foosion
Evangelist
foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.
 
Posts: 448
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
Quote:
Originally Posted by DiapDealer View Post
Using regex alone to do this sort of work is certainly anyone's prerogative (and I'm not hyping my own plugins for more usage). Just know that regex alone is more prone to break things -- especially where nested tags are concerned. Hence the reason I created my plugins in the first place. It uses an a html parser to eliminate the possibility of breaking nested situations. Whereas regex alone will happily crash through nested spans and divs like a bull in a china shop--with no concern with whether or not it's breaking anything.
That is an issue and one has to be careful. Nested tags will result in, for example, <div>(.*?)</div> matching the first closing </div> it encounters rather than the matching </div>. It's easier if you're eliminating all of the divs (or spans) in a file.

There may be a complicated regex that avoids the problem.

BTW, if I wanted to eliminate all <section epub:type="bodymatter chapter"> or the like, how would I set the plugin? I could use regex to add a, for example, id tag, then match the id with the plugin, but that would seem to defeat the purpose.
foosion is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
It's Complicated drjenkins Deals and Resources (No Self-Promotion or Affiliate Links) 13 03-06-2014 01:23 AM
I'm sure this would be complicated, but is this possible? Dullahir Calibre 5 06-03-2013 06:04 AM
Now Things Get Complicated Kris777 News 21 04-17-2010 04:25 AM
UK User - is it really this complicated?! twisticles Sony Reader 30 09-22-2008 11:46 PM


All times are GMT -4. The time now is 09:01 AM.


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