summaryrefslogtreecommitdiff
path: root/sphinx/builders
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-03-31 21:49:59 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-04-12 15:28:15 +0900
commit3fba1d57ec09a402fde249c19f1cd031144726cc (patch)
tree425fdb895916bf658c8df9b4cabe8373409b9555 /sphinx/builders
parent58d1218cdcd0cd748635c436892b00c993907889 (diff)
downloadsphinx-git-3fba1d57ec09a402fde249c19f1cd031144726cc.tar.gz
refactor: latex BuiltInTheme
Replace properties by attributes to allow to modify them at later step.
Diffstat (limited to 'sphinx/builders')
-rw-r--r--sphinx/builders/latex/theming.py28
1 files changed, 10 insertions, 18 deletions
diff --git a/sphinx/builders/latex/theming.py b/sphinx/builders/latex/theming.py
index d638639aa..4d5742ef6 100644
--- a/sphinx/builders/latex/theming.py
+++ b/sphinx/builders/latex/theming.py
@@ -35,32 +35,24 @@ class BuiltInTheme(Theme):
"""A built-in LaTeX theme."""
def __init__(self, name: str, config: Config) -> None:
- # Note: Don't call supermethod here.
- self.name = name
- self.latex_docclass = config.latex_docclass # type: Dict[str, str]
+ super().__init__(name)
- @property
- def docclass(self) -> str: # type: ignore
- if self.name == 'howto':
- return self.latex_docclass.get('howto', 'article')
+ if name == 'howto':
+ self.docclass = config.latex_docclass.get('howto', 'article')
else:
- return self.latex_docclass.get('manual', 'report')
+ self.docclass = config.latex_docclass.get('manual', 'report')
- @property
- def wrapperclass(self) -> str: # type: ignore
- if self.name in ('manual', 'howto'):
- return 'sphinx' + self.name
+ if name in ('manual', 'howto'):
+ self.wrapperclass = 'sphinx' + name
else:
- return self.name
+ self.wrapperclass = name
- @property
- def toplevel_sectioning(self) -> str: # type: ignore
# we assume LaTeX class provides \chapter command except in case
# of non-Japanese 'howto' case
- if self.name == 'howto' and not self.docclass.startswith('j'):
- return 'section'
+ if name == 'howto' and not self.docclass.startswith('j'):
+ self.toplevel_sectioning = 'section'
else:
- return 'chapter'
+ self.toplevel_sectioning = 'chapter'
class UserTheme(Theme):