Quote:
Originally Posted by slowsmile
Here's another plugin that you might like to try out. This plugin does the following: - Gathers all the toc item heading strings from the epub TOC page and puts them into a list.
|
- Yes! Brilliant! This is exactly what I was hoping for.
Quote:
Originally Posted by slowsmile
- Finds all headings and subheadings in the epub html using the TOC item heading list.
|
Perfect.
Quote:
Originally Posted by slowsmile
- Adds an associate toc item heading value(from the TOC page) to a new title attribute per heading or per sub-heading found, which will always be in title case. You were not very clear whether you just wanted only main chapter headings tagged with the title attribute or all chapter headings and sub-headings tagged. So I went with all chapter headings and sub-headings tagged with the title attribute.
|
That sounds good. But I don't quite understand "which will always be in title case". If the title is simply being copied from the TOC, then the case should be immaterial because the plugin does not need to modify the case or the text at all.
Quote:
Originally Posted by slowsmile
- The new plugin no longer changes any chapter heading tags or part heading tags in the epub -- it leaves them alone.
|
Perfect.
Quote:
Originally Posted by slowsmile
- The new plugin automatically iterates over all the files in your epub - so there's no need to select any files before running the new plugin.
|
Perfect.
Quote:
Originally Posted by slowsmile
- For the plugin to work without problems you must also make sure that the TOC page in the epub has either "Table of Contents" or "Contents" as the TOC page heading.
|
No problem.
Quote:
Originally Posted by slowsmile
This will also be my last attempt at trying to create your plugin. See below for the new plugin.
|
Understood. Thank you very much for your time and hard work. I do have a question though as I tried the plugin and it didn't do what I was expecting; maybe I did something wrong.
I took a file which I recently had to split into 2 books. It's an epub2 file with only a toc.ncx so I generated a toc.html with the title <h1 class="sgc-toc-title">Table of Contents</h1> (Sigil default title). Then I ran the plugin.
Chapter 1 appears in the toc.html as:
Code:
<div class="sgc-toc-level-1">
<a href="9782820516909-5.xhtml#toc_marker-6">1. Le lion sur la colline</a>
</div>
(in blue, the text that should be copied back into the title attribute)
and in the html file as:
Code:
<h1 id="toc_marker-6">1</h1>
<h2><span class="Cap">L</span><span class="SmallCap">E LION SUR LA COLLINE</span></h2>
After running the plugin the result I expected was:
Code:
<h1 id="toc_marker-6" title="1. Le lion sur la colline">1</h1>
<h2><span class="Cap">L</span><span class="SmallCap">E LION SUR LA COLLINE</span></h2>
But instead the result is this:
Code:
<h1 id="toc_marker-6" title="1">1</h1>
<h2><span class="Cap" title="L">L</span><span class="SmallCap">E LION SUR LA COLLINE</span></h2>
The full title from the toc.html doesn't get copied back; only the first character of the text of each h* tag, and one on each h* tag, even though there is only one toc id (on the h1).
I understand if you don't want to spend any more time on this, but I want to check if there is something I did wrong that I can easily fix. If this is something that needs to be tweaked in the plugin itself, if you can give me a hint about which file to modify in the plugin I will see if I can figure out how to fix it myself starting with what you have made.
Thanks again very much for taking a crack at it, I appreciate it. (I tried to give you some karma for that but it says I must "spread it around".)