module sphinxext.sphinx_latex_builder

Inheritance diagram of pyquickhelper.sphinxext.sphinx_latex_builder

Short summary

module pyquickhelper.sphinxext.sphinx_latex_builder

Overwrites latex writer as Sphinx’s version is bugged in version 1.8.0.

source on GitHub

Classes

class

truncated documentation

CustomizedSphinxFileOutput

Customized FileOutput class for Sphinx.

DummySphinxTheme

Dummy theme for sphinx.

EnhancedLaTeXBuilder

Overwrites LaTeXBuilder.

EnhancedLaTeXTranslator

Overwrites LaTeXTranslator and modifies …

EnhancedLaTeXWriter

Overwrites LatexWriter.

Functions

function

truncated documentation

setup

Initializes builder EnhancedLaTeXBuilder.

Properties

property

truncated documentation

table

Get current table.

Methods

method

truncated documentation

__init__

__init__

__init__

Constructor, add a logger.

__init__

__init__

_get_filename

add_text

depart_imgsgnode

depart_inheritance_diagram

depart_only

eval_expr

finish

get_outfilename

Overwrites get_target_uri to control file names.

latex_image_length

render

translate

unknown_visit

visit_document

visit_enumerated_list

visit_imgsgnode

visit_inheritance_diagram

visit_only

write

write

Documentation

Overwrites latex writer as Sphinx’s version is bugged in version 1.8.0.

source on GitHub

class pyquickhelper.sphinxext.sphinx_latex_builder.CustomizedSphinxFileOutput(**kwargs)[source]

Bases: SphinxFileOutput

Customized FileOutput class for Sphinx.

source on GitHub

Parameters:
  • destination: either a file-like object (which is written directly) or None (which implies sys.stdout if no destination_path given).

  • destination_path: a path to a file, which is opened and then written.

  • encoding: the text encoding of the output file.

  • error_handler: the encoding error handler to use.

  • autoclose: close automatically after write (except when sys.stdout or sys.stderr is the destination).

  • handle_io_errors: ignored, deprecated, will be removed.

  • mode: how the file is to be opened (see standard function open). The default is ‘w’, providing universal newline support for text files.

__init__(**kwargs)[source]
Parameters:
  • destination: either a file-like object (which is written directly) or None (which implies sys.stdout if no destination_path given).

  • destination_path: a path to a file, which is opened and then written.

  • encoding: the text encoding of the output file.

  • error_handler: the encoding error handler to use.

  • autoclose: close automatically after write (except when sys.stdout or sys.stderr is the destination).

  • handle_io_errors: ignored, deprecated, will be removed.

  • mode: how the file is to be opened (see standard function open). The default is ‘w’, providing universal newline support for text files.

write(data)[source]

Write data to a single file, also return it.

data can be a str or bytes instance. If writing bytes fails, an attempt is made to write to the low-level interface self.destination.buffer.

If data is a str instance and self.encoding and self.destination.encoding are set to different values, data is encoded to a bytes instance using self.encoding.

Provisional: future versions may raise an error if self.encoding and self.destination.encoding are set to different values.

class pyquickhelper.sphinxext.sphinx_latex_builder.DummySphinxTheme[source]

Bases: object

Dummy theme for sphinx.

source on GitHub

__init__()[source]
class pyquickhelper.sphinxext.sphinx_latex_builder.EnhancedLaTeXBuilder(*args, **kwargs)[source]

Bases: LaTeXBuilder

Overwrites LaTeXBuilder.

source on GitHub

Constructor, add a logger.

source on GitHub

__init__(*args, **kwargs)[source]

Constructor, add a logger.

source on GitHub

_get_filename(targetname, encoding='utf-8', overwrite_if_changed=True)[source]
default_translator_class[source]

alias of EnhancedLaTeXTranslator

epilog = "The EnhancedTexinfo files are in %(outdir)s.\nRun 'make' in that directory to run these through makeinfo\n(use 'make info' here to do that automatically)."[source]

The message emitted upon successful build completion. This can be a printf-style template string with the following keys: outdir, project

finish()[source]

Finish the building process.

The default implementation does nothing.

format = 'latex'[source]

The builder’s output format, or ‘’ if no document output is produced.

get_outfilename(pagename)[source]

Overwrites get_target_uri to control file names.

source on GitHub

name = 'elatex'[source]

The builder’s name, for the -b command line option.

supported_image_types: list[str] = ['image/png', 'image/jpeg', 'image/gif'][source]

The list of MIME types of image formats supported by the builder. Image files are searched in the order in which they appear here.

class pyquickhelper.sphinxext.sphinx_latex_builder.EnhancedLaTeXTranslator(document, builder, theme=None)[source]

Bases: LaTeXTranslator

Overwrites LaTeXTranslator and modifies a few functions.

source on GitHub

__init__(document, builder, theme=None)[source]
unknown_visit(node)[source]

Called when entering unknown Node types.

Raise an exception unless overridden.

class pyquickhelper.sphinxext.sphinx_latex_builder.EnhancedLaTeXWriter(builder)[source]

Bases: LaTeXWriter

Overwrites LatexWriter.

source on GitHub

__init__(builder)[source]
translate()[source]

Do final translation of self.document into self.output. Called from write. Override in subclasses.

Usually done with a docutils.nodes.NodeVisitor subclass, in combination with a call to docutils.nodes.Node.walk() or docutils.nodes.Node.walkabout(). The NodeVisitor subclass must support all standard elements (listed in docutils.nodes.node_class_names) and possibly non-standard elements used by the current Reader as well.

translator_class[source]

alias of EnhancedLaTeXTranslator

pyquickhelper.sphinxext.sphinx_latex_builder.setup(app)[source]

Initializes builder EnhancedLaTeXBuilder.

source on GitHub