module helpgen.post_process
¶
Short summary¶
module pyquickhelper.helpgen.post_process
Contains the main function to generate the documentation
for a module designed the same way as this one, generate_help_sphinx()
.
Functions¶
function |
truncated documentation |
---|---|
Makes some replacements in a notebook. |
|
Processes a HTML file generated from the conversion of a notebook. |
|
Postprocesses the latex file produced by sphinx. |
|
Postprocesses the latex file produced by sphinx. |
|
Modifies a python file after its generation by sphinx. |
|
Postprocesses the python file produced by sphinx. |
|
Processes a rst file generated from the conversion of a notebook. |
|
Processes a HTML file generated from the conversion of a notebook. |
|
Removes ASCII characters in [0..31]. |
|
A notebook can contain a link |
Documentation¶
Contains the main function to generate the documentation
for a module designed the same way as this one, generate_help_sphinx
.
- pyquickhelper.helpgen.post_process._notebook_replacements(nbtext, notebook_replacements, fLOG=None)[source]¶
Makes some replacements in a notebook.
- Parameters:
nbtext – text to process
notebook_replacements – dictionary of replacements
fLOG – logging function
- Returns:
text
- pyquickhelper.helpgen.post_process.post_process_html_output(file, pdf, python, slides, exc=True, nblinks=None, fLOG=None, notebook_replacements=None)[source]¶
Processes a HTML file generated from the conversion of a notebook.
- Parameters:
file – filename
pdf – if True, add a link to the PDF, assuming it will exists at the same location
python – if True, add a link to the Python conversion
slides – if True, add a link to the slides conversion
exc – raises an exception (True) or a warning (False)
nblinks – dictionary
{ref: url}
notebook_replacements – string replacement in notebooks
fLOG – logging function
- pyquickhelper.helpgen.post_process.post_process_latex(st, doall, info=None, latex_book=False, exc=True, custom_latex_processing=None, nblinks=None, file=None, remove_unicode=False, fLOG=None, notebook_replacements=None)[source]¶
Modifies a latex file after its generation by sphinx.
- Parameters:
st – string
doall – do all transformations
info – for more understandable error messages
latex_book – customized for a book
exc – raises an exception or a warning
custom_latex_processing – function which takes and returns a string, final post processing
nblinks – dictionary
{ref: url}
file – only used when an exception is raised
remove_unicode – remove unicode character (fails when converting into PDF)
notebook_replacements – string replacement in notebooks
fLOG – logging function
- Returns:
string
SVG included in a notebook (or in RST file) usually do not word. Inkscape should be used to convert them into Latex. The function is less strict on the checking of $. The function replaces
\mathbb{1}
by\mathbf{1\!\!1}
.Why a ¿ is showing the final PDF?
Unicode, chinese characters are an issue because the latex compiler prompts on those if the necessary packages are not installed. pdflatex does not accepts inline chinese characters, xetex should be used instead: see How to input Traditional Chinese in pdfLaTeX. Until this is being implemented, the unicode will unfortunately be removed in this function.
- pyquickhelper.helpgen.post_process.post_process_latex_output(root, doall, latex_book=False, exc=True, custom_latex_processing=None, nblinks=None, remove_unicode=True, fLOG=None, notebook_replacements=None)[source]¶
Postprocesses the latex file produced by sphinx.
- Parameters:
root – root path or latex file to process
doall – do all transformations
latex_book – customized for a book
exc – raises an exception or a warning
custom_latex_processing – function which does some post processing of the full latex file
nblinks – dictionary
{ ref : url }
where to look for referencesremove_unicode – remove unicode characters (fails with latex)
notebook_replacements – string replacement in notebooks
fLOG – logging function
- pyquickhelper.helpgen.post_process.post_process_latex_output_any(file, custom_latex_processing, nblinks=None, remove_unicode=False, fLOG=None, notebook_replacements=None)[source]¶
Postprocesses the latex file produced by sphinx.
- Parameters:
file – latex filename
custom_latex_processing – function which does some post processing of the full latex file
nblinks – dictionary
{url: link}
remove_unicode – remove unicode characters
notebook_replacements – string replacement in notebooks
fLOG – logging function
- pyquickhelper.helpgen.post_process.post_process_python(st, doall, info=None, nblinks=None, file=None, fLOG=None, notebook_replacements=None)[source]¶
Modifies a python file after its generation by sphinx.
- Parameters:
st – string
doall – do all transformations
info – for more understandable error messages
nblinks – dictionary
{ref: url}
file – used only when an exception is raised
fLOG – logging function
notebook_replacements – string replacement in notebooks
- Returns:
string
- pyquickhelper.helpgen.post_process.post_process_python_output(root, doall, exc=True, nblinks=None, fLOG=None, notebook_replacements=None)[source]¶
Postprocesses the python file produced by sphinx.
- Parameters:
root – root path or python file to process
doall – unused
exc – raise an exception if needed
nblinks – dictionary
{ref: url}
notebook_replacements – string replacement in notebooks
fLOG – logging function
- pyquickhelper.helpgen.post_process.post_process_rst_output(file, html, pdf, python, slides, is_notebook=False, exc=True, github=False, notebook=None, nblinks=None, fLOG=None, notebook_replacements=None)[source]¶
Processes a rst file generated from the conversion of a notebook.
- Parameters:
file – filename
pdf – if True, add a link to the pdf, assuming it will exists at the same location
html – if True, add a link to the html conversion
python – if True, add a link to the Python conversion
slides – if True, add a link to the slides conversion
is_notebook – does something more if the file is a notebook
exc – raises an exception (True) or a warning (False)
github – add a link to the notebook on github
notebook – location of the notebook, file might be a copy
nblinks – links added to a notebook, dictionary
{ref: url}
notebook_replacements – string replacement in notebooks
fLOG – logging function
The function adds the following replacement
st = st.replace("\\mathbb{1}", "\\mathbf{1\\!\\!1}")
. and checks that audio is only included in HTML.
- pyquickhelper.helpgen.post_process.post_process_slides_output(file, pdf, python, slides, exc=True, nblinks=None, fLOG=None, notebook_replacements=None)[source]¶
Processes a HTML file generated from the conversion of a notebook.
- Parameters:
file – filename
pdf – if True, add a link to the PDF, assuming it will exists at the same location
python – if True, add a link to the Python conversion
slides – if True, add a link to the slides conversion
exc – raises an exception (True) or a warning (False)
nblinks – dictionary
{ref: url}
notebook_replacements – string replacement in notebooks
fLOG – logging function
- pyquickhelper.helpgen.post_process.remove_character_under32(s)[source]¶
Removes ASCII characters in [0..31].
- Parameters:
s – string to process
- Returns:
filtered string
- pyquickhelper.helpgen.post_process.update_notebook_link(text, format, nblinks, fLOG)[source]¶
A notebook can contain a link
[anchor](find://...)
and it will be converted into::ref:...
in rst format.- Parameters:
text – text to look into
format – format
nblinks – list of mappings (reference: url)
fLOG – logging function
- Returns:
modified text