mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Use dictionary literals
This commit is contained in:
@@ -536,19 +536,20 @@ class EpubBuilder(StandaloneHTMLBuilder):
|
||||
else:
|
||||
time_tuple = time.gmtime()
|
||||
|
||||
metadata: dict[str, Any] = {}
|
||||
metadata['title'] = html.escape(self.config.epub_title)
|
||||
metadata['author'] = html.escape(self.config.epub_author)
|
||||
metadata['uid'] = html.escape(self.config.epub_uid)
|
||||
metadata['lang'] = html.escape(self.config.epub_language)
|
||||
metadata['publisher'] = html.escape(self.config.epub_publisher)
|
||||
metadata['copyright'] = html.escape(self.config.epub_copyright)
|
||||
metadata['scheme'] = html.escape(self.config.epub_scheme)
|
||||
metadata['id'] = html.escape(self.config.epub_identifier)
|
||||
metadata['date'] = html.escape(time.strftime('%Y-%m-%d', time_tuple))
|
||||
metadata['manifest_items'] = []
|
||||
metadata['spines'] = []
|
||||
metadata['guides'] = []
|
||||
metadata: dict[str, Any] = {
|
||||
'title': html.escape(self.config.epub_title),
|
||||
'author': html.escape(self.config.epub_author),
|
||||
'uid': html.escape(self.config.epub_uid),
|
||||
'lang': html.escape(self.config.epub_language),
|
||||
'publisher': html.escape(self.config.epub_publisher),
|
||||
'copyright': html.escape(self.config.epub_copyright),
|
||||
'scheme': html.escape(self.config.epub_scheme),
|
||||
'id': html.escape(self.config.epub_identifier),
|
||||
'date': html.escape(time.strftime('%Y-%m-%d', time_tuple)),
|
||||
'manifest_items': [],
|
||||
'spines': [],
|
||||
'guides': [],
|
||||
}
|
||||
return metadata
|
||||
|
||||
def build_content(self) -> None:
|
||||
@@ -752,11 +753,12 @@ class EpubBuilder(StandaloneHTMLBuilder):
|
||||
"""Create a dictionary with all metadata for the toc.ncx file
|
||||
properly escaped.
|
||||
"""
|
||||
metadata: dict[str, Any] = {}
|
||||
metadata['uid'] = self.config.epub_uid
|
||||
metadata['title'] = html.escape(self.config.epub_title)
|
||||
metadata['level'] = level
|
||||
metadata['navpoints'] = navpoints
|
||||
metadata: dict[str, Any] = {
|
||||
'uid': self.config.epub_uid,
|
||||
'title': html.escape(self.config.epub_title),
|
||||
'level': level,
|
||||
'navpoints': navpoints,
|
||||
}
|
||||
return metadata
|
||||
|
||||
def build_toc(self) -> None:
|
||||
|
||||
@@ -583,9 +583,10 @@ def eval_config_file(
|
||||
"""Evaluate a config file."""
|
||||
filename = Path(filename)
|
||||
|
||||
namespace: dict[str, Any] = {}
|
||||
namespace['__file__'] = str(filename)
|
||||
namespace['tags'] = tags
|
||||
namespace: dict[str, Any] = {
|
||||
'__file__': str(filename),
|
||||
'tags': tags,
|
||||
}
|
||||
|
||||
with chdir(filename.parent):
|
||||
# during executing config file, current dir is changed to ``confdir``.
|
||||
|
||||
Reference in New Issue
Block a user