1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-20 05:03:35 +02:00

Move strftime to util.date module

In this patch strftime function is moved out of main __init__.py module
to util.date, where it belongs.
This commit is contained in:
2020-06-14 20:38:52 +02:00
parent fdd531f6e0
commit 3f8844832d
7 changed files with 93 additions and 90 deletions

View File

@@ -1,7 +1,7 @@
import re, codecs, os, numbers
from collections import namedtuple
from ebook_converter import strftime
from ebook_converter.utils import date
from ebook_converter.customize import CatalogPlugin
from ebook_converter.library.catalogs import FIELDS, TEMPLATE_ALLOWED_FIELDS
from ebook_converter.customize.conversion import DummyReporter
@@ -206,7 +206,7 @@ class BIBTEX(CatalogPlugin):
elif field == 'pubdate' :
bibtex_entry.append('year = "%s"' % item.year)
bibtex_entry.append('month = "%s"' % bibtexdict.utf8ToBibtex(strftime("%b", item)))
bibtex_entry.append('month = "%s"' % bibtexdict.utf8ToBibtex(date.strftime("%b", item)))
elif field.startswith('#') and isinstance(item, (str, bytes)):
bibtex_entry.append('custom_%s = "%s"' % (field[1:],
@@ -392,7 +392,7 @@ class BIBTEX(CatalogPlugin):
outfile.write('%%%Calibre catalog\n%%%{0} entries in catalog\n\n'.format(nb_entries))
outfile.write('@preamble{"This catalog of %d entries was generated by calibre on %s"}\n\n'
% (nb_entries, strftime("%A, %d. %B %Y %H:%M")))
% (nb_entries, date.strftime("%A, %d. %B %Y %H:%M")))
for entry in data:
outfile.write(create_bibtex_entry(entry, fields, bib_entry, template_citation,