Skip to main content

A Static Book Generator.

Project description

Pressoir

Documentation complète : https://pressoir.org/

Utilisation rapide

  1. Installer uv : https://docs.astral.sh/uv/getting-started/installation/#standalone-installer
  2. Se placer dans le dossier contenant les textes
  3. Construire le livre : uv run --with pressoir pressoir build serve
  4. Se rendre sur http://127.0.0.1:8000 pour visualiser le livre

Optionnellement, générer un PDF du livre :

  1. Lancer : uv run --with pressoir pressoir export
  2. Récupérer le PDF dans public/book.pdf

À partir d’un corpus Stylo

  1. Installer uv : https://docs.astral.sh/uv/getting-started/installation/#standalone-installer
  2. Se placer dans un nouveau dossier
  3. Récupérer les textes : uv run --with pressoir pressoir stylo <corpus-id>
  4. Construire le livre : uv run --with pressoir pressoir build serve
  5. Se rendre sur http://127.0.0.1:8000 pour visualiser le livre

Installation

Pré-requis : Python3.8+

Installer et activer un environnement virtuel :

$ python3 -m venv venv
$ source venv/bin/activate

Installer les dépendances :

$ make install

Initialiser un livre

Par exemple :

$ pressoir init --repository-path=../fia --collection sp

ou

$ pressoir init --repository-path=../12-editionscritiques --collection pum

Note : si la destination n’existe pas ou n’a pas de dossier textes, une coquille complète du livre est créée.

Par exemple :

$ mkdir livre-test
$ cd livre-test
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install pressoir
$ pressoir init --collection=sp

Construire un livre

$ pressoir build --repository-path=../fia-en

Avec ../fia-en qui est le chemin vers le dépôt du livre.

En bonus, il est possible de passer un chapitre particulier pour ne reconstruire que lui :

$ pressoir build --repository-path=../fia-en --chapter=chapter1

Si vous êtes en local / développement, il faut passer l’option --local pour que les liens de parcours du livre fonctionnent.

Servir un livre

$ pressoir serve --repository-path=../fia-en

Avec ../fia-en qui est le chemin vers le dépôt du livre qui a été construit.

Générer les md+tex+pdf d’un livre

Expérimental : il est possible avec la commande pressoir export de générer des fichiers markdown, tex et pdf à partir des sources. Ils vont être créés dans public/book.{md|tex|pdf}.

Il est nécessaire d’avoir (xe)latex pour effectuer cette génération.

Help

Commands

usage: pressoir [-h]  ...

options:
  -h, --help  Show this help message and exit

Available commands:
  
    version   Return the current version of pressoir.
    init      Initialize a new book to `repository_path` or current directory.
    docs      Generate documentation with pressoir itself. #SoMeta
    build     Build a book from `repository_path` or current directory.
    export    Generate a single md+tex+pdf file from `repository_path` or
              current directory.
    serve     Serve an HTML book from `repository_path`/public or current
              directory/public.
    stylo     Initialize a new book to current directory from Stylo.

Command: init

usage: pressoir init [-h] [--repository-path REPOSITORY_PATH]
                     [--collection {pum,sp,blank}]

options:
  -h, --help            show this help message and exit
  --repository-path REPOSITORY_PATH
                        Absolute or relative path to book’s sources (default:
                        current).
  --collection, -c {pum,sp,blank}
                        Name of the collection (default: blank).

Command: docs

usage: pressoir docs [-h] [--target-path TARGET_PATH]

options:
  -h, --help            show this help message and exit
  --target-path TARGET_PATH

Command: build

usage: pressoir build [-h] [--repository-path REPOSITORY_PATH]
                      [--csl-path CSL_PATH] [--target-path TARGET_PATH]
                      [--templates-folder TEMPLATES_FOLDER]
                      [--chapter CHAPTER] [--keep-statics] [--verbose]

options:
  -h, --help            show this help message and exit
  --repository-path REPOSITORY_PATH
                        Absolute or relative path to book’s sources (default:
                        current).
  --csl-path CSL_PATH   Path to .csl file (default: Pandoc’s default).
  --target-path TARGET_PATH
                        Where the book will be built (default:
                        `repository_path`/public).
  --templates-folder TEMPLATES_FOLDER
                        Folder with header.html/footer.html for before/after
                        inclusion.
  --chapter, -c CHAPTER
                        Specify a given chapter id (e.g. `chapter1`).
  --keep-statics        Do not override the statics with regular ones
                        (default: False).
  --verbose, -v         Display more informations during the build (default:
                        False).

Command: export

usage: pressoir export [-h] [--repository-path REPOSITORY_PATH]
                       [--template-path TEMPLATE_PATH] [--csl-path CSL_PATH]
                       [--target-path TARGET_PATH] [--verbose]

options:
  -h, --help            show this help message and exit
  --repository-path REPOSITORY_PATH
                        Path to book’s sources (default: current).
  --template-path TEMPLATE_PATH
                        Path to .tex template (default: Pandoc’s default).
  --csl-path CSL_PATH   Path to .csl file (default: Pandoc’s default).
  --target-path TARGET_PATH
                        Where the book will be built (default:
                        `repository_path`/public).
  --verbose, -v         Display a lot of informations, useful for debugging.

Command: serve

usage: pressoir serve [-h] [--repository-path REPOSITORY_PATH] [--port PORT]

options:
  -h, --help            show this help message and exit
  --repository-path REPOSITORY_PATH
                        Absolute or relative path to book’s sources (default:
                        current).
  --port, -p PORT       Port to serve the book from (default=8000)

Command: stylo

usage: pressoir stylo [-h] [--stylo-instance STYLO_INSTANCE]
                      [--stylo-export STYLO_EXPORT] [--from-scratch]
                      [--keep-metadata]
                      stylo_id

positional arguments:
  stylo_id              Corpus id from Stylo.

options:
  -h, --help            show this help message and exit
  --stylo-instance STYLO_INSTANCE
                        Instance of Stylo (default: stylo.huma-num.fr).
  --stylo-export STYLO_EXPORT
                        Stylo export URL (default: https://export.stylo.huma-
                        num.fr).
  --from-scratch        Do not ask to override local files (default: False).
  --keep-metadata       Do not override the `livre.yaml` metadata file
                        (default: False).

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

pressoir-4.9.0.tar.gz (7.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pressoir-4.9.0-py3-none-any.whl (7.9 MB view details)

Uploaded Python 3

File details

Details for the file pressoir-4.9.0.tar.gz.

File metadata

  • Download URL: pressoir-4.9.0.tar.gz
  • Upload date:
  • Size: 7.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for pressoir-4.9.0.tar.gz
Algorithm Hash digest
SHA256 170484a8cd6a4ac78d945842b66df972d5c5b57bf77e0f5c74d1e4c68c7bfe27
MD5 af59577a5ba5546976244caac842d1ad
BLAKE2b-256 8c6f0a94c9651a4b27854259362dc83481cb72be1319fa9e9d4bebc276ad3938

See more details on using hashes here.

File details

Details for the file pressoir-4.9.0-py3-none-any.whl.

File metadata

  • Download URL: pressoir-4.9.0-py3-none-any.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for pressoir-4.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 68d74500f1bc1d692d0ee188a0fa50346aa5eaf85183c621b26654bd5e26695f
MD5 844c1c3ed64ca85514ce4c59f7cb02a0
BLAKE2b-256 2766726bdfa230b3cb5a37e007b3a031b931654cb59dc7be68f09a1ff1fde93f

See more details on using hashes here.

Supported by

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