Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 10-15-2021, 01:17 PM   #1
DyckBook
Morlock
DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.
 
DyckBook's Avatar
 
Posts: 33
Karma: 2734796
Join Date: Oct 2021
Device: Kindle Paperwhite
BuiltinAdd template language function

Does anyone have an example of using the BuiltinAdd template language function in a search and replace? It looks like this in the manual...

add(x [, y]*)
class calibre.utils.formatter_functions.BuiltinAdd

I don't know enough about Python or Regex to build my own, but might be able to modify whatever help you can give to meet my need. That need is that I have an e-book where the note references are out of sync between the chapters and the notes page. I looks like this function might be able to add a few digits to every chapter reference to make them agree, instead of having to make 286 changes manually.

Thanks in advance for any help you can give. In case you're tempted to tell me to just buckle down and learn this, I agree. But, I'm well into my seventies and my calcified brain learns new things so slowly now that I fear I'll be dead before I can figure this out on my own.
DyckBook is offline   Reply With Quote
Old 10-15-2021, 01:50 PM   #2
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,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by DyckBook View Post
Does anyone have an example of using the BuiltinAdd template language function in a search and replace? It looks like this in the manual...
add(x [, y]*)
class calibre.utils.formatter_functions.BuiltinAdd
What exactly are you trying to use this function for?
Are you looking for more information on regex functions by any chance?
Doitsu is offline   Reply With Quote
Old 10-16-2021, 02:57 PM   #3
DyckBook
Morlock
DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.
 
DyckBook's Avatar
 
Posts: 33
Karma: 2734796
Join Date: Oct 2021
Device: Kindle Paperwhite
Yes @doitsu, I am trying to learn more about regex functions. I'm not a programmer, so the best I can do is to take what others have done and make small changes that will work for me.

I have an e-book in which the note references are out of sync with the notes page. I used the sequential numbering function from the Calibre manual. But instead of renumbering the note references from the beginning of the book (which would have brought the references into sync) the numbering started with the second file and finished with the first. So, I thought I might find a function that would add a fixed number to all the references from file two through the end and simply renumber the first file by hand. BuiltinAdd sounded like a likely solution.
DyckBook is offline   Reply With Quote
Old 10-16-2021, 03:52 PM   #4
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,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
You might be able to use the Auto numbering sections example from the Calibre manual for this.
If you can't figure out how to modify the example code for your book, post the HTML code of the element(s) that you want to change.
Doitsu is offline   Reply With Quote
Old 10-19-2021, 04:21 PM   #5
DyckBook
Morlock
DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.
 
DyckBook's Avatar
 
Posts: 33
Karma: 2734796
Join Date: Oct 2021
Device: Kindle Paperwhite
Quote:
Originally Posted by Doitsu View Post
You might be able to use the Auto numbering sections example from the Calibre manual for this.
If you can't figure out how to modify the example code for your book, post the HTML code of the element(s) that you want to change.
Thanks @Doitsu. I had already used that to clean up the endnotes page, but the chapter references had gaps and jumps that I needed to clean up chapter by chapter. However [QUOTE=lomkiri;4158652] posted a solution to another problem in another thread that worked for me.
DyckBook is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using built-in template functions in a custom template function ilovejedd Library Management 4 01-28-2018 12:20 PM
Problem with contains function in save template MicaOlaAdams Calibre 5 10-21-2016 10:25 AM
how to use re() function in Template Program Mode? msciwoj Library Management 3 07-07-2016 03:55 PM
Template Language phossler Calibre 8 01-12-2016 04:37 PM
Help with template language Pepin33 Calibre 8 11-11-2012 08:32 AM


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


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