![]() |
#1 |
Witchman
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
[Plugin] CombineNCXHeadings
Combines the chapter titles and chapter subtitles into single headings in the NCX TOC Requirements Plugin Type: Edit MIT Licence(OSI) Minimum Sigil requirement: v0.9.3 or higher Python Requirements: Python 3.4+ (Bundled or External) OS Requirements: Windows, OSX or Linux *** Tested on Windows 10, OSX and Linux *** Current Version: "0.1.3" Installation * Select Manage Plugins from the Plugins menu. In the dialog box, select either the Bundled Python or the External Python(Python 3.4+ should be installed on your computer to run this plugin externally). * Click Add Plugin and select CombineNCXHeadings_vXXX.zip. This will load and install the plugin into Sigil, which you can then select and run using Plugins > Edit > CombineNCXHeadings. Description This plugin combines the chapter title headings(as h1) and chapter subtitle headings(as h2) from the html files into single headings in the NCX TOC. The plugin user will also be able to:
Updates: This plugin will now create a flat NCX TOC showing all sub-headings formatted with h3 - h6 (Fixed in v0.1.2).If you wish to add indents to your sub-heading entries in your NCX TOC, you can do this in Sigil using Tools > Edit Table of Contents in the normal way by selecting each of the relevant headings in turn and using the Arrow Keys on your keyboard to directly add/remove indents in the edit window as you prefer. Changes: Spoiler:
Last edited by slowsmile; 02-08-2023 at 05:27 AM. |
![]() |
![]() |
![]() |
#2 |
Witchman
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
Can someone please add this plugin to the Sigil Plugin Index? With thanks.
|
![]() |
![]() |
![]() |
#3 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,438
Karma: 5702578
Join Date: Nov 2009
Device: many
|
|
![]() |
![]() |
![]() |
#4 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Could be useful.
What I've been doing when I have chapters like: <h1>Chapter 4</h1> <h2>Whatever happens</h2> is use regex to make it <h1>Chapter 4<br/> <span class="chapsub">Whatever happens</span></h1> Before I do "generate TOC" I convert <br/> <span class="chapsub"> to :<br/> <span class="chapsub"> So I get Chapter 4: Whatever happens in the toc file. Then I delete the colon from the chapter files. I'll still do this when there are other levels of heading (e.g. "Parts" ) that I want to retain, but if there are just chapters this might be simpler. |
![]() |
![]() |
![]() |
#5 |
Witchman
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
#AlanHK...I'm not really sure how your above example relates to my plugin. From your example, it's seems that you're actually removing the chapter subtitles from the epub TOC page. This plugin doesn't change or touch the epub TOC page. The plugin just combines the chapter title with the chapter subtitle in the toc.ncx file to give you a single-level NCX TOC. See example below:
It just changes the NCX headings from this: Code:
<navPoint id="navPoint-7" playOrder="7"> <navLabel> <text>CHAPTER 1</text> </navLabel> <content src="section-0007.xhtml#auto_bookmark_toc_8"/> <navPoint id="navPoint-8" playOrder="8"> <navLabel> <text>All About Kindle Create</text> </navLabel> <content src="section-0007.xhtml#a__Toc29195570"/> <navPoint id="navPoint-9" playOrder="9"> <navLabel> <text>Limitations of this Book</text> </navLabel> <content src="section-0007.xhtml#a__Toc29195571"/> Code:
<navPoint id="navPoint-3" playOrder="3"> <navLabel> <text>CHAPTER 1 — All About Kindle Create</text> </navLabel> <content src="section-0007.xhtml"/> </navPoint> <navPoint id="navPoint-4" playOrder="4"> <navLabel> <text>CHAPTER 2 — Preparing a Word Doc Using Ms Word</text> </navLabel> <content src="section-0009.xhtml"/> Last edited by slowsmile; 07-31-2020 at 06:09 AM. |
![]() |
![]() |
![]() |
#6 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,680
Karma: 23983815
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
Code:
<h1 title="Chapter 4: Whatever happens">Chapter 4<br/>
<span class="chapsub">Whatever happens</span></h1>
|
|
![]() |
![]() |
![]() |
#7 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
I do use "Title=" on pages with no visible headings (dedication, etc). |
|
![]() |
![]() |
![]() |
#8 |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Sep 2013
Location: Luanda - Angola
Device: Kobo Touch
|
[QUOTE=slowsmile;4011146]
Combines the chapter titles and chapter subtitles into single headings in the NCX TOC Something wrong! In the page: https://www.mobileread.com/forums/sh...d.php?t=331485 I click in: "Attached Files File Type: zip CombineNCXHeadings_v010.zip (22.3 KB, 135 views)" and I get the plugin "RemoveUnusedBookmarks Removes all unused bookmarks from the epub file " Can you please fix this? Thank you b rgds Ambaquista |
![]() |
![]() |
![]() |
#9 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 808
Karma: 2416112
Join Date: Jan 2017
Location: Poland
Device: Various
|
Plugin is OK. Only readme.html file is related to other plugin.
|
![]() |
![]() |
![]() |
#10 |
Witchman
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
@Ambaquista...I downloaded the CombineNCXHeadings_v010.zip file from your link and installed it in Sigil. And when I tested the plugin, it worked without problems. Regarding the README file, please ignore that file. I will upload another version of this plugin later without the readme file.
Last edited by slowsmile; 11-20-2020 at 03:14 AM. |
![]() |
![]() |
![]() |
#11 |
Witchman
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
Plugin Update(v0.1.1):
-- Removed README file and added MIT License file. Thanks to Ambaquista.
|
![]() |
![]() |
![]() |
#12 |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Sep 2013
Location: Luanda - Angola
Device: Kobo Touch
|
OK
Thanks all the kind (and fast!) answers! b rgds |
![]() |
![]() |
![]() |
#13 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
A book had chapter heads like
<h1>17</h1> <h2>Jack<h2> <h3>Monday</h3> There is some other formatting between heads that makes it difficult to combine them into a single heading in the text. Sigil generated a TOC with three levels; I wanted all 3 titles to be combined in the TOC. Using the plugin, it combined h1 and h2, but simply deleted the h3 text. So adding at least one more level would be appreciated. Also, it offers a choice of space, em or en dash and tilde as a separator. Could add period and colon to those. Or just allow to type in any character. (I know I can just use the tilde and replace it in the ncx myself.) So I went back back to using regex to build a "title=" tag in the h1 from the other heads. Last edited by AlanHK; 07-11-2021 at 12:01 AM. |
![]() |
![]() |
![]() |
#14 |
Witchman
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
@AlanHK...The plugin's prime purpose is to allow the plugin user to easily combine just the chapter title and chapter subtitle in various ways on a single line in the NCX TOC. As I see it, there is no provision or requirement for adding a third heading level or extra subheading to the NCX line, which I think would perhaps over-complicate the plugin and cause more confusion than anything else, which is why I prefer not to add any further heading levels to the existing NCX heading displays for this plugin.
Last edited by slowsmile; 07-16-2021 at 03:13 AM. |
![]() |
![]() |
![]() |
#15 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
OK. 3 levels of heading isn't too common. So I'll sharpen up my regex.
However, simply deleting lower level headings in the TOC is not good. If it doesn't combine them it should leave them. Now it erases all subheads within a chapter. And configurable separator character would be nice. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Metadata Source Plugin] Empty Plugin? (Fake Identifier) | mneimeyer | Plugins | 3 | 11-11-2019 08:07 PM |
[Plugin] QuickPrefsEdit - Edit plugin prefs json files. | slowsmile | Plugins | 3 | 07-25-2018 08:14 PM |
Goodread Perception Expander plugin not shown on plugin list (kobo h2o) | www | KOReader | 4 | 09-28-2017 10:34 AM |
Problem with my ScrambleEbook plugin and the Plugin Updater tool | jackie_w | Development | 14 | 01-19-2017 10:49 PM |
Plugin not customizable: Plugin: HTML Output does not need customization | flyingfoxlee | Conversion | 2 | 02-24-2012 02:24 AM |