1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-20 13:11:27 +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
+3 -3
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,
@@ -1,7 +1,7 @@
import datetime, os, time
from collections import namedtuple
from ebook_converter import strftime
from ebook_converter.utils import date
from ebook_converter.customize import CatalogPlugin
from ebook_converter.customize.conversion import OptionRecommendation, DummyReporter
from ebook_converter.library import current_library_name
@@ -254,8 +254,8 @@ class EPUB_MOBI(CatalogPlugin):
opts.fmt = self.fmt = path_to_output.rpartition('.')[2]
# Add local options
opts.creator = '%s, %s %s, %s' % (strftime('%A'), strftime('%B'), strftime('%d').lstrip('0'), strftime('%Y'))
opts.creator_sort_as = '%s %s' % ('calibre', strftime('%Y-%m-%d'))
opts.creator = '%s, %s %s, %s' % (date.strftime('%A'), date.strftime('%B'), date.strftime('%d').lstrip('0'), date.strftime('%Y'))
opts.creator_sort_as = '%s %s' % ('calibre', date.strftime('%Y-%m-%d'))
opts.connected_kindle = False
# Finalize output_profile