11-07-2014, 04:21 AM | #1 |
Age improves with wine.
Posts: 558
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
|
How to change the "inline TOC" template?
The editor lets you turn the internal ToC into an inline ToC (an XHTML file called "toc.xhtml"), but where is the template for this? The heading is normally "Table of Contents" but I've noticed that when editing books (in English) from foreign sources the heading will come out in German or Swedish or whatever, and I have to edit this manually... where does this get picked up from?
Also the page includes a set of standard CSS rules, which for <li> include "padding-left: 2em", and I generally change this manually to zero. I can't find the template that generates the ToC file anywhere... so my question is, is there a way to fix it so that (a) it always uses English and (b) I can set the standard styles the way I want them? |
11-07-2014, 04:30 AM | #2 |
creator of calibre
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
That is not user customizable.
|
Advert | |
|
11-07-2014, 04:38 AM | #3 |
Age improves with wine.
Posts: 558
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
|
OK. But:
a) I'm still puzzled how it picks up the language locale... is this encoded in the book somewhere? Where does Calibre get the localised text from? b) Wouldn't it be a good idea for the future to generate the inline ToC from a template in a file somwhere that users can customise, rather than hard-coding it? |
11-07-2014, 04:55 AM | #4 |
creator of calibre
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
a) language is taken from the book's metadata
b) Not particularly, the only templatable part is 3 lines of css which is trivial to replace with your own. And it will become even more trivial once the editor gets support for snippets |
11-07-2014, 07:48 AM | #5 |
Age improves with wine.
Posts: 558
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
|
Hmm, but it's still something i have to do by hand every time... and yet there are user-editable templates for HTML and CSS files which seem to be just as trivial...
|
Advert | |
|
11-07-2014, 09:41 AM | #6 |
creator of calibre
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I have no objection to making it a template, I just have higher priority things on my plate, patches are welcome
|
11-07-2014, 10:54 AM | #7 |
creator of calibre
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I had a minute, so here you go: https://github.com/kovidgoyal/calibr...ffa656b01c7fb7
|
11-09-2014, 11:18 AM | #8 |
Age improves with wine.
Posts: 558
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
|
|
11-29-2014, 09:01 AM | #9 |
Age improves with wine.
Posts: 558
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
|
Just upgraded to 2.11, and in the editor Prefs -> Editor Settings -> Change Templates, I still only have a choice of HTML or CSS.
The 2.10 release notes say "Edit Book: Make the CSS used for styling the generated HTML Table of Contents user customizable via http://manual.calibre-ebook.com/customize.html#overriding-icons-templates-et-cetera" but if I follow the instructions given by this link I can't find the template to change it. Am I just being stupid again, or is something missing? |
11-29-2014, 11:11 AM | #10 |
creator of calibre
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Read http://manual.calibre-ebook.com/cust...ates-et-cetera
and follow those instructions for customizing the template |
11-30-2014, 07:08 AM | #11 | |
Age improves with wine.
Posts: 558
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
|
Quote:
(Also, wouldn't it make sense to add this to the "edit template" menu as TOC along with HTML and CSS? More work for you, I know, but...) |
|
11-30-2014, 10:43 AM | #12 |
creator of calibre
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
templates/inline_toc_styles.css
|
12-05-2014, 08:05 AM | #13 |
Age improves with wine.
Posts: 558
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
|
I go to Preferences->Advanced->Miscellaneous and press Open Calibre Configuration Directory, and there is no "templates" folder... let alone the CSS file you specified.
Of course I could create the folder and the file, but it seems a bit bizarre if everyone has to go through this process and pester you for the correct filename every time... |
12-05-2014, 12:11 PM | #14 | |
Well trained by Cats
Posts: 29,803
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
It is quite possible that Resources or their children do not exist yet in the configuration folder, since they are almost always created by user actions. BTW If you don't find the source version of the template/Icon/whatever in Resources of the install folder. You my not be running a current version of Calibre (Like us XP users). |
|
12-06-2014, 09:28 AM | #15 | |
Age improves with wine.
Posts: 558
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
|
Quote:
What a pain to run around all over the place to find this -- must nicer if it were on the template menu in the editor preferences... oh well. Thanks for solving this for me! |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Kindle newbie needs "template" HTML & CSS | Rich_H | Kindle Developer's Corner | 12 | 09-10-2012 11:16 PM |
How change "Read" to "UnRead" on a SubForum? | unboggling | Feedback | 3 | 05-20-2012 02:48 AM |
Kindle DX optimal "page" size - PDF or Word template | guiyoforward | Amazon Kindle | 12 | 09-28-2010 07:05 PM |
Getting calibre to detect "Prologue" and "Epilogue" for TOC | sherman | Calibre | 2 | 09-20-2010 02:21 AM |