pydocmaker.backend.ex_tex ========================= .. py:module:: pydocmaker.backend.ex_tex Attributes ---------- .. autoapisummary:: pydocmaker.backend.ex_tex.latex pydocmaker.backend.ex_tex.md pydocmaker.backend.ex_tex.latex_mdx pydocmaker.backend.ex_tex.color_map pydocmaker.backend.ex_tex.__default_template Classes ------- .. autoapisummary:: pydocmaker.backend.ex_tex.bcolors pydocmaker.backend.ex_tex.LatexElementFormatter Functions --------- .. autoapisummary:: pydocmaker.backend.ex_tex.escape pydocmaker.backend.ex_tex.auto_escape_latex pydocmaker.backend.ex_tex.convert pydocmaker.backend.ex_tex.make_pdf pydocmaker.backend.ex_tex.make_pdf_zip pydocmaker.backend.ex_tex._find_all_indices pydocmaker.backend.ex_tex._get_substrings pydocmaker.backend.ex_tex._handle_bcolors pydocmaker.backend.ex_tex.replace_bcolors pydocmaker.backend.ex_tex.mapc pydocmaker.backend.ex_tex.map_colornames pydocmaker.backend.ex_tex.handle_color Module Contents --------------- .. py:data:: latex :value: None .. py:data:: md .. py:data:: latex_mdx .. py:data:: color_map .. py:data:: __default_template :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ \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} """ .. raw:: html
.. py:function:: escape(s) .. py:function:: auto_escape_latex(params) .. py:function:: convert(doc: List[dict], with_attachments=True, files_to_upload=None, template=None, do_escape_template_params=False, template_params=None) .. py:function:: 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. :param doc: A list of dictionaries containing the data for the document. :type doc: List[dict] :param files_to_upload: A list of files to be uploaded with the document. :type files_to_upload: optional :param template_header: A string containing the LaTeX code for the document header. If not provided, a default header will be used. :type template_header: str, optional :param template_footer: A string containing the LaTeX code for the document footer. If not provided, a default footer will be used. :type template_footer: str, optional :param docname: The name of the document. :type docname: str, optional :param \*\*kwargs: Additional keyword arguments to be passed to the PDF maker. :returns: A bytes object containing the PDF data. :rtype: bytes .. py:function:: 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. :param doc: A list of dictionaries containing the data to be converted into a PDF. :type doc: List[dict] :param files_to_upload: A dictionary of files to be uploaded. Defaults to None. :type files_to_upload: dict, optional :param template_header: The header template for the LaTeX document. Defaults to a default header. :type template_header: str, optional :param template_footer: The footer template for the LaTeX document. Defaults to a default footer. :type template_footer: str, optional :param docname: The name of the document. Defaults to None. :type docname: str, optional :param \*\*kwargs: Additional keyword arguments to be passed to the PDF maker. :returns: A zip file containing the generated PDF and any attachments. :rtype: bytes .. py:class:: bcolors(*args, **kwds) Bases: :py:obj:`enum.Enum` Create a collection of name/value pairs. Example enumeration: >>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3 Access them by: - attribute access: >>> Color.RED - value lookup: >>> Color(1) - name lookup: >>> Color['RED'] Enumerations can be iterated over, and know how many members they have: >>> len(Color) 3 >>> list(Color) [, , ] Methods can be added to enumerations, and members can have their own attributes -- see the documentation for details. .. py:attribute:: HEADER :value: '\x1b[95m' .. py:attribute:: OKBLUE :value: '\x1b[94m' .. py:attribute:: OKCYAN :value: '\x1b[96m' .. py:attribute:: OKGREEN :value: '\x1b[92m' .. py:attribute:: WARNING :value: '\x1b[93m' .. py:attribute:: FAIL :value: '\x1b[91m' .. py:attribute:: ENDC :value: '\x1b[0m' .. py:attribute:: BOLD :value: '\x1b[1m' .. py:attribute:: UNDERLINE :value: '\x1b[4m' .. py:function:: _find_all_indices(s, c) .. py:function:: _get_substrings(s) .. py:function:: _handle_bcolors(txt, color) .. py:function:: replace_bcolors(s) .. py:function:: mapc(c) .. py:function:: map_colornames(txt, c) .. py:function:: handle_color(func) .. py:class:: LatexElementFormatter(make_blue=False) Bases: :py:obj:`pydocmaker.backend.baseformatter.BaseFormatter` Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: attachments .. py:attribute:: make_blue :value: False .. py:method:: handle_error(err, el) .. py:method:: digest_markdown(children='', **kwargs) -> str .. py:method:: digest_image(children='', width=None, caption='', imageblob='', **kwargs) -> str .. py:method:: digest_verbatim(children='', **kwargs) -> str .. py:method:: digest_text(children: str, **kwargs) .. py:method:: digest_latex(children: str, **kwargs) .. py:method:: digest_line(children: str, **kwargs) .. py:method:: digest_table(children=None, **kwargs) -> str