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

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Closed Thread
 
Thread Tools Search this Thread
Old 06-26-2018, 07:30 AM   #1
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
inserting sequential text

Is there any method, plugin, etc that will insert sequential text?

Specifically, I'd like to insert

<h2>Chapter 1</h2> in file chap01.html

<h2>Chapter 2</h2> in file chap02.html

etc., at the top of each file.

Or is there a way to refer to the name of the html file in the S&R regex? Then it would be simple to build the text.

Last edited by AlanHK; 06-26-2018 at 08:48 AM.
AlanHK is offline  
Old 06-26-2018, 06:02 PM   #2
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,093
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
I've used creative regex before to do this, but Doitsu made a plugin called "AddIDs - Generates incremental ids" that can easily add an incremental ID to some tag, like <h2>. Then it's really easy to regex those into Text between the tags.

Although, being able to reference the filename would be awesome too.
Turtle91 is offline  
Advert
Old 06-26-2018, 10:03 PM   #3
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 Turtle91 View Post
AddIDs
Yes, thanks.
AlanHK is offline  
Old 06-30-2018, 07:50 AM   #4
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 had some spare time today so I wrote a quick and dirty plugin to try and solve your sequential chapter heading problem. It's a small plugin and please be aware that I haven't tested it that thoroughly. But it seems to work without any major problems.

The plugin does the following:

* It inserts chapter headings in the relevant epub xhtml files according to your mark up.(See Plugin Run for details)

* It inserts the chapter headings and chapter numbering(consecutively) per xhtml file in Sigil's Book Browser.

* This plugin should work on both epubs and imported html docs.

* The dialog allows the user to type in and add the "chapter" part of the heading either in title case, lower case or upper case i.e. whatever you type into the "Type heading suffix" dialog textbox will be used as the main heading throughout.

* The dialog also allows the user to select either numeric chapter headings or chapter headings that use roman numerals. You are only allowed to have a maximum of 50 chapters in your epub if you use chapter headings with roman numerals, otherwise there will be errors.

* Depending on whether you use h1 or h2 heading styles, be sure that the styles for these headings are already properly defined by you in the css otherwise their default styling will be used. This plugin does not add or change any styling in the css.

Plugin run
Before you run this plugin you must first use a marker that you can insert in Sigil's Book View to denote the required locations of your chapter headings in each of the xhtml files. The following two symbols must be used together as the marker for the chapter heading locations -- @#(at + hash symbols). Use the latter symbols to mark where you want your consecutively numbered chapter headings to be placed. After you do this just run the plugin and the headings will be automatically added and formatted according to your mark-up and dialog choices.

Lastly, I'm not intending to release this plugin properly unless more people ask me to do so on this thread. I say this because I honestly can't see many other Sigil users being that interested in this plugin.
Attached Thumbnails
Click image for larger version

Name:	AddHeadings_dialog.JPG
Views:	151
Size:	23.4 KB
ID:	164743  
Attached Files
File Type: zip AddChapterHeadings_v010.zip (38.5 KB, 107 views)

Last edited by slowsmile; 07-01-2018 at 07:46 PM.
slowsmile is offline  
Old 06-30-2018, 12:39 PM   #5
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,768
Karma: 54401244
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by slowsmile View Post

Lastly, I'm not intending to release this plugin properly unless more people ask me to do so on this thread. I say this because I honestly can't see many other Sigil users being that interested in this plugin.
I think you underestimate the demand for this tool

Request: allow a class= value to be assigned (and saved) the the Header type. Default is as it is.
theducks is offline  
Advert
Old 06-30-2018, 07:03 PM   #6
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
@theducks
Quote:
I think you underestimate the demand for this tool
I'll take the above as a vote for proper release.

Quote:
Request: allow a class= value to be assigned (and saved) the the Header type. Default is as it is.
I really can't see the point of further complicating the plugin by adding the ability to add a class to h1 or h2 as well. Why bother doing that when all you would have to do to achieve the same thing is just directly restyle h1 or h2 in your stylesheet(without the need to use a class)? And you would only have to style h1 or h2 once in your css to get what you want. Sorry to disagree but I can't see that point of your suggestion when you could do the same thing so easily yourself in Sigil. And if you still want to add a class then why not just use Diap's TagMechanic plugin to do that for you?

Last edited by slowsmile; 06-30-2018 at 07:16 PM.
slowsmile is offline  
Old 06-30-2018, 07:28 PM   #7
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
I've had a quick rethink about the AddChapterHeadings plugin. I've realized that, apart from it's other features, it is the only plugin that can automatically change and consecutively add chapter headings either numerically or using roman numerals to your epub. So I probably will put it out as a proper release eventually because the plugin appears to be more useful than I'd previously realized.

Last edited by slowsmile; 06-30-2018 at 09:11 PM.
slowsmile is offline  
Old 07-01-2018, 12:04 AM   #8
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
Thanks for this.
If you're going to make it a "real" release, there should be an option for numbers as words, and that in different upper/lower/mixed cases (ONE / One /one).
AlanHK is offline  
Old 07-01-2018, 12:37 AM   #9
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 must admit that I only ever envisaged creating a plugin for just your problem which was limited to a plugin that only provided consecutive chapter numerics. That was your original proposal for a new plugin. Hopefully that has been satisfied.

Regarding your new suggestions, I'll have a look and see what I can do. And if I can't implement your suggested changes -- to make it a "real " release -- I think I will also take your advice and defer releasing the above plugin as a proper release. I think that's fair. This also means that there will be no further updates to the current plugin because it is not, as you have already said, a "real" release.

