pydocmaker.backend.ex_tex
Attributes
Classes
Create a collection of name/value pairs. |
|
Helper class that provides a standard way to create an ABC using |
Functions
|
|
|
|
|
|
|
Generate a PDF document from a list of dictionaries. |
|
Generates a PDF zip file from a list of dictionaries. |
|
|
|
|
|
|
|
|
|
Module Contents
- pydocmaker.backend.ex_tex.latex = None
- pydocmaker.backend.ex_tex.md
- pydocmaker.backend.ex_tex.latex_mdx
- pydocmaker.backend.ex_tex.color_map
- pydocmaker.backend.ex_tex.__default_template = Multiline-String
Show Value
""" \documentclass[a4paper]{article} \usepackage{hyperref} \usepackage{graphicx} \usepackage[dvipsnames]{xcolor} \usepackage{listings} {% if title %}\title {{ title }}{% endif %} {% if author %}\author {{ author }}{% endif %} {% if date %}\date {{ date }}{% endif %} {% if applicables or references or acronyms %} \section*{References} {% endif %} {% if acronyms %} \subsection*{List of Acronyms} \begin{tabular}{l@{\hspace{3cm}}l} {% for key, value in acronyms.items() %} {{ key }} & {{ value }} \\ {% endfor %} \end{tabular} {% endif %} {% if applicables %} \subsection*{Applicable Documents} \begin{tabular}{l@{\hspace{1cm}}p{13cm}} {% for i, value in applicables.items() %} AD[{{ i }}] & {{ value }} \\ {% endfor %} \end{tabular} {% endif %} {% if references %} \subsection*{Reference Documents} \begin{tabular}{l@{\hspace{1cm}}p{13cm}} {% for i, value in references.items() %} RD[{{ i }}] & {{ value }} \\ {% endfor %} \end{tabular} {% endif %} \begin{document} {{ body }} \end{document} """
- pydocmaker.backend.ex_tex.escape(s)
- pydocmaker.backend.ex_tex.auto_escape_latex(params)
- pydocmaker.backend.ex_tex.convert(doc: List[dict], with_attachments=True, files_to_upload=None, template=None, do_escape_template_params=False, template_params=None)
- pydocmaker.backend.ex_tex.make_pdf(doc: List[dict], files_to_upload=None, template=None, template_params=True, do_escape_template_params=False, docname=None, **kwargs)
Generate a PDF document from a list of dictionaries.
- Parameters:
doc (List[dict]) – A list of dictionaries containing the data for the document.
files_to_upload (optional) – A list of files to be uploaded with the document.
template_header (str, optional) – A string containing the LaTeX code for the document header. If not provided, a default header will be used.
template_footer (str, optional) – A string containing the LaTeX code for the document footer. If not provided, a default footer will be used.
docname (str, optional) – The name of the document.
**kwargs – Additional keyword arguments to be passed to the PDF maker.
- Returns:
A bytes object containing the PDF data.
- Return type:
bytes
- pydocmaker.backend.ex_tex.make_pdf_zip(doc: List[dict], files_to_upload=None, template=None, template_params=True, do_escape_template_params=False, docname=None, **kwargs)
Generates a PDF zip file from a list of dictionaries.
- Parameters:
doc (List[dict]) – A list of dictionaries containing the data to be converted into a PDF.
files_to_upload (dict, optional) – A dictionary of files to be uploaded. Defaults to None.
template_header (str, optional) – The header template for the LaTeX document. Defaults to a default header.
template_footer (str, optional) – The footer template for the LaTeX document. Defaults to a default footer.
docname (str, optional) – The name of the document. Defaults to None.
**kwargs – Additional keyword arguments to be passed to the PDF maker.
- Returns:
A zip file containing the generated PDF and any attachments.
- Return type:
bytes
- class pydocmaker.backend.ex_tex.bcolors(*args, **kwds)
Bases:
enum.EnumCreate a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- HEADER = '\x1b[95m'
- OKBLUE = '\x1b[94m'
- OKCYAN = '\x1b[96m'
- OKGREEN = '\x1b[92m'
- WARNING = '\x1b[93m'
- FAIL = '\x1b[91m'
- ENDC = '\x1b[0m'
- BOLD = '\x1b[1m'
- UNDERLINE = '\x1b[4m'
- pydocmaker.backend.ex_tex._find_all_indices(s, c)
- pydocmaker.backend.ex_tex._get_substrings(s)
- pydocmaker.backend.ex_tex._handle_bcolors(txt, color)
- pydocmaker.backend.ex_tex.replace_bcolors(s)
- pydocmaker.backend.ex_tex.mapc(c)
- pydocmaker.backend.ex_tex.map_colornames(txt, c)
- pydocmaker.backend.ex_tex.handle_color(func)
- class pydocmaker.backend.ex_tex.LatexElementFormatter(make_blue=False)
Bases:
pydocmaker.backend.baseformatter.BaseFormatterHelper class that provides a standard way to create an ABC using inheritance.
- attachments
- make_blue = False
- handle_error(err, el)
- digest_markdown(children='', **kwargs) str
- digest_image(children='', width=None, caption='', imageblob='', **kwargs) str
- digest_verbatim(children='', **kwargs) str
- digest_text(children: str, **kwargs)
- digest_latex(children: str, **kwargs)
- digest_line(children: str, **kwargs)
- digest_table(children=None, **kwargs) str