|
|
Thread Tools | Search this Thread |
07-04-2020, 12:55 AM | #31 |
Wizard
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
I'm wondering, what happens in the case of ALL CAPS chapter titles, but you have to Proper Title Caps in the TOC? You just go with the simple First Cap Every Word?
Last edited by Tex2002ans; 07-04-2020 at 01:06 AM. |
07-04-2020, 01:03 AM | #32 |
Bibliophagist
Posts: 39,404
Karma: 153780470
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Personally, I will open the toc.ncx, nav.xhtml or the embedded HTML TOC in an external editor and then copy/paste into the header tag. Batch edit the existing headings to something like <h3 class="h3class" title=""> as an example and then copy/paste from the external editor in the "". Also useful when some genius decided that images are the way to go for chapter numbering. I played with doing this programmatically but the results generally took as much or more effort to clean up than simply doing it manually from the start. So damn many special cases needed to be accounted for.
|
07-04-2020, 01:24 AM | #33 | ||
Groupie
Posts: 166
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Quote:
The examples I gave in the first post of the thread are specifically concerning the html code and even more specifically the difference between how chapter titles are presented in the html files vs. how they should be shown in the toc. Using h1 for the chapter number, then h2 for the title, instead of h1 with a br to send the title to the next line, or multiple spans to make fake smallcaps or something like that. I am a formatter too, I know the quality of the text is not my responsibility. Quote:
The use of fake smallcaps or other weird code should not matter; the whole point of the plugin is to be used precisely in cases such as that, when it is excessively complicated to extract the title from the h* tags using the habitual methods like regex but there is already a correct toc page in the file. Otherwise it's easy enough to just do a regex for this. The plugin shouldn't automate the regex; it should not take any text from the html file, no matter what kind of tag it is in, precisely because that text is not presented the way it should be in the toc, whereas the text in the toc page IS already correct. The plugin should copy the titles from the toc page, exactly as they are, and simply PASTE them back to each html file, without modifying the case, or the text itself, in any way. Is it possible to modify this plugin to do that? If it's not possible, no worries. If it is possible but you don't want to spend more time on it, let me know, and I will try to figure it out myself. I tried the new version of the plugin, unfortunately it is doing something very strange now, I am not sure exactly what. Here is the result after running it: Code:
<div title="Le Lion Sur La Collinenonenone*Unprends Les Ronces À Pleines Mains, Et Tu Te Piqueras…Far Dareis Maicar’A’Carncar’A’Carnfais Flèche De Tout Bois, Ou Laisse Les Ténèbres S’Abattre Sur Le Monde…Leitmotivsaidinsaidinsaidinsaidinidemla Seule Façon De Vivre C’Est De Mourir…Je Dois Mourir. La Mort, Voilà Tout Ce Que Je Mérite…Car’A’Carnsaidinsaidinsammael, Rahvin, Moghedien Et…Non, S’Ils Étaient Tous Des Suppôts Des Ténèbres, Tu Les Utiliserais Quand Même.Shoufacar’A’Carncar’A’Carnet Où Qu’Elles Soient… Des Aes Sedai… Au Service De Tous… Mais Le Hall Des Serviteurs Est Détruit, Désormais… Détruit Pour Toujours… Ilyena, Mon*Amour…Car’A’Carnnonenone">
<h1 id="toc_marker-6">1</h1>
<h2><span class="Cap">L</span><span class="SmallCap">E LION SUR LA COLLINE</span></h2>
<p class="Center"><span class="SmallCap"><span><img alt="06jordan-1.jpg" src="../Images/06jordan-1.jpg" width="20%"/></span></span></p>
<p class="Center"><span class="SmallCap">*</span></p>
<p>La Roue du Temps tourne et les Âges naissent et meurent, laissant dans leur sillage des souvenirs destinés à devenir des légendes. Puis les légendes se métamorphosent en mythes qui sombrent eux-mêmes dans l’oubli longtemps avant la renaissance de l’Âge qui leur donna le jour.</p>
|
||
07-04-2020, 01:26 AM | #34 | |
Groupie
Posts: 166
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Quote:
|
|
07-04-2020, 01:29 AM | #35 | |
Groupie
Posts: 166
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Quote:
Edit for clarity: I mean, I want to copy the text from the existing toc into a title attribute for each heading, without in any way relying on the text in the h* tags of each file. So for example: HTML file: Code:
<h1 id="toc_marker-26">1</h1> <h2><span class="Cap">E</span><span class="SmallCap">N CHEMIN POUR</span> <span class="Cap">S</span><span class="SmallCap">HADAR</span> <span class="Cap">L</span><span class="SmallCap">OGOTH</span></h2> Code:
<navPoint id="navPoint-7" playOrder="7"> <navLabel> <text>1. En chemin pour Shadar Logoth</text> </navLabel> <content src="Text/9782820516909-5.xhtml#toc_marker-26"/> </navPoint> The final result (after the plugin and maybe a regex to place the text where it belongs) should be something like this: HTML file: Code:
<h1 id="toc_marker-26" title="1. En chemin pour Shadar Logoth">1</h1> <h2><span class="Cap">E</span><span class="SmallCap">N CHEMIN POUR</span> <span class="Cap">S</span><span class="SmallCap">HADAR</span> <span class="Cap">L</span><span class="SmallCap">OGOTH</span></h2> Last edited by Mister L; 07-04-2020 at 02:06 AM. |
|
07-04-2020, 03:10 AM | #36 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
I've altered the plugin again, fixed some problems. I've changed the following:
I'm still working on the span kludge problem. I'll give you a new plugin after I fix that. Last edited by slowsmile; 07-04-2020 at 10:49 AM. |
07-04-2020, 10:44 AM | #37 | |
Groupie
Posts: 166
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Quote:
I don't know what the word "kludge" means but the first two steps are exactly what I am hoping for. Can't wait to try out the new plugin. |
|
07-04-2020, 02:03 PM | #38 | |
Bookmaker & Cat Slave
Posts: 11,482
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
I ask the customer. With most scenarios, I do as requested by the customer--even when it's wrong. I try my best, within the bounds of the contractual relationship and my tolerance for BS, to keep them from going completely off the rails in terms of grammar and proper punctuation usage, (if asked), but after that, it's on them. (For example, gently explaining that emdashes and ellipses don't actually have spaces before and aft, in print, sigh...) For TOCs title case, I use the usual if "converting" from all-caps. (APA Title case with l/c for articles and the like.) If we're asked to do so and then we tell the customer to check it. (And 99% of the time, they don't, but whatchagonnado?) Hitch |
|
07-04-2020, 09:43 PM | #39 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
@Mister L...Here's the latest plugin. I think the new plugin is close to what you want now. Anyway, we'll see.
By the way, "kludge" refers to unnecessary dross code. When you use spans with classes to achieve titlecase or smallcaps for headings it makes it awkward and more difficult for the plugin code to actually find the html heading names because the heading name characters are all split up and insulted with multiple span styling. Why they don't just type in the heading the way they want to see it in their original doc(without using spans) just boggles the mind. How easy is that? That's span "kludge". For my own ebooks I never use span styling in my html headings which are always styled as a standard either as allcaps(typed in) or as proper titlecase(typed in) and that's it. See below. Last edited by slowsmile; 07-09-2020 at 04:06 AM. |
07-05-2020, 01:15 AM | #40 | |
Bookmaker & Cat Slave
Posts: 11,482
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
Hitch |
|
07-06-2020, 09:22 AM | #41 | |||
Groupie
Posts: 166
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Quote:
Quote:
I am a code purist, like you seem to be, so I avoid extra spans and styles as much as possible, don't put the chapter number and title in 2 separate tags... The fake small-caps code drives me crazy but there are a couple of clients who use it in their house styles (which were set up before I started making their books, and since I'm not the only person who works for them it's not easy getting changes made all through the workflow). They have small-caps on the titles in the chapters, but they want the toc to show the titles in lower case (also part of their house styles). Nobody else who works for them ever puts the "toc display" title text in the files so whenever they give me an old file to modify, fixing the toc alone sometimes takes more time than whatever specific task I'm meant to be doing (thus the request for this plugin). I have no idea how the person who originally made the file manages it; do they hand-code the entire toc, every single time they work on a file?? These are epub2 books, if you modify the order of the files or add one or split or merge anything you have to renumber every single navpoint PLUS any modifications to the text... What a colossal waste of time. Quote:
When I have more liberty to decide though, for the majority of my clients, I make only fully backwards-compatible epub3 files and make typographical smallcaps using font-variant: smallcaps. I put the text either in allcaps (acronyms, roman numerals, etc.) or title case, depending on the situation. Very few of my clients object. One of them requests fake smallcaps on roman numerals / acronyms so they will be sure of the result everywhere, but those are outliers and as that still requires a span on the full word it doesn't really make much difference. The way I see it, smallcaps are a purely esthetic choice; they look pretty but if the text is displayed in title case on older software, no meaning is lost and it's not hugely less beautiful to read. And it makes cleaner code that is fully searchable (and does not cause trouble when generating the toc although anyway when I make a book, I add the title="" attribute from the start wherever necessary so I never have these problems on my own books). Also, it's really frustrating to me that the reading software developped by companies who easily have the ressources to improve it if they wanted to is still so primitive after all these years, and the way I see it, if we keep limiting ourselves to what is currently supported by all (or at least the majority) of reading sw, the sw devs have no reason to improve, because "there's no demand". Whereas if it's possible to point to X number of ebooks with typographical smallcaps and dropcap initials made with "first-letter" (etc.) and say "these books are not displaying as intended on your software", then at least there is a concrete argument in favour of improving, at least on all the new machines; as it's absolutely possible to make epub3 books which are completely compatible with epub2 rs (they won't have smallcaps or dropcap initials but they'll still be absolutely readable and look good), nobody loses. Last edited by Mister L; 07-06-2020 at 09:25 AM. |
|||
07-06-2020, 10:14 AM | #42 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
@Mister L...I've just downloaded the plugin again and tested it on 3 different epubs and it worked fine. It uses the file headings from the toc.ncx file to find the xhtml file headings. When I tested the plugin, it always found the xhtml headings and always inserted the title attribute with the correct NCX heading name without a problem.
' Things to try: 1. Download the plugin again. I did hurriedly change it a couple of times after initially uploading over small things that I wasn't happy with in the plugin. So I changed the plugin and re-uploaded several times. Trouble is I don't know when you downloaded the plugin. So best to download the plugin again to be sure that you have the latest working version. I'm sorry about that but I was tired of making new plugins versions for every small plugin change. 2. Before you run the plugin you should always generate a new epub NCX file by using Tools > Table of Contents > Generate Table of Contents. Doing that will make sure that all the appropriate and correct html headings(containing any h1 to h6 tags) will be in the toc.ncx file. Then after that try running the plugin. Basically what I'm saying here is that if you have no heading names in your toc.ncx file then the plugin won't be able to find any headings in the xhtml files. Just to also mention that if your epub has no epub TOC page then it's also quite possible that your epub's NCX file will contain no heading names as well. 3. Last point, be sure that you don't have any double quotes or apostrophe's in your NCX headings. In test I found the ''' html entity in an NCX heading name with an apostrophe. That html entity will prevent that heading being found using my plugin. I got this problem despite having no entries in Edit > Preferences > Preserve Entities(which surprised me). Also neither the Reformat > Mend.. nor Mend and prettify... will fix that html entity problem in the NCX file but you can fix it easily enough by manually deleting the html entity and re-typing the apostrophe as proper text into the relevant NCX heading name. ...And I promise no further plugin changes until after I get your next reply... Last edited by slowsmile; 07-06-2020 at 12:12 PM. |
07-06-2020, 12:28 PM | #43 | |||||
Groupie
Posts: 166
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Quote:
I set a checkpoint to compare the before and after, it appears to modify the indentations of all the tags and unexpectedly moved around a few unrelated things in the doctype but I don't see any modifications to the titles. Here's a screencap of the diff of one file. Quote:
Quote:
Quote:
Quote:
Would it help you if I gave you my sample file to use as a test case? Then you could see exactly the conditions I am talking about. I can't give it to you as it is because of copyright but maybe if I make an extract of just a few chapters and borkify the text that seems like it should be okay. |
|||||
07-06-2020, 12:30 PM | #44 | |
Bibliophagist
Posts: 39,404
Karma: 153780470
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
|
|
07-06-2020, 12:52 PM | #45 | |
Groupie
Posts: 166
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Quote:
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
GUI Plugin "TOC View Generator" (was: Define Content) | Mick2nd | Plugins | 20 | 06-26-2024 03:19 AM |
V3 "Feature" Full Screen Add Book Dialog | johnelle | Library Management | 3 | 08-11-2017 02:43 PM |
A warning for Linux users: slow "Add Books", "Unknown" title and Author | rolgiati | Library Management | 8 | 07-24-2013 04:36 PM |
"Add existing files" doesn't show all directories | Ripplinger | Sigil | 5 | 02-23-2013 11:43 AM |
Feature Request - TOC Exclude "> My Books" | chrisparker | Library Management | 2 | 10-13-2012 11:44 AM |