mirror of https://github.com/Nonannet/pyladoc.git
Compare commits
2 Commits
111a98b6db
...
ded3617fc6
Author | SHA1 | Date |
---|---|---|
|
ded3617fc6 | |
|
4efffdceca |
14
README.md
14
README.md
|
@ -2,7 +2,7 @@
|
|||
|
||||
## Description
|
||||
Pyladoc is a python package for programmatically generating HTML and
|
||||
PDF/LaTex output. This package targets specifically applications where reports
|
||||
PDF/LaTeX output. This package targets specifically applications where reports
|
||||
or results with Pandas-tables and Matplotlib-figures are generated programmatically
|
||||
to be displayed as website and as PDF document without any manual formatting
|
||||
steps.
|
||||
|
@ -11,31 +11,31 @@ This package focuses on the "Document in Code" approach for cases
|
|||
where a lot of calculations and data handling is done but not a lot of
|
||||
document text needs to be displayed.
|
||||
|
||||
As backend for PDF generation LaTex is used. There are excellent engines for
|
||||
As backend for PDF generation LaTeX is used. There are excellent engines for
|
||||
rendering HTML to PDF available, but even if there is no requirement for an
|
||||
accurate typesetting, placing programmatically content of variable
|
||||
composition and sizes on fixed size pages without manual intervention
|
||||
composition and element sizes on fixed size pages without manual intervention
|
||||
is a hard problem that LaTeX is very capable of.
|
||||
|
||||
## Example outputs
|
||||
The following documents are generated by [tests/test_rendering_example_doc.py](tests/test_rendering_example_doc.py):
|
||||
|
||||
- HTML: [test_html_render.html](https://html-preview.github.io/?url=https://github.com/Nonannet/pyladoc/blob/main/tests/out/test_html_render.html)
|
||||
- PDF: [test_latex_render.pdf](https://raw.githubusercontent.com/Nonannet/pyladoc/refs/heads/main/tests/out/test_latex_render.pdf)
|
||||
- PDF: [test_latex_render.pdf](https://raw.githubusercontent.com/Nonannet/pyladoc/refs/heads/main/tests/out/test_LaTeX_render.pdf)
|
||||
|
||||
### Sported primitives
|
||||
- Text (can be Markdown or HTML formatted)
|
||||
- Headings
|
||||
- Tables (Pandas, Markdown or HTML)
|
||||
- Matplotlib figures
|
||||
- LaTex equations
|
||||
- LaTeX equations
|
||||
- Named references for figures, tables and equation
|
||||
|
||||
### Key Features
|
||||
- HTML and PDF/LaTex rendering of the same document
|
||||
- HTML and PDF/LaTeX rendering of the same document
|
||||
- Single file output including figures
|
||||
- Figure and equation embedding in HTML by inline SVG, SVG in Base64 or PNG in Base64
|
||||
- Figure embedding in LaTex as PGF/TikZ
|
||||
- Figure embedding in LaTeX as PGF/TikZ
|
||||
|
||||
### Usage Scenarios
|
||||
- Webservices
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from typing import Callable, Generator, Self, Literal, TYPE_CHECKING
|
||||
from typing import Callable, Generator, Literal, TYPE_CHECKING
|
||||
import html
|
||||
import markdown
|
||||
from base64 import b64encode
|
||||
|
@ -307,7 +307,7 @@ class DocumentWriter():
|
|||
self._fields[name] = new_dwr
|
||||
return new_dwr
|
||||
|
||||
def add_document(self, doc: Self) -> None:
|
||||
def add_document(self, doc: 'DocumentWriter') -> None:
|
||||
self._doc += doc._doc
|
||||
|
||||
def add_diagram(self, fig: Figure, caption: str = '', ref_id: str = '',
|
||||
|
|
Loading…
Reference in New Issue