10-06-2024, 02:36 PM | #1 |
Evangelist
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> 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. |
10-06-2024, 09:26 PM | #2 |
Bibliophagist
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. |
Advert | |
|
10-06-2024, 10:35 PM | #3 |
Evangelist
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. |
10-07-2024, 01:52 AM | #4 |
Grand Sorcerer
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.
|
10-07-2024, 02:40 AM | #5 | |
Bibliophagist
Posts: 40,524
Karma: 156983616
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
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> 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> Last edited by DNSB; 10-07-2024 at 02:46 AM. |
|
Advert | |
|
10-07-2024, 06:36 AM | #6 | |
Evangelist
Posts: 448
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
Quote:
|
|
10-07-2024, 06:45 AM | #7 | |
Evangelist
Posts: 448
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
Quote:
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. |
|
10-07-2024, 06:51 AM | #8 |
Resident Curmudgeon
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
|
|
10-07-2024, 07:22 AM | #9 |
Evangelist
Posts: 448
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
|
10-07-2024, 07:26 AM | #10 |
Grand Sorcerer
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
|
|
10-07-2024, 08:19 AM | #11 |
Resident Curmudgeon
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
|
|
10-07-2024, 09:05 AM | #12 |
Grand Sorcerer
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
|
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.
|
10-07-2024, 10:18 AM | #13 |
Resident Curmudgeon
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
|
What tags have you added in? I know I could use some more tags.
|
10-07-2024, 11:20 AM | #14 |
Grand Sorcerer
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.
|
10-07-2024, 11:37 AM | #15 | |
Evangelist
Posts: 448
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
Quote:
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. |
|
|
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 |