mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
refactor: latex BuiltInTheme
Replace properties by attributes to allow to modify them at later step.
This commit is contained in:
parent
58d1218cdc
commit
3fba1d57ec
@ -35,32 +35,24 @@ class BuiltInTheme(Theme):
|
|||||||
"""A built-in LaTeX theme."""
|
"""A built-in LaTeX theme."""
|
||||||
|
|
||||||
def __init__(self, name: str, config: Config) -> None:
|
def __init__(self, name: str, config: Config) -> None:
|
||||||
# Note: Don't call supermethod here.
|
super().__init__(name)
|
||||||
self.name = name
|
|
||||||
self.latex_docclass = config.latex_docclass # type: Dict[str, str]
|
|
||||||
|
|
||||||
@property
|
if name == 'howto':
|
||||||
def docclass(self) -> str: # type: ignore
|
self.docclass = config.latex_docclass.get('howto', 'article')
|
||||||
if self.name == 'howto':
|
|
||||||
return self.latex_docclass.get('howto', 'article')
|
|
||||||
else:
|
else:
|
||||||
return self.latex_docclass.get('manual', 'report')
|
self.docclass = config.latex_docclass.get('manual', 'report')
|
||||||
|
|
||||||
@property
|
if name in ('manual', 'howto'):
|
||||||
def wrapperclass(self) -> str: # type: ignore
|
self.wrapperclass = 'sphinx' + name
|
||||||
if self.name in ('manual', 'howto'):
|
|
||||||
return 'sphinx' + self.name
|
|
||||||
else:
|
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
|
# we assume LaTeX class provides \chapter command except in case
|
||||||
# of non-Japanese 'howto' case
|
# of non-Japanese 'howto' case
|
||||||
if self.name == 'howto' and not self.docclass.startswith('j'):
|
if name == 'howto' and not self.docclass.startswith('j'):
|
||||||
return 'section'
|
self.toplevel_sectioning = 'section'
|
||||||
else:
|
else:
|
||||||
return 'chapter'
|
self.toplevel_sectioning = 'chapter'
|
||||||
|
|
||||||
|
|
||||||
class UserTheme(Theme):
|
class UserTheme(Theme):
|
||||||
|
Loading…
Reference in New Issue
Block a user