book code pageview zoom_in zoom_out import_contacts
TEI Publisher

Modify the ODD

Now we created a custom ODD, we can make a first modification. We'll use the Letter #6 from Robert Graves to William Graves as an example. Rendered through the standard teipublisher.odd, it is definitely missing some styling to look more like a letter. For example, we may want to move the dateline in the opener to the right and get rid of the pb label which currently sits there.

We thus need to overwrite the processing model rules for dateline and opener. The easiest way to do this is to:

  • open the standard teipublisher.odd and search for an existing elementSpec with ident="dateline".
  • if there is an elementSpec already, just copy it
  • paste the elementSpec into the new ODD and modify it

If there's no elementSpec for the element in teipublisher.odd, you have to create a new elementSpec in your ODD, using mode="add" instead of mode="change".

The elementSpec copied from teipublisher.odd looks like this:

<elementSpec mode="change" ident="dateline">
    <model behaviour="block"/>

To make the text right-aligned, we add a outputRendition:

<elementSpec mode="change" ident="dateline">
    <model behaviour="block">
        <outputRendition>text-align: right;</outputRendition>

We also want to hide the pb label, so we add another elementSpec:

<elementSpec mode="change" ident="pb">
    <model behaviour="omit"/>

To test the changes, go back to the main page of the app, select the new ODD and click on "Regenerate", then browse to the letter and view the result. In fact, the "regenerate" step is not absolutely necessary as the library will usually recognize the change to the ODD when you try to view the letter and regenerate automatically. However, if you made mistakes in the ODD, the regenerate will just fail silently. So during development, it is advisable to regenerate manually.

Move dateline to right and hide pb