mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
misc. typos, fix accidental nesting in template docs.
This commit is contained in:
parent
e64f766890
commit
95917bfcd1
@ -71,7 +71,7 @@ The first thing to note is that this zip file has a lot more files in it, explai
|
||||
The prefix ``calibre_plugins`` must always be present. ``some_name`` comes from the filename of the empty text file.
|
||||
``some_module`` refers to :file:`some_module.py` file inside the zip file. Note that this importing is just as
|
||||
powerful as regular python imports. You can create packages and subpackages of .py modules inside the zip file,
|
||||
just like you would normally (by defining __init__.py in each sub directory), and everything should Just Work.
|
||||
just like you would normally (by defining __init__.py in each sub-directory), and everything should Just Work.
|
||||
|
||||
The name you use for ``some_name`` enters a global namespace shared by all plugins, **so make it as unique as possible**.
|
||||
But remember that it must be a valid python identifier (only alphabets, numbers and the underscore).
|
||||
|
@ -45,7 +45,7 @@ the changes you have made look, click the Save button or use
|
||||
One useful feature is :guilabel:`Checkpoints`. Before you embark on some
|
||||
ambitious set of edits, you can create a checkpoint. The checkpoint
|
||||
will preserve the current state of your book, then if in the future you decide
|
||||
you dont like the changes you have made to you can go back to the state when
|
||||
you don't like the changes you have made to you can go back to the state when
|
||||
you created the checkpoint. To create a checkpoint, use :guilabel:`Edit->Create
|
||||
checkpoint`. Checkpoints will also be automatically created for you whenever you
|
||||
run any automated tool like global search and replace. The checkpointing
|
||||
@ -380,7 +380,7 @@ Removing unused CSS rules
|
||||
|
||||
Remove all unused CSS rules from stylesheets and <style> tags. Some books
|
||||
created from production templates can have a large number of extra CSS rules
|
||||
that dont match any actual content. These extra rules can slow down readers
|
||||
that don't match any actual content. These extra rules can slow down readers
|
||||
that need to process them all. Accessed via :guilabel:`Tools->Remove unused CSS`.
|
||||
|
||||
|
||||
@ -402,7 +402,7 @@ Beautifying files
|
||||
This tool is used to auto-format all HTML and CSS files so that they "look
|
||||
pretty". The code is auto-indented so that it lines up nicely, blank lines are
|
||||
inserted where appropriate and so on. Note that beautifying also auto-fixes
|
||||
broken HTML/CSS. Therefore, if you dont want any auto-fixing to be performed,
|
||||
broken HTML/CSS. Therefore, if you don't want any auto-fixing to be performed,
|
||||
first use the Check Book tool to correct all problems and only then run
|
||||
beautify. Accessed via :guilabel:`Tools->Beautify all files`.
|
||||
|
||||
@ -459,7 +459,7 @@ Checkpoints
|
||||
------------------------
|
||||
|
||||
:guilabel:`Checkpoints` are a way to mark the current state of the book as "special". You
|
||||
can then go on to do whatever changes you want to the book and if you dont like
|
||||
can then go on to do whatever changes you want to the book and if you don't like
|
||||
the results, return to the checkpointed state. Checkpoints are automatically
|
||||
created every time you run any of the automated tools described in the
|
||||
previous section.
|
||||
@ -790,4 +790,3 @@ text. The editor allows you to insert a snippet with only a few key strokes.
|
||||
The snippets are very powerful, with many features, such as placeholders you
|
||||
can jump between, automatic mirroring of repeated text and so on.
|
||||
For more information, see :doc:`snippets`.
|
||||
|
||||
|
@ -185,7 +185,7 @@ If your device appears as a USB disk to the operating system, adding support for
|
||||
We just need some information from you:
|
||||
|
||||
* Complete list of ebook formats that your device supports.
|
||||
* Is there a special directory on the device in which all ebook files should be placed? Also does the device detect files placed in sub directories?
|
||||
* Is there a special directory on the device in which all ebook files should be placed? Also does the device detect files placed in sub-directories?
|
||||
* We also need information about your device that calibre will collect automatically. First, if your
|
||||
device supports SD cards, insert them. Then connect your device to the computer. In calibre go to :guilabel:`Preferences->Miscellaneous`
|
||||
and click the "Debug device detection" button. This will create some debug output. Copy it to a file
|
||||
@ -366,7 +366,7 @@ With the USB cable + iTunes
|
||||
|
||||
Use the 'Connect to iTunes' method in the 'Getting started' instructions in `Calibre + Apple iDevices: Start here <http://www.mobileread.com/forums/showthread.php?t=118559>`_.
|
||||
|
||||
This method only works on Windows Vista and higher, and OS X upto 10.8. Linux
|
||||
This method only works on Windows Vista and higher, and OS X up to 10.8. Linux
|
||||
is not supported (iTunes is not available in linux) and OS X newer than 10.8 is
|
||||
not supported, as Apple removed the facility to use iTunes to manage books,
|
||||
replacing it with iBooks.
|
||||
@ -721,7 +721,7 @@ There can be two reasons why calibre is showing a empty list of books:
|
||||
and so starts up with an empty library instead. To remedy this, do a
|
||||
right-click on the calibre icon in the calibre toolbar and select Switch/create
|
||||
library. Click the little blue icon to select the new location of your
|
||||
calibre library and click OK. If you dont know the new location search your
|
||||
calibre library and click OK. If you don't know the new location search your
|
||||
computer for the file :file:`metadata.db`.
|
||||
|
||||
* Your metadata.db file was deleted/corrupted. In this case, you can ask
|
||||
@ -735,7 +735,7 @@ I am getting errors with my calibre library on a networked drive/NAS?
|
||||
**Do not put your calibre library on a networked drive**.
|
||||
|
||||
A filesystem is a complex beast. Most network filesystems lack various
|
||||
filesystem features that calibre uses. Some dont support file locking, some dont
|
||||
filesystem features that calibre uses. Some don't support file locking, some don't
|
||||
support hardlinking, some are just flaky. Additionally, calibre is a single user
|
||||
application, if you accidentally run two copies of calibre on the same networked
|
||||
library, bad things will happen. Finally, different OSes impose different
|
||||
@ -836,7 +836,7 @@ There are several possible things I know of, that can cause this:
|
||||
* You recently connected an external monitor or TV to your computer. In
|
||||
this case, whenever calibre opens a new window like the edit metadata
|
||||
window or the conversion dialog, it appears on the second monitor where
|
||||
you dont notice it and so you think calibre has frozen. Disconnect your
|
||||
you don't notice it and so you think calibre has frozen. Disconnect your
|
||||
second monitor and restart calibre.
|
||||
|
||||
* If you use RoboForm, it is known to cause calibre to crash. Add calibre to
|
||||
@ -1090,4 +1090,3 @@ Finally, you can add downloaded news to the calibre library with::
|
||||
/opt/calibre/calibredb add --with-library /path/to/library outfile.epub
|
||||
|
||||
Remember to read the command line documentation section of the calibre User Manual to learn more about these, and other commands.
|
||||
|
||||
|
@ -187,7 +187,7 @@ Contents based on these headings. Create the custom function below:
|
||||
data['toc'] = []
|
||||
tag_name, anchor, text = match.group(1), replace_entities(match.group(2)), replace_entities(match.group(3))
|
||||
data['toc'].append((file_name, tag_name, anchor, text))
|
||||
return match.group() # We dont want to make any actual changes, so return the original matched text
|
||||
return match.group() # We don't want to make any actual changes, so return the original matched text
|
||||
|
||||
# Ensure that we are called once after the last match is found so we can
|
||||
# output the ToC
|
||||
|
@ -239,8 +239,8 @@ The following functions are available in addition to those described in single-f
|
||||
* ``add(x, y)`` -- returns x + y. Throws an exception if either x or y are not numbers.
|
||||
* ``assign(id, val)`` -- assigns val to id, then returns val. id must be an identifier, not an expression
|
||||
* ``approximate_formats()`` -- return a comma-separated list of formats that at one point were associated with the book. There is no guarantee that the list is correct, although it probably is. This function can be called in template program mode using the template ``{:'approximate_formats()'}``. Note that format names are always uppercase, as in EPUB.
|
||||
* ``author_links(val_separator, pair_separator)`` -- returns a string containing a list of authors and that author's link values in the form ``author1 val_separator author1link pair_separator author2 val_separator author2link`` etc. An author is separated from its link value by the ``val_separator`` string with no added spaces. ``author:linkvalue`` pairs are separated by the ``pair_separator`` string argument with no added spaces. It is up to you to choose separator strings that do not occur in author names or links. An author is included even if the author link is empty.
|
||||
* ``author_sorts(val_separator)`` -- returns a string containing a list of author's sort values for the authors of the book. The sort is the one in the author metadata (different from the author_sort in books). The returned list has the form author sort 1 ``val_separator`` author sort 2 etc. The author sort values in this list are in the same order as the authors of the book. If you want spaces around ``val_separator`` then include them in the separator string
|
||||
* ``author_links(val_separator, pair_separator)`` -- returns a string containing a list of authors and that author's link values in the form ``author1 val_separator author1link pair_separator author2 val_separator author2link`` etc. An author is separated from its link value by the ``val_separator`` string with no added spaces. ``author:linkvalue`` pairs are separated by the ``pair_separator`` string argument with no added spaces. It is up to you to choose separator strings that do not occur in author names or links. An author is included even if the author link is empty.
|
||||
* ``author_sorts(val_separator)`` -- returns a string containing a list of author's sort values for the authors of the book. The sort is the one in the author metadata (different from the author_sort in books). The returned list has the form author sort 1 ``val_separator`` author sort 2 etc. The author sort values in this list are in the same order as the authors of the book. If you want spaces around ``val_separator`` then include them in the separator string
|
||||
* ``booksize()`` -- returns the value of the calibre 'size' field. Returns '' if there are no formats.
|
||||
* ``cmp(x, y, lt, eq, gt)`` -- compares x and y after converting both to numbers. Returns ``lt`` if x < y. Returns ``eq`` if x == y. Otherwise returns ``gt``.
|
||||
* ``current_library_name() -- `` return the last name on the path to the current calibre library. This function can be called in template program mode using the template ``{:'current_library_name()'}``.
|
||||
@ -309,7 +309,7 @@ The following functions are available in addition to those described in single-f
|
||||
* ``or(value, value, ...)`` -- returns the string "1" if any value is not empty, otherwise returns the empty string. This function works well with test or first_non_empty. You can have as many values as you want.
|
||||
* ``print(a, b, ...)`` -- prints the arguments to standard output. Unless you start calibre from the command line (``calibre-debug -g``), the output will go to a black hole.
|
||||
* ``raw_field(name)`` -- returns the metadata field named by name without applying any formatting.
|
||||
* ``raw_list(name, separator)`` -- returns the metadata list named by name without applying any formatting or sorting and with items separated by separator.
|
||||
* ``raw_list(name, separator)`` -- returns the metadata list named by name without applying any formatting or sorting and with items separated by separator.
|
||||
* ``re_group(val, pattern, template_for_group_1, for_group_2, ...)`` -- return a string made by applying the reqular expression pattern to the val and replacing each matched instance with the string computed by replacing each matched group by the value returned by the corresponding template. The original matched value for the group is available as $. In template program mode, like for the template and the eval functions, you use [[ for { and ]] for }. The following example in template program mode looks for series with more than one word and uppercases the first word::
|
||||
|
||||
{series:'re_group($, "(\S* )(.*)", "[[$:uppercase()]]", "[[$]]")'}
|
||||
@ -398,7 +398,7 @@ The following program produces the same results as the original recipe, using on
|
||||
|
||||
# Format the series index. Ends up as empty if there is no series index.
|
||||
# Note that leading and trailing spaces will be removed by the formatter,
|
||||
# so we cannot add them here. We will do that in the strcat below.
|
||||
# so we cannot add them here. We will do that in the strcat below.
|
||||
# Also note that because we are in 'program' mode, we can freely use
|
||||
# curly brackets in strings, something we cannot do in template mode.
|
||||
s_index = template('{series_index:0>2.0f}');
|
||||
@ -406,10 +406,10 @@ The following program produces the same results as the original recipe, using on
|
||||
# print(stripped, shortened, initials, s_index);
|
||||
|
||||
# Now concatenate all the bits together. The switch picks between
|
||||
# initials and shortened, depending on whether there is a space
|
||||
# initials and shortened, depending on whether there is a space
|
||||
# in stripped. We then add the brackets around s_index if it is
|
||||
# not empty. Finally, add the title. As this is the last function in
|
||||
# the program, its value will be returned.
|
||||
# the program, its value will be returned.
|
||||
strcat(
|
||||
switch( stripped,
|
||||
'.\s', initials,
|
||||
@ -445,7 +445,7 @@ The lookup function lets us do even fancier processing. For example, assume that
|
||||
|
||||
To accomplish this, we:
|
||||
1. Create a composite field (call it AA) containing ``{series}/{series_index} - {title'}``. If the series is not empty, then this template will produce `series/series_index - title`.
|
||||
2. Create a composite field (call it BB) containing ``{#genre:ifempty(Unknown)}/{author_sort}/{title}``. This template produces `genre/author_sort/title`, where an empty genre is replaced wuth `Unknown`.
|
||||
2. Create a composite field (call it BB) containing ``{#genre:ifempty(Unknown)}/{author_sort}/{title}``. This template produces `genre/author_sort/title`, where an empty genre is replaced with `Unknown`.
|
||||
3. Set the save template to ``{series:lookup(.,AA,BB)}``. This template chooses composite field AA if series is not empty, and composite field BB if series is empty. We therefore have two completely different save paths, depending on whether or not `series` is empty.
|
||||
|
||||
Templates and Plugboards
|
||||
|
@ -63,7 +63,7 @@ class DeviceConfig(object):
|
||||
c.add_opt('format_map', default=cls.FORMATS,
|
||||
help=_('Ordered list of formats the device will accept'))
|
||||
c.add_opt('use_subdirs', default=cls.SUPPORTS_SUB_DIRS_DEFAULT,
|
||||
help=_('Place files in sub directories if the device supports them'))
|
||||
help=_('Place files in sub-directories if the device supports them'))
|
||||
c.add_opt('read_metadata', default=True,
|
||||
help=_('Read metadata from files on device'))
|
||||
c.add_opt('use_author_sort', default=False,
|
||||
|
@ -145,7 +145,7 @@ class Bookmarks(BadLink):
|
||||
HELP = _(
|
||||
'This file stores the bookmarks and last opened information from'
|
||||
' the calibre ebook viewer. You can remove it if you do not'
|
||||
' need that information, or dont want to share it with'
|
||||
' need that information, or don\'t want to share it with'
|
||||
' other people you send this book to.')
|
||||
INDIVIDUAL_FIX = _('Remove this file')
|
||||
level = INFO
|
||||
|
@ -63,7 +63,7 @@ class AddAction(InterfaceAction):
|
||||
'file is the same book in a different format)')).triggered.connect(
|
||||
self.add_recursive_single)
|
||||
ma('recursive-multiple', _('Add books from directories, including '
|
||||
'sub directories (Multiple books per directory, assumes every '
|
||||
'sub-directories (Multiple books per directory, assumes every '
|
||||
'ebook file is a different book)')).triggered.connect(
|
||||
self.add_recursive_multiple)
|
||||
arm = self.add_archive_menu = self.add_menu.addMenu(_('Add multiple books from archive (ZIP/RAR)'))
|
||||
|
@ -86,10 +86,10 @@
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="opt_use_subdirs">
|
||||
<property name="toolTip">
|
||||
<string>If checked, books are placed into sub directories based on their metadata on the device. If unchecked, books are all put into the top level directory.</string>
|
||||
<string>If checked, books are placed into sub-directories based on their metadata on the device. If unchecked, books are all put into the top level directory.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use sub directories</string>
|
||||
<string>Use sub-directories</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -566,7 +566,7 @@ A value of zero means calculate automatically.</string>
|
||||
<item row="0" column="0" colspan="5">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>There are two kinds of caches that calibre uses to improve performance when rendering covers in the grid view. A disk cache that is kept on your hard disk and stores the cover thumbnails and an in memory cache used to ensure flicker free rendering of covers. For best results, keep the memory cache small and the disk cache large, unless you have a lot of extra RAM in your computer and dont mind it being used by the memory cache.</string>
|
||||
<string>There are two kinds of caches that calibre uses to improve performance when rendering covers in the grid view. A disk cache that is kept on your hard disk and stores the cover thumbnails and an in memory cache used to ensure flicker free rendering of covers. For best results, keep the memory cache small and the disk cache large, unless you have a lot of extra RAM in your computer and don't mind it being used by the memory cache.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
@ -371,11 +371,11 @@ class AjaxServer(object):
|
||||
'count': Number of books in this item,
|
||||
'url': URL to get list of books in this item,
|
||||
'has_children': If True this item contains sub categories, look
|
||||
for an entry corresponding to this item in subcategories int he
|
||||
for an entry corresponding to this item in subcategories in the
|
||||
main dictionary,
|
||||
}
|
||||
|
||||
:param sort: How to sort the returned items. CHoices are: name, rating,
|
||||
:param sort: How to sort the returned items. Choices are: name, rating,
|
||||
popularity
|
||||
:param sort_order: asc or desc
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user