Skip to content

About

An version of the ldlt-jekyll app for individuals to use locally.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

LDLT Local Edition Preview

This repository provides a local, Docker-based preview for one Library of Digital Latin Texts (LDLT) edition at a time. It validates the edition's TEI citation structures, transforms the TEI into Jekyll pages using Saxon and publish.xsl, and serves the resulting site with Jekyll and CETEIcean.

The edition's source XML remains in its own repository. The preview application reads it through a temporary, read-only Docker mount; editors do not need to copy the XML into this repository or edit Docker configuration to select an edition.

Requirements

  • Docker Desktop (or Docker Engine with Docker Compose v2)
  • A local copy of this repository
  • The TEI XML file for the edition to preview

Ruby, Jekyll, Java, and Saxon run inside Docker; they do not need to be installed on the host.

Initial setup

From the root of this repository, build the preview image:

docker compose build

Make the helper script executable if necessary:

chmod +x preview.sh

If the image is new and Ruby dependencies have not yet been installed in the Docker volume, run:

docker compose run --rm --no-deps preview bundle install

The bundle_cache Docker volume retains the installed gems between runs. If you see bundler: command not found: jekyll, run the bundle install command above inside Docker (not on your Mac).

Build an edition

./preview.sh build /absolute/path/to/edition.xml EDITION_SLUG

For example:

./preview.sh build /Users/huskey/Development/test_repo/cutedition.xml mutch

The XML path identifies the authoritative TEI file. The slug identifies the edition's URL; it does not have to match the XML filename. In the example, the edition is served at /editions/mutch, not /editions/cutedition.

During a build, preview.sh:

  1. Checks that the XML file exists.
  2. Creates a temporary Docker Compose override that mounts the XML read-only at the path expected by the build script.
  3. Runs build-preview.sh inside Docker.
  4. Validates <citeStructure> and related citation expressions using xslt/validate-citestructure.xsl.
  5. Stops the build on validation errors; warnings are reported but do not stop publication.
  6. Runs xslt/publish.xsl, passing the edition slug, and builds the Jekyll site.
  7. Deletes the temporary Compose override.

A successful build produces the pages that the preview server serves. A failed validation prevents the transformation and Jekyll build from running.

Serve the preview

Start the server:

./preview.sh serve

Open http://localhost:4000 in your browser. For the example above, the edition page is http://localhost:4000/editions/mutch.

The server does not require the XML path: it serves the files generated by the last successful build.

Stop the server:

./preview.sh stop

Check container status or follow logs:

./preview.sh status
./preview.sh logs

logs follows the server output; press Ctrl+C to stop following logs without stopping the server.

preview.sh command reference

Command Purpose
./preview.sh build XML_PATH EDITION_SLUG Validate and transform the TEI, then build the Jekyll site.
./preview.sh serve Start the Jekyll preview server.
./preview.sh stop Stop the preview server.
./preview.sh status Show Docker Compose container status.
./preview.sh logs Follow recent preview server logs.
./preview.sh help Display command usage.

The build and server are separate operations. Ordinarily, run build after changing the TEI source, then use serve to view the result. If the server is already running, consult its logs to confirm that it has regenerated the site; restart or recreate it if necessary.

Developing the Jekyll interface

The preview container mounts this repository into /site. The Jekyll server has been configured with watching and forced polling, so changes to Jekyll source files should trigger a rebuild automatically:

bundle exec jekyll serve \
  --host 0.0.0.0 \
  --port 4000 \
  --watch \
  --force_polling

That command is part of the Docker Compose service configuration; you do not need to run it on the host.

For changes to _layouts/, _includes/, CSS, or JavaScript, save the file and refresh your browser. There is normally no need to rerun the TEI transformation. If you change the TEI XML or the XSLT responsible for generating edition pages, run ./preview.sh build ... again.

To inspect Jekyll's file-watching activity:

./preview.sh logs

Important: Editing compose.yaml does not update an already running container. To apply changes to the service command or mounts, recreate the container:

docker compose up -d --no-build --force-recreate preview

A simple docker compose restart does not apply changes to the Compose configuration.

Configuration and design notes

  • One edition at a time: this is an editorial preview, not a multi-edition publishing portal.
  • No edition-specific .env or Compose configuration: preview.sh build receives the XML path and slug directly.
  • Read-only source: the build mounts the authoritative TEI XML read-only; generated preview files live in this repository's Jekyll workspace.
  • Stable URLs: the slug passed to the build should be used for generated edition URLs, regardless of the source filename.
  • Presentation vs. transformation: Jekyll layouts, includes, and styles control the interface; XSLT handles TEI validation and publication.
  • Dockerized dependencies: Saxon, Ruby/Bundler, and Jekyll run in the container.

Troubleshooting

bundler: command not found: jekyll

Install the bundle inside the Docker environment:

docker compose run --rm --no-deps preview bundle install

Changes to layouts or styles do not appear

Check ./preview.sh logs for Jekyll rebuild messages. Confirm that the running container was recreated after enabling --watch --force_polling:

docker compose up -d --no-build --force-recreate preview

The edition link returns 404

Confirm that the URL uses the edition slug, not the XML filename. Rebuild after modifying the slug or the relevant publish.xsl URL-generation logic.

Validation fails

Read the validator's reported errors and warnings. Errors stop publication; warnings do not. The additional Saxon XTMM9000 termination message is expected when the validator deliberately ends the transformation after reporting errors.

Docker Compose reports a missing EDITION_XML variable

The current design does not require EDITION_XML in compose.yaml. Remove any old ${EDITION_XML:?...} volume declaration; the build script supplies the XML mount through a temporary Compose override.

Key files

File or directory Role
preview.sh Editor-facing command-line interface.
compose.yaml Docker preview service and persistent Bundler volume.
Dockerfile.preview Container runtime with Ruby, Java, and Saxon.
build-preview.sh Validation, transformation, and Jekyll build pipeline.
xslt/validate-citestructure.xsl Citation-structure validation and diagnostics.
xslt/publish.xsl TEI-to-Jekyll publication transformation.
_layouts/, _includes/ Jekyll page structure and navigation.
assets/ Stylesheets and client-side TEI/apparatus functionality.

About

An version of the ldlt-jekyll app for individuals to use locally.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages