|
|
Thread Tools | Search this Thread |
07-04-2018, 09:04 PM | #1 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
[Plugin] ReworkChapterHeads - Add, replace and reformat chapter headings
Automatically replaces or adds selected file headings or a single selected file heading in multiple user-defined formats and styles RequirementsPlugin 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 7, 8 & 10, OSX and Linux *** Current Version: "0.2.2" 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 ReworkChapterHeads_vXXX.zip. This will load and install the plugin into Sigil, which you can then select and run using Plugins > Edit > ReworkChapterHeads Description This plugin tries to provide an easy and quick way of replacing or adding either multi-file headings or a single file heading in your epub 2 or epub 3 file(added in v0.2.2.) that will be formatted according to the user's own individual styling preferences. The plugin allows the user to do the following: * Remove and/or add heading(s) * Add or change the heading text name * Add or change heading styles * Change the heading number style to numeric string, number as text or roman numerals * Change the heading number case to titlecase, uppercase or lowercase * Add classes to heading tag(s) * Create numbered headings only * Hide heading(s) This plugin automatically inserts all selected file group number types consecutively in various user-defined formats and styles using normal file selection from Sigil's Book Browser(See Plugin Run for details). User Options 1 -- Remove heading(s) (via dialog) * Remove heading(s) formatted with... This option allows the user to initially select and remove all selected heading lines in the epub or a single selected single heading line that is formatted in h1 to h6 heading style. If the Remove button is pressed the appropriate heading lines from the selected files will all be removed. But if the Skip button is pressed then this dialog will do nothing and the plugin will continue. So if you are replacing your heading(s) you should select the relevant heading style and use the Remove button but if you are adding new heading(s) then you should just use the Skip button(no headings will be removed). This remove/add feature is quite flexible and can also be used in other ways e.g. like removing the current h1 chapter headings in an epub and perhaps replacing them with formatted and styled h2 chapter headings. User Options 2 -- Add new heading(s)(via dialog) * Add heading name template This option allows the user to type and add the heading name part of the new heading into the textbox either in title case, lower case or upper case i.e. whatever you type into the textbox will be used as the main heading name throughout. * Select heading style Now allows a choice of h1 to h6 heading style for all newly generated headings(changed in v0.1.6). * Select chapter number style Allows the user to select the chapter or part numbering style e.g. numeric string, number as text or roman numerals. * Select chapter number case This option only works if you have previously chosen Select chapter number style > Number as Text. Available user choices: titlecase, uppercase or lowercase. Chapter number as text case examples: one, Ten and TWENTY-THREE. * Add classes to heading tag(s) The user just types a class name into the textbox for that class to be included in all the newly generated chapter heading tags. Also make sure that the class has already been properly defined in the css. If you need to add more than one class per chapter heading, then just add in each class separated by a comma or a space. * Use numbered headings only(added in v0.1.4) Allows the user to just use numbered headings for all chapter or part headings e.g. 1, 2, 3 or ONE, TWO, THREE or I, II, III. If Number as Text is selected, the text will always display in upper case whenever numbered headings is selected. * Hide heading(s) This feature is particularly useful if you are using jpeg images as chapter headings throughout your epub. By selecting and tagging the same pages containing these heading images using this plugin feature, these new chapter headings will remain invisible in Text View but they will still be present in HTML View, so this should help to make those chapter heading images both linkable and searchable in your epub. Caveat The new maximum number of chapters allowed when using the Number as Text or Roman Numerals dialog options has been increased to 100 (added in v0.1.7). Otherwise you'll get overrun errors. Depending on whether you use h1 to h6 heading styles, be sure that the chosen heading style for your heading is already properly defined by you in the css, otherwise the default heading style will be used. This plugin does not add or change styling in the css. Plugin Run * Using Ctl-Click and Shift-Click with your mouse, select either a single file or a multi-file group from Sigil's Book Browser. * Then just run the plugin and the chapter heading(s) will automatically be replaced or added and formatted according to your dialog choices. * Also bear in mind, for all chapter file group selections, that this plugin does not automatically update the epub TOC file or the Logical TOC(toc.ncx) to your new chapter heading style, so you should perhaps also run Create TOC and Generate TOC in Sigil to match up all ebook/device displays after running this plugin. This plugin can now add, replace or modify both selected file groups as well as modify a single heading from a selected xhtml file(added in v0.1.6). Plugin users should now be able to use single file selection to add or replace the main heading from any selected epub xhtml file e.g. any chapter heading, TOC file, Title, Introduction, Preface, About the Author etc. Changes Spoiler:
Last edited by slowsmile; 07-13-2019 at 01:09 AM. |
07-04-2018, 09:20 PM | #2 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
My thanks to AlanHK, theducks and DNSB for all their helpful suggestions for this plugin.
|
Advert | |
|
07-05-2018, 12:10 AM | #3 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
Not applicable anymore.
Last edited by slowsmile; 07-05-2018 at 02:06 AM. |
07-05-2018, 12:40 AM | #4 |
Bibliophagist
Posts: 40,573
Karma: 157444380
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
One oddity. I opened Sigil with no input file, installed the plugin and then split the Sigil startup file into two chunks before running the plugin. It worked but which of the two files was Chapter 1 seems to depend on the order I selected the files in. Click on Section0001 and then control-click on Section0002 and I got Section0001 as Chapter 1 and Section0002 as Chapter 2. Select Section0002 first and then Section0001, and Section0002 was Chapter 1 while Section0001 was Chapter 2.
For a real world test, I tried a backup copy of an images as chapter title epub and the plugin worked well adding the chapter numbers. Did I forget to say thanks? If so, thanks! |
07-05-2018, 01:51 AM | #5 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
DNSB...The way Sigil's file selection works has nothing really to do with the plugin. I'm pretty sure that Sigil selection works whereby the files are stored in an ascending list according to the order of selection(usually top to bottom if you use group selections or random selections). As it stands now the user's selection will collect your filenames from top to bottom in the Book Browser and process them exactly like that in the plugin. I must also admit that I never had any selection problems at all when testing the plugin. Perhaps it might be split file which caused these problems.
Also, as advised in the release notes, you must always select all chapter files from the Book Browser for this plugin to work properly. If your file selection does not include all chapter files then you will probably get differences in formatting and chapter file mis-numbering occurring as errors in the result. Last edited by slowsmile; 07-05-2018 at 04:51 AM. |
Advert | |
|
07-05-2018, 06:43 AM | #6 |
Hedge Wizard
Posts: 802
Karma: 19999999
Join Date: May 2011
Location: UK/Philippines
Device: Kobo Touch, Nook Simple
|
Hi
Have downloaded the plugin ready to use tomorrow. Thank you. |
07-05-2018, 07:20 AM | #7 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
Plugin Update: Switched to using combo-boxes in all dialogs for better visibility (v0.1.1)
Last edited by slowsmile; 07-05-2018 at 09:24 AM. |
07-05-2018, 09:06 AM | #8 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
Plugin Update: Fixed a bug with roman numerals formatting which was caused by a mispelling by me(v0.1.2).
Last edited by slowsmile; 07-05-2018 at 09:09 AM. |
07-05-2018, 10:24 AM | #9 |
Grand Sorcerer
Posts: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Added this to the plugin index thread.
Thanks. Last edited by DiapDealer; 07-05-2018 at 05:06 PM. |
07-05-2018, 04:37 PM | #10 | |
Bibliophagist
Posts: 40,573
Karma: 157444380
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
For the heck of it, I ctrl-click selected Chapter 1, 5, 2 ,4 ,3 and the following was generated in toc.ncx: Code:
<navPoint id="navPoint-3" playOrder="3"> <navLabel> <text>Chapter 1</text> </navLabel> <content src="Text/part0004.html"/> </navPoint> <navPoint id="navPoint-4" playOrder="4"> <navLabel> <text>Chapter 3</text> </navLabel> <content src="Text/part0005.html"/> </navPoint> <navPoint id="navPoint-5" playOrder="5"> <navLabel> <text>Chapter 5</text> </navLabel> <content src="Text/part0006.html"/> </navPoint> <navPoint id="navPoint-6" playOrder="6"> <navLabel> <text>Chapter 4</text> </navLabel> <content src="Text/part0007.html"/> </navPoint> <navPoint id="navPoint-7" playOrder="7"> <navLabel> <text>Chapter 2</text> </navLabel> <content src="Text/part0008.html"/> </navPoint> Last edited by DNSB; 07-05-2018 at 04:42 PM. |
|
07-05-2018, 05:19 PM | #11 |
Grand Sorcerer
Posts: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I'll take a look at how the C++ PluginRunner transfers the selected files to Python bk.selected_iter() function. I know how it logically happens (via a written/read config file), but I won't swear that UI selection order couldn't possibly be relevant to the ultimate iteration order of the files in the plugin. After all... this is the first situation I can think of that the order of the files in selected_iter() would even matter. I'll report back when I know more.
|
07-05-2018, 06:41 PM | #12 |
Grand Sorcerer
Posts: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Yep. bk.selected_iter() is definitely populated in the order that files were selected in Book Browser.
|
07-05-2018, 11:19 PM | #13 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
Thanks for the more detailed explanation(my explanation was just a guess really).
Just to also make the point again that plugin users must always select all chapter files whenever they use this plugin otherwise users are likely to get mismatched chapter styling and incorrect chapter numbering as a result. Last edited by slowsmile; 07-05-2018 at 11:38 PM. |
07-06-2018, 03:59 AM | #14 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
Plugin Update: The plugin will now automatically save the last settings from both dialogs as default settings(v0.1.3).
Last edited by slowsmile; 07-06-2018 at 10:05 PM. |
07-06-2018, 04:12 PM | #15 |
Bibliophagist
Posts: 40,573
Karma: 157444380
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help with Chapter seperators (lines underneath chapter headings) | indieauthor83 | Sigil | 9 | 06-23-2017 07:01 AM |
Invisible chapter headings? | bcamp47 | Sigil | 6 | 03-24-2013 01:38 AM |
How to mark chapter headings | JimLL | Sigil | 107 | 06-17-2012 10:02 AM |
Chapter Headings | Paxman53 | Conversion | 3 | 10-12-2011 01:31 PM |
Why H1 and H2 Chapter Headings? | Ransom | Calibre | 11 | 08-10-2011 05:29 PM |