mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
string changes
This commit is contained in:
parent
8095b33d09
commit
d2158d75b9
@ -133,7 +133,7 @@ Changing text file order
|
|||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
You can re-arrange the order in which text (HTML) files are opened when reading
|
You can re-arrange the order in which text (HTML) files are opened when reading
|
||||||
the book by simply dragging and dropping them in the Files browser or clicking
|
the book by simply dragging and dropping them in the :guilabel:`File browser` or clicking
|
||||||
on the file to move and then pressing the :kbd:`Ctrl+Shift` modifiers with the
|
on the file to move and then pressing the :kbd:`Ctrl+Shift` modifiers with the
|
||||||
:kbd:`Up`, :kbd:`Down`, :kbd:`Home` or :kbd:`End` keys. For the technically
|
:kbd:`Up`, :kbd:`Down`, :kbd:`Home` or :kbd:`End` keys. For the technically
|
||||||
inclined, this is called re-ordering the book spine.
|
inclined, this is called re-ordering the book spine.
|
||||||
|
@ -207,7 +207,7 @@ HTML Table of Contents, ready to be pasted into :file:`toc.html`.
|
|||||||
The function above is heavily commented, so it should be easy to follow. The
|
The function above is heavily commented, so it should be easy to follow. The
|
||||||
key new feature is the use of another useful extra argument to the
|
key new feature is the use of another useful extra argument to the
|
||||||
``replace()`` function, the ``data`` object. The ``data`` object is a Python
|
``replace()`` function, the ``data`` object. The ``data`` object is a Python
|
||||||
*dict* that persists between all successive invocations of ``replace()`` during
|
*dictionary* that persists between all successive invocations of ``replace()`` during
|
||||||
a single :guilabel:`Replace All` operation.
|
a single :guilabel:`Replace All` operation.
|
||||||
|
|
||||||
Another new feature is the use of ``call_after_last_match`` -- setting that to
|
Another new feature is the use of ``call_after_last_match`` -- setting that to
|
||||||
@ -278,9 +278,9 @@ for the current book's language.
|
|||||||
The ``data`` argument
|
The ``data`` argument
|
||||||
^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
This a simple Python ``dict``. When you run
|
This a simple Python ``dictionary``. When you run
|
||||||
:guilabel:`Replace all`, every successive match will cause ``replace()`` to be
|
:guilabel:`Replace all`, every successive match will cause ``replace()`` to be
|
||||||
called with the same ``dict`` as data. You can thus use it to store arbitrary
|
called with the same ``dictionary`` as data. You can thus use it to store arbitrary
|
||||||
data between invocations of ``replace()`` during a :guilabel:`Replace all`
|
data between invocations of ``replace()`` during a :guilabel:`Replace all`
|
||||||
operation.
|
operation.
|
||||||
|
|
||||||
|
@ -737,9 +737,9 @@ A developer can choose to pass additional information to the template processor,
|
|||||||
|
|
||||||
**Developer: how to pass additional information**
|
**Developer: how to pass additional information**
|
||||||
|
|
||||||
The additional information is a Python dictionary containing pairs ``variable_name: variable_value`` where the values must be strings. The template can access the dict, creating template local variables named ``variable_name`` containing the value ``variable_value``. The user cannot change the name so it is best to use names that won't collide with other template local variables, for example by prefixing the name with an underscore.
|
The additional information is a Python dictionary containing pairs ``variable_name: variable_value`` where the values must be strings. The template can access the dictionary, creating template local variables named ``variable_name`` containing the value ``variable_value``. The user cannot change the name so it is best to use names that won't collide with other template local variables, for example by prefixing the name with an underscore.
|
||||||
|
|
||||||
This dict is passed to the template processor (the ``formatter``) using the named parameter ``global_vars=your_dict``. The full method signature is::
|
This dictionary is passed to the template processor (the ``formatter``) using the named parameter ``global_vars=your_dict``. The full method signature is::
|
||||||
|
|
||||||
def safe_format(self, fmt, kwargs, error_value, book,
|
def safe_format(self, fmt, kwargs, error_value, book,
|
||||||
column_name=None, template_cache=None,
|
column_name=None, template_cache=None,
|
||||||
@ -749,17 +749,17 @@ This dict is passed to the template processor (the ``formatter``) using the name
|
|||||||
|
|
||||||
**Template writer: how to access the additional information**
|
**Template writer: how to access the additional information**
|
||||||
|
|
||||||
You access the additional information (the ``globals`` dict) in a template using the template function::
|
You access the additional information (the ``globals`` dictionary) in a template using the template function::
|
||||||
|
|
||||||
globals(id[=expression] [, id[=expression]]*)
|
globals(id[=expression] [, id[=expression]]*)
|
||||||
|
|
||||||
where ``id`` is any legal variable name. This function checks whether the additional information provided by the developer contains the name. If it does then the function assigns the provided value to a template local variable with that name. If the name is not in the additional information and if an ``expression`` is provided, the ``expression`` is evaluated and the result is assigned to the local variable. If neither a value nor an expression is provided, the function assigns the empty string (``''``) to the local variable.
|
where ``id`` is any legal variable name. This function checks whether the additional information provided by the developer contains the name. If it does then the function assigns the provided value to a template local variable with that name. If the name is not in the additional information and if an ``expression`` is provided, the ``expression`` is evaluated and the result is assigned to the local variable. If neither a value nor an expression is provided, the function assigns the empty string (``''``) to the local variable.
|
||||||
|
|
||||||
A template can set a value in the ``globals`` dict using the template function::
|
A template can set a value in the ``globals`` dictionary using the template function::
|
||||||
|
|
||||||
set_globals(id[=expression] [, id[=expression]]*)
|
set_globals(id[=expression] [, id[=expression]]*)
|
||||||
|
|
||||||
This function sets the ``globals`` dict key:value pair ``id:value`` where ``value`` is the value of the template local variable ``id``. If that local variable doesn't exist then ``value`` is set to the result of evaluating ``expression``.
|
This function sets the ``globals`` dictionary key:value pair ``id:value`` where ``value`` is the value of the template local variable ``id``. If that local variable doesn't exist then ``value`` is set to the result of evaluating ``expression``.
|
||||||
|
|
||||||
Notes on the difference between modes
|
Notes on the difference between modes
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
@ -681,7 +681,7 @@ class Cache:
|
|||||||
|
|
||||||
The returned value for is_multiple fields are always tuples, even when
|
The returned value for is_multiple fields are always tuples, even when
|
||||||
no values are found (in other words, default_value is ignored). The
|
no values are found (in other words, default_value is ignored). The
|
||||||
exception is identifiers for which the returned value is always a dict.
|
exception is identifiers for which the returned value is always a dictionary.
|
||||||
The returned tuples are always in link order, that is, the order in
|
The returned tuples are always in link order, that is, the order in
|
||||||
which they were created.
|
which they were created.
|
||||||
'''
|
'''
|
||||||
|
@ -508,7 +508,7 @@ class Source(Plugin):
|
|||||||
def get_cached_cover_url(self, identifiers):
|
def get_cached_cover_url(self, identifiers):
|
||||||
'''
|
'''
|
||||||
Return cached cover URL for the book identified by
|
Return cached cover URL for the book identified by
|
||||||
the identifiers dict or None if no such URL exists.
|
the identifiers dictionary or None if no such URL exists.
|
||||||
|
|
||||||
Note that this method must only return validated URLs, i.e. not URLS
|
Note that this method must only return validated URLs, i.e. not URLS
|
||||||
that could result in a generic cover image or a not found error.
|
that could result in a generic cover image or a not found error.
|
||||||
|
@ -892,7 +892,7 @@ class CreateNewCustomColumn:
|
|||||||
_("You cannot specify is_multiple for the datatype %s") % datatype)
|
_("You cannot specify is_multiple for the datatype %s") % datatype)
|
||||||
if not isinstance(display, dict):
|
if not isinstance(display, dict):
|
||||||
return (self.Result.INVALID_DISPLAY,
|
return (self.Result.INVALID_DISPLAY,
|
||||||
_("The display parameter must be a Python dict"))
|
_("The display parameter must be a Python dictionary"))
|
||||||
self.created_count += 1
|
self.created_count += 1
|
||||||
self.custcols[lookup_name] = {
|
self.custcols[lookup_name] = {
|
||||||
'label': lookup_name,
|
'label': lookup_name,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user