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

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 03-30-2021, 08:55 AM   #46
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,856
Karma: 7035877
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Kovid accepted the changes. They are in calibre source, available to testing/inspection.
chaley is offline   Reply With Quote
Old 04-05-2021, 02:13 PM   #47
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,856
Karma: 7035877
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Turn the word 'break' into a keyword?

I am considering adding a 'break' statement to the template language to exit for loops. To do so I must make it a reserved word.

By way of a survey, do any of you have template local variables named 'break'? This change would require renaming them.

chaley is offline   Reply With Quote
Advert
Old 04-05-2021, 02:22 PM   #48
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 8,991
Karma: 62040409
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I do not use it; if I ever felt the need to, I could just use "br" instead.

btw, thanks for the word wrap!
ownedbycats is online now   Reply With Quote
Old 04-05-2021, 02:49 PM   #49
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,128
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by chaley View Post
I am considering adding a 'break' statement to the template language to exit for loops. To do so I must make it a reserved word.

By way of a survey, do any of you have template local variables named 'break'? This change would require renaming them.

Yes please. I ran into multiple situations that would have been much easier with this feature. Would you also add 'continue' to this?
capink is offline   Reply With Quote
Old 04-05-2021, 08:27 PM   #50
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by chaley View Post
I am considering adding a 'break' statement to the template language to exit for loops. To do so I must make it a reserved word.

By way of a survey, do any of you have template local variables named 'break'? This change would require renaming them.
Yes please. I doubt if I have used "break" as a variable name. I think it is to ingrained in me after C, C++, C#, Python and probably other languages. Which is a problem when writing Perl at work

Are you also adding "continue"?
davidfor is offline   Reply With Quote
Advert
Old 04-06-2021, 11:14 AM   #51
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,856
Karma: 7035877
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
06 Apr 2021 (in calibre version 5.15)
  • Add 'break' and 'continue' to the template language.
  • Add a "Test" button to the Stored Templates preferences dialog.
    Clicking this button opens a subsidiary template tester that can 'see' the templates being created/edited in the preferences dialog, where you can write a template that test the stored templates. It shows the values using the books selected before starting the preferences dialog.
  • Make TAB and SHIFT-TAB indent and unindent selected lines in the template tester.
  • Add template file load/save buttons and to the template tester context menu. The buttons and the context menu items do the same thing.
  • Add the ability to toggle word wrapping to the template tester context menu.
  • Make the top button line reflow to two lines if the dialog box isn't wode enough

Last edited by chaley; 04-18-2021 at 12:58 PM.
chaley is offline   Reply With Quote
Old 04-12-2021, 12:07 PM   #52
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,856
Karma: 7035877
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
12 Apr 2021 (in calibre version 5.15)
  • Add 'return expression' to the template language. The expression doesn't need to be in parentheses.
  • Improve syntax and runtime error messages
  • Fix not using metadata from the selected book when breakpointing.
  • Improved help text in the Stored Template dialog.
  • Allow hiding the help text in the Stored Template dialog.

Last edited by chaley; 04-18-2021 at 12:58 PM.
chaley is offline   Reply With Quote
Old 04-15-2021, 11:52 AM   #53
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,856
Karma: 7035877
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
14 Apr 2021 (in calibre version 5.15)
  • Add the infix operator 'pattern inlist list'. It returns True ('1') if the regular expression pattern matches any item in the comma-separated list, otherwise False ('').

Last edited by chaley; 04-18-2021 at 12:58 PM.
chaley is offline   Reply With Quote
Old 04-18-2021, 01:01 PM   #54
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,856
Karma: 7035877
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
18 April 2021 (In calibre version 5.16.1)
  • Fix a regression in calibre version 5.15 that broke stored templates. They always raise an exception.
  • Add a tweak "Tab stop width in the template editor (ID: template_editor_tab_stop_width)" to control the width of tab stops in the template editor. The default is now 4 average-size characters.

Last edited by chaley; 04-19-2021 at 10:29 AM.
chaley is offline   Reply With Quote
Old 04-18-2021, 01:05 PM   #55
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 8,991
Karma: 62040409
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by chaley View Post
18 April 2021 (In calibre source)
  • Fix a regression in calibre version 5.15 that broke stored templates. They always raise an exception.
  • Add a tweak "Tab stop width in the template editor (ID: template_editor_tab_stop_width)" to control the width of tab stops in the template editor. The default is now 4 average-size characters.
Is the first one why 5.16 was released so quickly?
ownedbycats is online now   Reply With Quote
Old 04-18-2021, 01:06 PM   #56
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,856
Karma: 7035877
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Is the first one why 5.16 was released so quickly?
No. It is still broken in 5.16. I just noticed it today.

We haven't had any bug reports, which says something about stored template usage.
chaley is offline   Reply With Quote
Old 04-18-2021, 01:49 PM   #57
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 8,991
Karma: 62040409
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I meant to implement one for my shared emblem/icon rules, but never got around to it.
ownedbycats is online now   Reply With Quote
Old 04-22-2021, 06:06 AM   #58
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,856
Karma: 7035877
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
21 April 2021 (In calibre version 5.17)
  • Add the function "character('character_name')" that returns the special character named by character_name. For example, character('newline') returns a newline character ('\n'). The function can be used with strcat() to create multiline and tab-aligned output. The supported character names are 'newline', 'return', 'tab', and 'backslash'. The argument to character() can be an expression that returns the character name.
  • Show special characters in the template editor & debugger as escape sequences, e.g., a newline is displayed as \n.
  • Performance improvements in the template language parser.

Last edited by chaley; 05-01-2021 at 04:57 AM.
chaley is offline   Reply With Quote
Old 06-03-2021, 11:03 AM   #59
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,856
Karma: 7035877
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
3 June 2021 (In calibre version 5.21)
  • Add the function date_arithmetic(date, calc_spec, fmt) to simplify computing new dates from existing ones. The documentation for the function is
    Quote:
    date_arithmetic(date, calc_spec, fmt) -- Calculate a new date from 'date' using 'calc_spec'. Return the new date formatted according to optional 'fmt'; if not supplied then the result will be in ISO format. The calc_spec is a string formed by concatenating pairs of 'vW' ('valueWhat') where 'v' is a possibly-negative number and W is one of the following letters:
    • 's': add 'v' seconds to 'date'
    • 'm': add 'v' minutes to 'date'
    • 'h': add 'v' hours to 'date'
    • 'd': add 'v' days to 'date'
    • 'w': add 'v' weeks to 'date'
    • 'y': add 'v' years to 'date', where a year is 365 days.
    Example: '1s3d-1m' will add 1 second, add 3 days, and subtract 1 minute from 'date'.
    NB: you probably want to use a raw_field() or '$$date' to fetch the source date so you can be sure that all the fields are there.

    And yes, the 'months' specifier is missing, because the number of days in a month depend on both the source date month and year. This is also why a year is fixed at 365 days.

Last edited by chaley; 06-13-2021 at 09:18 AM. Reason: Fix error in example
chaley is offline   Reply With Quote
Old 06-03-2021, 04:22 PM   #60
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 8,991
Karma: 62040409
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
That will be helpful.
ownedbycats is online now   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
A few questions... (template language, mainly) Clem2605 Library Management 2 12-30-2020 03:25 AM
Template Language phossler Calibre 8 01-12-2016 04:37 PM
Help needed with template language Mamaijee Devices 12 02-19-2013 01:52 AM
Help with template language Pepin33 Calibre 8 11-11-2012 08:32 AM
Template language question BookJunkieLI Library Management 7 02-02-2012 06:55 PM


All times are GMT -4. The time now is 02:32 PM.


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