Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 11-14-2024, 01:08 PM   #1
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: 12,408
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Changes to template function documentation processing

For the past many years we have had 2 and sometimes 3 simultaneous different versions of documentation for template functions. These versions weren't kept in sync. Some versions were wrong. The multiple versions created extra work for translators. In addition, the version visible in the template tester was unformatted so complex documentation such as for format_date() was hard to read.

We have now completed the changes so that:
  • the one-true version of the documentation is the one shown in the template tester.
  • the web documentation is generated from the documentation in the template tester.
  • the template tester shows formatted documentation, with for example code samples and bulleted lists.
  • a document browser dialog is available from the template tester via a "Documentation" button.
The documentation will be checked and corrected over time. It documents how the functions are used in General Program Mode where the "value" parameter is explicit, as opposed to being implicit in Single Function Mode. People are welcome to participate, but we ask that you ensure that changes you make are correct.

The documentation on the web won't be updated until the next calibre release (not preview).

Translators and documentation editors:
The documentation uses an invented markup language "Formatter Function Markup Language" (FFML), a subset of BBCODE (used by MobileRead) and RST (sphinx web documentation). Both HTML and RST can be generated from FFML. It is documented in the FFML processing code (calibre.utils.ffml_processor.py), and inside calibre by pushing the (new) "General Information" button in the template tester.

A simple editor/viewer is available in calibre for documentation either while editing or translating. There is no requirement to use it, but doing so might help avoid formatting errors. This viewer/editor is available in two ways:
  • Using a shell with the command
    Code:
    calibre-debug -c "from calibre.gui2.dialogs.ff_doc_editor import main; main()"
    all on one line. For the moment this works if you are running from source. It will work with calibre binaries after the next release/preview.
  • By defining a keyboard shortcut in calibre for the action "Open the template documenation editor" in the Miscellaneous section of Preferences / Keyboard shortcuts. There isn't a default shortcut. For my use I set the shortcut to Ctrl+Alt+D.
The editor lets you enter and edit text in FFML, immediately seeing the formatted result. You can also see the original English documentation for existing template functions. However, I reiterate that the editor is low function. You can edit, copy and paste but not much more, which is sufficient for short documents. For longer documents I use a separate editor and use the built-in editor as a viewer to verify the result. That way while editing I get line wrapping and spell checking, for example.
chaley is offline   Reply With Quote
Old 11-22-2024, 01:10 AM   #2
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,609
Karma: 7891011
Join Date: Sep 2020
Device: none
Is it possible to save a documentation "note" for a stored template such as "books with notes containing text"?

Click image for larger version

Name:	stored templates docs.png
Views:	117
Size:	122.0 KB
ID:	212126
Comfy.n is offline   Reply With Quote
Advert
Old 11-22-2024, 03:58 AM   #3
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: 12,408
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Comfy.n View Post
Is it possible to save a documentation "note" for a stored template such as "books with notes containing text"?
I don't understand the question. You appear to have successfully entered some documentation for that template. Do you want to do something more than that?

EDIT: Or perhaps you entered it but it isn't being saved? If this is the problem then press the Replace button.
chaley is offline   Reply With Quote
Old 11-22-2024, 04:18 AM   #4
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,609
Karma: 7891011
Join Date: Sep 2020
Device: none
Quote:
Originally Posted by chaley View Post
EDIT: Or perhaps you entered it but it isn't being saved? If this is the problem then press the Replace button.
that was it.
Comfy.n is offline   Reply With Quote
Old 11-23-2024, 06:00 PM   #5
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: 10,892
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I now wonder if, in the future, there might be a way to export specific stored templates/functions and their documentation for other users to import (similar to Action Chains). Likely limited in its usefulness admittedly.
ownedbycats is offline   Reply With Quote
Advert
Old 11-24-2024, 04:54 AM   #6
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: 12,408
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
I now wonder if, in the future, there might be a way to export specific stored templates/functions and their documentation for other users to import (similar to Action Chains). Likely limited in its usefulness admittedly.
I've wondered about that. It would be useful for the recipes, especially now that the template's documentation is available and can be formatted. I'll look at it at some point.
chaley is offline   Reply With Quote
Old 11-24-2024, 07:36 AM   #7
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,609
Karma: 7891011
Join Date: Sep 2020
Device: none
On a quite unrelated note, I've recently wondered about a common repository for author notes...
Comfy.n is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Template function to strip HTML? halloleo Library Management 6 11-16-2023 03:20 AM
ePub version in template function? tamaracks Library Management 8 06-17-2023 07:54 PM
Short title template function TreeFrogBandit Library Management 2 06-11-2022 05:37 AM
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


All times are GMT -4. The time now is 05:38 PM.


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