class Writer(html4css1.Writer): supported = ('html', 'xhtml', 'xhtml1', 'html4strict', 'xhtml1strict', 'html4css2', 'xhtml1css2') """Formats this writer supports.""" default_stylesheets = ['html4css1.css', 'html4css2.css'] default_stylesheet_path = ','.join( [os.path.join(os.path.dirname(__file__), stylesheet) for stylesheet in default_stylesheets]) config_section = 'html4strict writer' config_section_dependencies = ('writers', 'html4css1 writer') settings_spec = frontend.filter_settings_spec( html4css1.Writer.settings_spec, 'field_name_limit', 'option_limit', stylesheet_path = ( 'Specify comma separated list of stylesheet paths. ' 'With --link-stylesheet, ' 'the path is rewritten relative to the output HTML file. ' 'Default: "%s"' % default_stylesheet_path, ['--stylesheet-path'], {'metavar': '<file>', 'overrides': 'stylesheet', 'default': default_stylesheet_path}), math_output = ('Math output format, one of "MathML", "HTML", ' '"MathJax" or "LaTeX". Default: "MathML"', ['--math-output'], {'default': 'MathML'})) def __init__(self): writers.Writer.__init__(self) self.translator_class = HTMLTranslator
class Writer(latex2e.Writer): """A writer for Unicode-based LaTeX variants (XeTeX, LuaTeX)""" supported = ('xetex','xelatex','luatex') """Formats this writer supports.""" default_template = 'xelatex.tex' default_preamble = '\n'.join([ r'% Linux Libertine (free, wide coverage, not only for Linux)', r'\setmainfont{Linux Libertine O}', r'\setsansfont{Linux Biolinum O}', r'\setmonofont[HyphenChar=None,Scale=MatchLowercase]{DejaVu Sans Mono}', ]) config_section = 'xetex writer' config_section_dependencies = ('writers', 'latex2e writer') settings_spec = frontend.filter_settings_spec( latex2e.Writer.settings_spec, 'font_encoding', template=('Template file. Default: "%s".' % default_template, ['--template'], {'default': default_template, 'metavar': '<file>'}), latex_preamble=('Customization by LaTeX code in the preamble. ' 'Default: select PDF standard fonts (Times, Helvetica, Courier).', ['--latex-preamble'], {'default': default_preamble}), ) def __init__(self): latex2e.Writer.__init__(self) self.settings_defaults.update({'fontencoding': ''}) # use default (EU1 or EU2) self.translator_class = XeLaTeXTranslator
class Writer(html_base.Writer): supported = ('html', 'html4', 'html4strict', 'html4css2', 'xhtml', 'xhtml1', 'xhtml1strict', 'xhtml11') """Formats this writer supports.""" default_stylesheets = ['html-base.css', 'xhtml11.css'] default_stylesheet_dirs = [ '.', os.path.abspath(os.path.dirname(__file__)), os.path.abspath( os.path.join(os.path.dirname(os.path.dirname(__file__)), 'html_base')) ] config_section = 'xhtml11 writer' config_section_dependencies = ('writers', 'html writer') settings_spec = frontend.filter_settings_spec( html_base.Writer.settings_spec, stylesheet_path=( 'Comma separated list of stylesheet paths. ' 'Relative paths are expanded if a matching file is found in ' 'the --stylesheet-dirs. With --link-stylesheet, ' 'the path is rewritten relative to the output HTML file. ' 'Default: "%s"' % ','.join(default_stylesheets), ['--stylesheet-path'], { 'metavar': '<file[,file,...]>', 'overrides': 'stylesheet', 'validator': frontend.validate_comma_separated_list, 'default': default_stylesheets }), stylesheet_dirs=( 'Comma-separated list of directories where stylesheets are found. ' 'Used by --stylesheet-path when expanding relative path arguments. ' 'Default: "%s"' % default_stylesheet_dirs, ['--stylesheet-dirs'], { 'metavar': '<dir[,dir,...]>', 'validator': frontend.validate_comma_separated_list, 'default': default_stylesheet_dirs }), math_output=('Math output format, one of "MathML", "HTML", ' '"MathJax" or "LaTeX". Default: "MathML"', ['--math-output'], { 'default': 'MathML' }), xml_declaration=('Prepend an XML declaration. ' 'Default: True', ['--xml-declaration'], { 'default': True, 'action': 'store_true', 'validator': frontend.validate_boolean })) def __init__(self): writers.Writer.__init__(self) self.translator_class = HTMLTranslator
class Writer(latex2e.Writer): """A writer for Unicode-aware LaTeX variants (XeTeX, LuaTeX)""" supported = ("lxtex", "xetex", "xelatex", "luatex", "lualatex") """Formats this writer supports.""" default_template = "xelatex.tex" default_preamble = "\n".join([ r"% Linux Libertine (free, wide coverage, not only for Linux)", r"\setmainfont{Linux Libertine O}", r"\setsansfont{Linux Biolinum O}", r"\setmonofont[HyphenChar=None,Scale=MatchLowercase]{DejaVu Sans Mono}", ]) config_section = "xetex writer" config_section_dependencies = ( "writers", "latex writers", "latex2e writer", ) # TODO: remove dependency on `latex2e writer`. settings_spec = frontend.filter_settings_spec( latex2e.Writer.settings_spec, "font_encoding", template=( 'Template file. Default: "%s".' % default_template, ["--template"], { "default": default_template, "metavar": "<file>" }, ), latex_preamble=( "Customization by LaTeX code in the preamble. " 'Default: select "Linux Libertine" fonts.', ["--latex-preamble"], { "default": default_preamble }, ), ) def __init__(self): latex2e.Writer.__init__(self) self.settings_defaults.update({"fontencoding": ""}) # use default (EU1 or EU2) self.translator_class = XeLaTeXTranslator
class Writer(writers._html_base.Writer): supported = ('html', 'html5', 'xhtml') """Formats this writer supports.""" default_stylesheets = ['minimal.css', 'plain.css'] default_stylesheet_dirs = ['.', os.path.abspath(os.path.dirname(__file__))] default_template = os.path.join( os.path.dirname(os.path.abspath(__file__)), 'template.txt') settings_spec = frontend.filter_settings_spec( writers._html_base.Writer.settings_spec, # update specs with changed defaults or help string template = ('Template file. (UTF-8 encoded, default: "%s")' % default_template, ['--template'], {'default': default_template, 'metavar': '<file>'}), stylesheet_path = ('Comma separated list of stylesheet paths. ' 'Relative paths are expanded if a matching file is found in ' 'the --stylesheet-dirs. With --link-stylesheet, ' 'the path is rewritten relative to the output HTML file. ' '(default: "%s")' % ','.join(default_stylesheets), ['--stylesheet-path'], {'metavar': '<file[,file,...]>', 'overrides': 'stylesheet', 'validator': frontend.validate_comma_separated_list, 'default': default_stylesheets}), stylesheet_dirs = ('Comma-separated list of directories where stylesheets are found. ' 'Used by --stylesheet-path when expanding relative path arguments. ' '(default: "%s")' % ','.join(default_stylesheet_dirs), ['--stylesheet-dirs'], {'metavar': '<dir[,dir,...]>', 'validator': frontend.validate_comma_separated_list, 'default': default_stylesheet_dirs}), initial_header_level = ('Specify the initial header level. Does not affect document ' 'title & subtitle (see --no-doc-title). (default: 2 for "<h2>")', ['--initial-header-level'], {'choices': '1 2 3 4 5 6'.split(), 'default': '2', 'metavar': '<level>'}), no_xml_declaration = ('Omit the XML declaration.', ['--no-xml-declaration'], {'dest': 'xml_declaration', 'action': 'store_false'}), ) settings_spec = settings_spec + ( 'HTML5 Writer Options', '', (('Obsoleted by "--image-loading".', ['--embed-images'], {'action': 'store_true', 'validator': frontend.validate_boolean}), ('Obsoleted by "--image-loading".', ['--link-images'], {'dest': 'embed_images', 'action': 'store_false'}), ('Suggest at which point images should be loaded: ' '"embed", "link" (default), or "lazy".', ['--image-loading'], {'choices': ('embed', 'link', 'lazy'), # 'default': 'link' # default set in _html_base.py }), ('Append a self-link to section headings.', ['--section-self-link'], {'default': 0, 'action': 'store_true'}), ('Do not append a self-link to section headings. (default)', ['--no-section-self-link'], {'dest': 'section_self_link', 'action': 'store_false'}), )) config_section = 'html5 writer' def __init__(self): self.parts = {} self.translator_class = HTMLTranslator
class Writer(writers._html_base.Writer): supported = ('html', 'html4', 'html4css1', 'xhtml', 'xhtml10') """Formats this writer supports.""" default_stylesheets = ['html4css1.css'] default_stylesheet_dirs = [ '.', os.path.abspath(os.path.dirname(__file__)), os.path.abspath( os.path.join(os.path.dirname(os.path.dirname(__file__)), 'html5_polyglot')) # for math.css ] default_template = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'template.txt') settings_spec = frontend.filter_settings_spec( writers._html_base.Writer.settings_spec, # update specs with changed defaults or help string template=('Template file. (UTF-8 encoded, default: "%s")' % default_template, ['--template'], { 'default': default_template, 'metavar': '<file>' }), stylesheet_path=( 'Comma separated list of stylesheet paths. ' 'Relative paths are expanded if a matching file is found in ' 'the --stylesheet-dirs. With --link-stylesheet, ' 'the path is rewritten relative to the output HTML file. ' '(default: "%s")' % ','.join(default_stylesheets), ['--stylesheet-path'], { 'metavar': '<file[,file,...]>', 'overrides': 'stylesheet', 'validator': frontend.validate_comma_separated_list, 'default': default_stylesheets }), stylesheet_dirs=( 'Comma-separated list of directories where stylesheets are found. ' 'Used by --stylesheet-path when expanding relative path arguments. ' '(default: "%s")' % ','.join(default_stylesheet_dirs), ['--stylesheet-dirs'], { 'metavar': '<dir[,dir,...]>', 'validator': frontend.validate_comma_separated_list, 'default': default_stylesheet_dirs }), initial_header_level=( 'Specify the initial header level. Does not affect document ' 'title & subtitle (see --no-doc-title). (default: 1 for "<h1>")', ['--initial-header-level'], { 'choices': '1 2 3 4 5 6'.split(), 'default': '1', 'metavar': '<level>' }), xml_declaration=('Prepend an XML declaration (default). ', ['--xml-declaration'], { 'default': True, 'action': 'store_true', 'validator': frontend.validate_boolean }), ) settings_spec = settings_spec + ('HTML4 Writer Options', '', ( ('Specify the maximum width (in characters) for one-column field ' 'names. Longer field names will span an entire row of the table ' 'used to render the field list. Default is 14 characters. ' 'Use 0 for "no limit".', ['--field-name-limit'], { 'default': 14, 'metavar': '<level>', 'validator': frontend.validate_nonnegative_int }), ('Specify the maximum width (in characters) for options in option ' 'lists. Longer options will span an entire row of the table used ' 'to render the option list. Default is 14 characters. ' 'Use 0 for "no limit".', ['--option-limit'], { 'default': 14, 'metavar': '<level>', 'validator': frontend.validate_nonnegative_int }), )) config_section = 'html4css1 writer' config_section_dependencies = ('writers', 'html writers') def __init__(self): self.parts = {} self.translator_class = HTMLTranslator