Name no template fields that Bindery does not have
This commit is contained in:
@@ -472,8 +472,7 @@ names, so a template from Calibre gives the same name in Bindery. Bindery adds `
|
||||
| `{last_modified}` | The date when the chapters last changed. |
|
||||
| `{id}` | The CWA book ID. For a story with no library book, and without CWA, the Bindery story ID. |
|
||||
|
||||
- A field with no value becomes empty text. So does a field that Bindery does not have, such as
|
||||
`{rating}` or a custom column.
|
||||
- A field with no value becomes empty text.
|
||||
- `{field:format|text before|text after}` adds the two texts only when the field has a value. Each
|
||||
of the three parts can be empty. `{series:|| - }` adds ` - ` after the series.
|
||||
- The format is a Python format. `{series_index:0>3s}` gives `002`, and `{title:.20s}` gives the
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""The file name templates, against the results of Calibre 9.2.1.
|
||||
|
||||
Each expected text is what Calibre gives for the same book and template. Bindery has no rating and no custom
|
||||
columns, and it has one date format, so there are no cases for those.
|
||||
Each expected text is what Calibre gives for the same book and template.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
@@ -70,7 +69,7 @@ def test_reference_cases_for_a_missing_series_and_for_alphabetic_order():
|
||||
("{title[0]}{title[1]}", "Bo"),
|
||||
("{title} {{{id}}}", "Book, The {42}"),
|
||||
(" {title} -\t{authors} ", "Book, The - Ann Writer & Ben Reader"),
|
||||
("{ title }{rating}{isbn}{#custom}", ""),
|
||||
("{ title }{other}", ""),
|
||||
("a|b|c{title:|-|}", "a|b|c-Book, The"),
|
||||
("{series}/{series_index:0>2s| | - }{title}", "Saga, The/ 2.35 - Book, The"),
|
||||
],
|
||||
@@ -179,8 +178,7 @@ def test_check_refuses_what_bindery_does_not_support(template, error):
|
||||
|
||||
|
||||
def test_check_accepts_the_templates_of_calibre():
|
||||
templates = ("", "{author_sort}/{title}/{title} - {authors}", "{title:>255s}", "x" * 1024, "{#saga_index:0>3s}")
|
||||
for template in templates:
|
||||
for template in ("", "{author_sort}/{title}/{title} - {authors}", "{title:>255s}", "x" * 1024):
|
||||
ft.check(template)
|
||||
|
||||
|
||||
@@ -199,7 +197,7 @@ def test_file_name_is_the_last_part_of_the_path():
|
||||
assert file_name("{author_sort}/{title}/{title} - {authors}") == "Book, The - Ann Writer & Ben Reader"
|
||||
assert file_name("{series}//{title} /") == "Book, The"
|
||||
assert file_name("{author_sort[0]}/{series}", series="") == "W"
|
||||
assert file_name("{series}/{rating}", series="") == ""
|
||||
assert file_name("{series}/{other}", series="") == ""
|
||||
assert file_name(" / ") == ""
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user