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.11.2.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.11.2-py3-none-any.whl (7.9 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pressoir-4.11.2.tar.gz
  • Upload date:
  • Size: 7.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.2 cpython/3.14.2 HTTPX/0.28.1

File hashes

Hashes for pressoir-4.11.2.tar.gz
Algorithm Hash digest
SHA256 fa7786ebac631a40a076bb0333e5c900e35df07f76f1ff16f9db10cbba83f5ec
MD5 d437db63d1f271f3897051b14ec15368
BLAKE2b-256 27425c4d423dbef323f0b6e1795a4a47efefb8689e5ac6e6aee11dacdc417c57

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pressoir-4.11.2-py3-none-any.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.2 cpython/3.14.2 HTTPX/0.28.1

File hashes

Hashes for pressoir-4.11.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5cdd417c73b09ed3ca4a7e1433a74ae55328a366d729e00ea10ded6675f44184
MD5 2961be13d4c7d47ea8eaa5a4e0963b7f
BLAKE2b-256 e8b1368b258fd413e83cbed1df392bf14f3ddcc82d028044db6b7eae2391a048

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