Skip to main content

Poetry PDF

Poetry formatter

Status

Source Shields
Project license release
Publishers pypi
Downloads pypi_downloads
Raised issues pulls

Usage

Plaintext is converted into html and pdfkit is used to export a PDF.

Exposed CLI:

poetry-pdf <source_path>
            [--output-dir=<output_dir>]
            [--author=<author>]
            [--stylesheet=<stylesheet>]...

Example invocation:

poetry-pdf "the_raven.txt" --output-path "." --author "Edgar Allan Poe"

Intermediate html:

<head>
  <meta charset="utf-8" />
  <link
    rel="stylesheet"
    type="text/css"
    href="/Users/joel/Workspace/poetry-pdf/poetry_pdf/styles/default.css"
  />
</head>
<body>
  <h1 id="title">
    The Raven
  </h1>
  <br />
  <p id="poem">
    Once upon a midnight dreary, while I pondered, weak and weary,<br />
    Over many a quaint and curious volume of forgotten lore—<br />
    While I nodded, nearly napping, suddenly there came a tapping,<br />
    As of some one gently rapping, rapping at my chamber door.<br />
    “’Tis some visitor,” I muttered, “tapping at my chamber door—<br />
    Only this and nothing more.”<br />
    <br />
    Ah, distinctly I remember it was in the bleak December;<br />
    And each separate dying ember wrought its ghost upon the floor.<br />
    Eagerly I wished the morrow;—vainly I had sought to borrow<br />
    From my books surcease of sorrow—sorrow for the lost Lenore—<br />
    For the rare and radiant maiden whom the angels name Lenore—<br />
    Nameless here for evermore.<br />
  </p>
  <br />
  <p id="author">
    Edgar Allan Poe
  </p>
</body>

Generated pdf:

the_raven.pdf

Custom stylesheets can be specified:

poetry-pdf "the_raven.txt" --stylesheet "./sheet1.css" --stylesheet "./sheet2.css"

If no stylesheets are provided the page styles will default to:

body {
  font-family: "Avenir Next", sans-serif;
  margin: 100px;
}

#title {
  font-size: 70px;
  font-weight: 500;
  text-align: center;
}

#poem, #author {
    font-style: italic;
    font-weight: 400;
    font-size: 20px;
    line-height: 35px;
  }

#author {
    text-align: right;
  }

Installing

To install the package from pypi:

pip install poetry_pdf

Alternatively, you can clone the repo and build the package locally.

Docs

Additional details are available in the full documentation.

To generate the documentation locally:

multi-job docs

Tests

Unit tests and behaviour tests are written with the pytest framework.

To run tests:

multi-job tests

Additionally, an html report will be saved to the local directory.

Buildbot

To run the buildbot server:

cd ci
docker-compose up -d

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests.

Versioning

SemVer is used for versioning. For a list of versions available, see the tags on this repository.

Bump2version is used to version and tag changes. For example:

bump2version patch

Releases are made on every major change.

Author

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

None yet!

Metadata

Release files for poetry-pdf 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for poetry-pdf 1.1.0
File Size Uploaded Provenance Actions
poetry_pdf-1.1.0.tar.gz 147.2 kB Without provenance Details for poetry_pdf-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for poetry-pdf 1.1.0
File Interpreter ABI Platform Actions
poetry_pdf-1.1.0-py3-none-any.whl Python 3 none any Details for poetry_pdf-1.1.0-py3-none-any.whl

Total release size: 321.0 kB

Release files / poetry_pdf-1.1.0.tar.gz

Download URL poetry_pdf-1.1.0.tar.gz
Size 147.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1f045816f2ebcf2b0ec0da89d3557bd47987a8d1bd8c1fb374bfd6d5d7e04731
BLAKE2b-256 checksum
How to use checksums
9c7e760476da2e323b0acaf80f11302d871f96d1dc43c5493a21713e59f1fdd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3

Release files / poetry_pdf-1.1.0-py3-none-any.whl

Download URL poetry_pdf-1.1.0-py3-none-any.whl
Size 173.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
45a1361b0abf5572afa14752f380103f19963b6d46a5f5c9206bbf9d3717a496
BLAKE2b-256 checksum
How to use checksums
0abc0077a78f68f400898131fe3d033df00750d34f93db61518bd76ebf136656
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3

Security for poetry-pdf 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page