Last edited by slowsmile; 07-01-2018 at 12:59 AM.
slowsmile is offline  
Old 07-01-2018, 01:02 AM   #10
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 slowsmile View Post
@AlanHK...I must admit that I only ever envisaged creating a plugin for just your problem which was limited to a plugin that only provided consecutive chapter numerics. That was your original proposal for a new plugin. Hopefully that has been satisfied.

Personally, I had already solved my problem. As above though, others would have more use for it, those who create books from scratch more than converting or editing as I mostly do. My post was just prompted by a book that was just one long text file that I thought really needed to be broken up, for aesthetic as well as practical reasons.

Certainly many books do number chapters in words.
There are python libraries, e.g. https://pypi.org/project/num2words/

Otherwise, I notice the zip file includes the readme for "AddKindleMediaQueries" which is no doubt a relic from another project.
AlanHK is offline  
Old 07-01-2018, 02:23 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
@AlanHK...
Quote:
Otherwise, I notice the zip file includes the readme for "AddKindleMediaQueries" which is no doubt a relic from another project.
Well I did say in my original post that the plugin was a quick and dirty conversion. Do you know what quick and dirty means? I did that plugin for you in a hurry to help you out with a problem. And now you say you don't need the plugin anymore. Well, thanks for that update, it's a little late but appreciated. I find your attitude quite amusing. So you don't need my plugin anymore but you're still complaining. Yup, hilarious.

And no, I'm not going to change the plugin because, as you've said, it's not a "real" release.

Last edited by slowsmile; 07-01-2018 at 04:30 AM.
slowsmile is offline  
Old 07-01-2018, 02:03 PM   #12
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,270
Karma: 145435140
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by slowsmile View Post
@AlanHK...


Well I did say in my original post that the plugin was a quick and dirty conversion. Do you know what quick and dirty means? I did that plugin for you in a hurry to help you out with a problem. And now you say you don't need the plugin anymore. Well, thanks for that update, it's a little late but appreciated. I find your attitude quite amusing. So you don't need my plugin anymore but you're still complaining. Yup, hilarious.

And no, I'm not going to change the plugin because, as you've said, it's not a "real" release.
Personally, I would like to see your plugin made into a "real" release. For me, the issue is ebooks that use an image as the chapter number and being able to add the chapter numbers automatically is very useful -- a TOC that consists of blank lines is pretty useless and adding the chapter numbers using a regex kludge is not pretty.

Last edited by DNSB; 07-01-2018 at 04:58 PM.
DNSB is online now  
Old 07-01-2018, 07:18 PM   #13
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
@DNSB...I'm currently cleaning up the plugin before general release. I also need to finish it off properly(with proper error checks added etc) and test it properly because I coded it so quickly. So this plugin will be properly released soon.

The plugin now allows the user to add or replace and separately reformat the 'chapter' header part and consecutive chapter number part in any style they prefer i.e. numeric string(chapter 1, Chapter 10, CHAPTER 23 etc), number as text(chapter one , Chapter Fifteen or CHAPTER TWENTY-THREE) or roman numerals(chapter II, Chapter XXIX, CHAPTER XXXIV).

Last edited by slowsmile; 07-01-2018 at 08:42 PM.
slowsmile is offline  
Old 07-02-2018, 11:42 PM   #14
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 slowsmile View Post
@AlanHK...
Well I did say in my original post that the plugin was a quick and dirty conversion. Do you know what quick and dirty means?.
Do you know what a bug report is?
Try not to take a critique of your code as a mortal insult.

Quote:
Originally Posted by slowsmile View Post
I did that plugin for you in a hurry to help you out with a problem. And now you say you don't need the plugin anymore. Well, thanks for that update, it's a little late but appreciated.
Really, I'm not trying to disrespect you.
"AddIDs" had already solved my problem, as I acknowledged 3 days before you posted.
Since several others have said your plugin could have a wider application, my remarks were in the context of making something for general use, not a bespoke application.

Quote:
Originally Posted by slowsmile View Post
I find your attitude quite amusing. So you don't need my plugin anymore but you're still complaining. Yup, hilarious.
I find your attitude bewildering.
I was polite in every post. I thanked you.
Yet you find a way to take offence at everything I say.
Again, a critique is not a "complaint".

Quote:
Originally Posted by slowsmile View Post
The plugin now allows the user to add or replace and separately reformat the 'chapter' header part and consecutive chapter number part in any style they prefer i.e. numeric string(chapter 1, Chapter 10, CHAPTER 23 etc), number as text(chapter one , Chapter Fifteen or CHAPTER TWENTY-THREE) or roman numerals(chapter II, Chapter XXIX, CHAPTER XXXIV).
Exactly what I suggested.
But I'm an ungrateful **** for making the suggestion.

Last edited by AlanHK; 07-03-2018 at 12:14 AM.
AlanHK is offline  
Old 07-03-2018, 02:31 AM   #15
Thasaidon
Hedge Wizard
Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.
 
Thasaidon's Avatar
 
Posts: 800
Karma: 19999999
Join Date: May 2011
Location: UK/Philippines
Device: Kobo Touch, Nook Simple
Nice plugin. I will certainly download it. I do not think I will have to use it often nut it will be a godsend for those books that need it.

Last edited by Thasaidon; 07-03-2018 at 02:31 AM. Reason: typo
Thasaidon is offline  
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Assign Sequential Numbers to Series Index American_Desi Calibre 3 04-19-2018 07:47 PM
Sequential Posting issybird Feedback 12 03-03-2015 05:49 PM
Inserting a jpeg into a PM Lynx-lynx Feedback 11 12-24-2014 06:17 AM
Sequential entries in Title field rlh3 Library Management 5 03-10-2013 11:12 PM
Sequential numbers regex? soparch Sigil 7 10-10-2011 05:51 AM


All times are GMT -4. The time now is 09:43 PM.


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