Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 02-06-2023, 02:46 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] GenerateHeadings

Automatically generates main headings in the epub

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, Linux or OSX
*** Tested on Windows 7, 8 & 10 only ***
Current Version: "0.1.1"

Installation
* Select Manage Plugins from the Plugins menu. In the dialog box, select either the Bundled Python or the External Python(Python 3.8+ should be installed on your computer to run this plugin externally).

* Click Add Plugin and select GenerateHeadings_vXXX.zip. This will load and install the plugin into Sigil, which you can then run by selecting Plugins > Edit > GenerateHeadings.

Description

I wrote this plugin through frustration because it is still very common, for example, when exporting epubs from apps like LibreOffice Writer, Kindle Create or Scrivener(old version), that create epubs with missing strings in the <title></title> tags and with all chapter headings incorrectly formatted using <p> tags.

This plugin just does just three tasks:
  • Automatically converts all tags containing main/chapter headings to either ‘h1’ or ‘h2’ format, depending on your heading style choice in the JSON prefs file(See Preferences below).
  • This plugin also automatically inserts all main/chapter heading names in between the <title></title> tags per section. If there is no title on the page or if the title text is greater than 10 words in length then 'Unknown' will be inserted instead.
  • The plugin user can also choose to generate ‘Title Page’ at the top of their Sigil-generated TOC by placing a marker at the start of the title string on the html title page. The current default marker is a tilde or “~” but the plugin user can also set their own preferred marker if they want(See Preferences).
This plugin can be used with valid Epub 2 or Epub 3 files.

Preferences
Here are the editable JSON file entries for this plugin:
{
"heading_list": [
"chapter",
"introduction",
"preface",
"prologue",
"epilogue",
"about the author",
"other books"
],
"heading_type": "h1",
"title_page_marker": "~"
}

heading_list
This editable list contains the search terms that will be used by this plugin when searching for your main/chapter headings in your epub. This list can be edited and changed by you to suit your own heading search preferences. By default, this list is currently setup to search for most of the standard headings currently used in books and ebooks.

heading_type
This allows the user to set eitther ‘h1’ or ‘h2’ as their chapter/main heading format. The default setting is ‘h1’.

title_page_marker
The plugin user can also use a marker of his own choice in order to add “title=Title Page” into the html formatting of the the main title in the title section. Just place the marker in front of the title string in the title page. The current default marker is a tilde or "~" and how to use it in the html is shown below:

Code:
<p class="P1">~The Book Title</p>
The user can also change to a different marker of their own choice in JSON prefs. Setting the marker automatically changes the title tag to the appropriate chapter heading style and also creates a TOC link to the title page named ‘Title Page’ after you eventually create and generate your TOC in Sigil.

Plugin Run
After running the plugin once, check that the search words in the JSON file heading list are to your own personal liking and, if required, you can add or change the JSON settings as you like.


Changes:
Spoiler:
v0.1.0 -- Initial release.
v0.1.1 -- Corrected a mispelling in the default heading list.
Attached Files
File Type: zip GenerateHeadings_v011.zip (120.8 KB, 350 views)

Last edited by slowsmile; 05-09-2023 at 02:51 AM.
slowsmile is offline   Reply With Quote
Old 02-06-2023, 11:43 AM   #2
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,645
Karma: 5433388
Join Date: Nov 2009
Device: many
Added to the Sigil Plugin Index
KevinH is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Plugin] LOI-Generator - edit] plugin to generate a List of Illustrations KevinH Plugins 1 01-19-2023 04:31 PM
[GUI Plugin] Noosfere_util, a companion plugin to noosfere DB lrpirlet Plugins 2 08-18-2022 03:15 PM
[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


All times are GMT -4. The time now is 08:03 AM.


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