Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 07-13-2020, 12:28 AM   #1
slowsmile
Witchman
slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
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:
  • Separately and individually style the word case of the chapter title and chapter subtitle parts of the combined headings in the NCX TOC.
  • Add a separator of your choice between the chapter title and chapter subtitle parts of the combined NCX TOC headings.
  • Lone chapter title headings(with no chapter subtitles) will also be styled in the user's chosen word case style.
  • This plugin will only create a single level NCX TOC.
For title case only, the plugin user can also more tightly control the title case output by adding the appropriate words to the ignore_titlecase variable in the plugin's associated JSON file. All words in the JSON string will automatically be excluded from title case conversion and will be displayed in lower case instead.

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:
v0.1.3 -- Fixed 'import sys' problem(thanks to @DiapDealer).
v0.1.3 -- Removed non-related README.txt file from plugin directory(thanks to @BeckyEBook).
v0.1.2 -- Fixed a problem where, after running the plugin, any h3 - h6 sub-headings were not displayed in the NCX TOC. See Update section for more details. Thanks to AlanHK
v0.1.1 -- Removed README file and added MIT License file. Thanks to Ambaquista.
v0.1.0 -- Initial release
Attached Files
File Type: zip CombineNCXHeadings_v013.zip (20.3 KB, 238 views)

Last edited by slowsmile; 02-08-2023 at 05:27 AM.
slowsmile is offline   Reply With Quote
Old 07-22-2020, 08:26 AM   #2
slowsmile
Witchman
slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
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.
slowsmile is offline   Reply With Quote
Advert
Old 07-22-2020, 09:57 AM   #3
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,627
Karma: 5433388
Join Date: Nov 2009
Device: many
Now added.

Quote:
Originally Posted by slowsmile View Post
Can someone please add this plugin to the Sigil Plugin Index? With thanks.
KevinH is offline   Reply With Quote
Old 07-30-2020, 11:50 PM   #4
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 668
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.
AlanHK is offline   Reply With Quote
Old 07-31-2020, 06:06 AM   #5
slowsmile
Witchman
slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
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"/>
To this:
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.
slowsmile is offline   Reply With Quote
Advert
Old 07-31-2020, 06:26 AM   #6
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by AlanHK View Post
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>
IMHO, it'd more efficient, if you used a regex to convert the heading to:

Code:
<h1 title="Chapter 4: Whatever happens">Chapter 4<br/>
<span class="chapsub">Whatever happens</span></h1>
Since Sigil will use title attributes to generate the TOC, you could simply re-generate the TOC without having to add/remove colons.
Doitsu is offline   Reply With Quote
Old 10-17-2020, 01:43 AM   #7
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
Quote:
Originally Posted by Doitsu View Post
Since Sigil will use title attributes to generate the TOC, you could simply re-generate the TOC without having to add/remove colons.
Yes, but now you have to manually update the "Title=" bit. Probably that would be simpler though, unless you were changing several chapter heads.

I do use "Title=" on pages with no visible headings (dedication, etc).
AlanHK is offline   Reply With Quote
Old 11-20-2020, 02:48 AM   #8
Ambaquista
Junior Member
Ambaquista began at the beginning.
 
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
Ambaquista is offline   Reply With Quote
Old 11-20-2020, 03:04 AM   #9
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 687
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Kindle (Key3, PW2, PW3), Nook (ST, GLP), Kobo Touch, Tolino Vision 2
Plugin is OK. Only readme.html file is related to other plugin.
BeckyEbook is offline   Reply With Quote
Old 11-20-2020, 03:12 AM   #10
slowsmile
Witchman
slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
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.
slowsmile is offline   Reply With Quote
Old 11-20-2020, 03:41 AM   #11
slowsmile
Witchman
slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
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.
slowsmile is offline   Reply With Quote
Old 11-20-2020, 04:51 AM   #12
Ambaquista
Junior Member
Ambaquista began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Sep 2013
Location: Luanda - Angola
Device: Kobo Touch
OK
Thanks all the kind (and fast!) answers!
b rgds
Ambaquista is offline   Reply With Quote
Old 07-10-2021, 11:47 PM   #13
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 668
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.
AlanHK is offline   Reply With Quote
Old 07-14-2021, 05:18 AM   #14
slowsmile
Witchman
slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
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.
slowsmile is offline   Reply With Quote
Old 07-16-2021, 03:28 AM   #15
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 668
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.
AlanHK is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 05:54 AM.


MobileRead.com is a privately owned, operated and funded community.