Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More
lino.utils.restify¶
Just a copy & paste of the docutils.examples
module (as
instructed there).
restify()
is an alias for html_body()
.
latex_body()
deduced from html_body()
.
Functions
|
|
|
|
|
Given an input string, returns an HTML fragment as a string. |
|
Given an input string, returns a dictionary of HTML document parts. |
install some roles to emulate sphinx. |
|
|
|
|
|
|
Return the minimum indentation of any non-blank line in s |
|
(Didn't work when the reST text contained a root title). |
|
Renders the given reST string into a unicode HTML chunk without any surrounding tags like |
|
returns a dict containing the following keys: |
|
Renders the given reST string into ODT xml. |
Classes
|
Suppress surrounding DIV tag. |
|
- lino.utils.restify.min_indent(s)¶
Return the minimum indentation of any non-blank line in s
- lino.utils.restify.html_parts(input_string, source_path=None, destination_path=None, input_encoding='unicode', doctitle=1, initial_header_level=1)¶
Given an input string, returns a dictionary of HTML document parts.
Dictionary keys are the names of parts, and values are Unicode strings; encoding is up to the client.
Parameters:
input_string: A multi-line text string; required.
source_path: Path to the source file or object. Optional, but useful for diagnostic output (system messages).
destination_path: Path to the file or object which will receive the output; optional. Used for determining relative paths (stylesheets, source links, etc.).
input_encoding: The encoding of input_string. If it is an encoded 8-bit string, provide the correct encoding. If it is a Unicode string, use “unicode”, the default.
doctitle: Disable the promotion of a lone top-level section title to document title (and subsequent section title to document subtitle promotion); enabled by default.
initial_header_level: The initial level for header elements (e.g. 1 for “<h1>”).
- lino.utils.restify.html_body(input_string, source_path=None, destination_path=None, input_encoding='unicode', output_encoding='unicode', doctitle=1, initial_header_level=1)¶
Given an input string, returns an HTML fragment as a string.
The return value is the contents of the <body> element.
Parameters (see
html_parts()
for the remainder):output_encoding: The desired encoding of the output. If a Unicode string is desired, use the default value of “unicode” .
- class lino.utils.restify.HTMLTranslator(document)¶
Bases:
HTMLTranslator
Suppress surrounding DIV tag. Used by
restify()
.
- lino.utils.restify.install_sphinx_emu()¶
install some roles to emulate sphinx.
- lino.utils.restify.restify(input_string, source_path=None, destination_path=None, input_encoding='unicode', doctitle=1, initial_header_level=1)¶
Renders the given reST string into a unicode HTML chunk without any surrounding tags like
<HTML>
,<BODY>
, and especially<DIV class="document">
(this last one requires the aboveHTMLTranslator
subclass, thanks to Günter Milde’s hint and example code).
- lino.utils.restify.rst2odt(input_string, source_path=None, destination_path=None, input_encoding='unicode', doctitle=1, initial_header_level=1)¶
Renders the given reST string into ODT xml.
- lino.utils.restify.old_restify(s, **kw)¶
(Didn’t work when the reST text contained a root title). See 2011-05-25.
- lino.utils.restify.rst2latex(input_string, source_path=None, input_encoding='unicode', doctitle=1, initial_header_level=1)¶
returns a dict containing the following keys:
‘body’, ‘latex_preamble’, ‘head_prefix’, ‘requirements’, ‘encoding’, ‘abstract’, ‘title’, ‘fallbacks’, ‘stylesheet’, ‘version’, ‘body_pre_docinfo’, ‘dedication’, ‘subtitle’, ‘whole’, ‘docinfo’, ‘pdfsetup’