class MinimalTemplate(DocumentTemplate): stylesheet = OverrideDefault('sphinx_base14') parts = OverrideDefault(['contents']) contents = ContentsPartTemplate() page = PageTemplate(page_size=Var('paper_size'), chapter_title_flowables=None, header_text=None, footer_text=None) contents_page = PageTemplate(base='page')
class Minimal(DocumentTemplate): variables = dict(paper_size='a5') stylesheet = OverrideDefault('sphinx_base14') parts = OverrideDefault(['contents']) contents = ContentsPartTemplate() page = PageTemplate(page_size=Var('paper_size'), chapter_title_flowables=None) contents_page = PageTemplate(base='page')
class MyDocumentTemplate(DocumentTemplate): class Configuration(TemplateConfiguration): a = Attribute(Bool, True, 'flag A') b = Attribute(Bool, True, 'flag B') c = Attribute(Bool, True, 'flag C') page_tmpl = PageTemplate(page_size=Var('paper_size'), column_spacing=1 * PT) parts = [ContentsPartTemplate('contents', Configuration.page_tmpl)]
class MyDocumentTemplate(DocumentTemplate): a = Attribute(Bool, True, 'flag A') b = Attribute(Bool, True, 'flag B') c = Attribute(Bool, True, 'flag C') parts = OverrideDefault(['contents']) contents = ContentsPartTemplate() contents_page = PageTemplate(page_size=Var('paper_size'), column_spacing=1 * PT)
class MyDocumentTemplate(DocumentTemplate): identifier = 'my_document_template' stylesheet = OverrideDefault(sphinx_article) parts = OverrideDefault(['title', 'front_matter', 'contents']) # default document part templates title = MyTitlePartTemplate() front_matter = FixedDocumentPartTemplate(page_number_format='continue') contents = ContentsPartTemplate(page_number_format='continue') # default page templates page = PageTemplate(page_size=Var('paper_size')) title_page = MyTitlePageTemplate(base='page', top_margin=8 * CM) front_matter_page = PageTemplate(base='page') contents_page = PageTemplate(base='page') TEMPLATE_IMAGE = Image(Path(__file__).parent / 'template.png')