Skip to main content

Poetry formatter

Project description

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!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

poetry_pdf-1.1.0.tar.gz (147.2 kB view details)

Uploaded Source

Built Distribution

poetry_pdf-1.1.0-py3-none-any.whl (173.8 kB view details)

Uploaded Python 3

File details

Details for the file poetry_pdf-1.1.0.tar.gz.

File metadata

  • Download URL: poetry_pdf-1.1.0.tar.gz
  • Upload date:
  • Size: 147.2 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for poetry_pdf-1.1.0.tar.gz
Algorithm Hash digest
SHA256 1f045816f2ebcf2b0ec0da89d3557bd47987a8d1bd8c1fb374bfd6d5d7e04731
MD5 a074c4d37c2801705d0385d4b0c1e264
BLAKE2b-256 9c7e760476da2e323b0acaf80f11302d871f96d1dc43c5493a21713e59f1fdd5

See more details on using hashes here.

File details

Details for the file poetry_pdf-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: poetry_pdf-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 173.8 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for poetry_pdf-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 45a1361b0abf5572afa14752f380103f19963b6d46a5f5c9206bbf9d3717a496
MD5 79fb20064b88aff9d61f9e5a52962d52
BLAKE2b-256 0abc0077a78f68f400898131fe3d033df00750d34f93db61518bd76ebf136656

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page