Skip to content

Variables #28

@bennyboer

Description

@bennyboer

Basics

We need to extend the current meta data file (#4) to support variables.

Variables can be mentioned in the Metadata file:

title = "My document title"
authors = ["The authors name"]
version = 0.0.1
language = "de-de" # Language of the document - used for example for hyphenation when typesetting

[variables]
release-date = "2022-04-30"

and used

The release date of this document is <var name="release-date"/>.

Predefined variables

Predefined variable names are written in caps.

<var name="TITLE"/>
<var name="AUTHOR"/>
<var name="VERSION"/>

Not all predefined variables are mentioned in the meta data file.

<var name="CURRENT_PAGE"/>
<image label="image1" src="image.png">Image caption</image>

<paragraph>
  Check out Image <ref to="image1"/>!
</paragraph>

The ref element using the context of the image labelled with image1. The above is syntactic sugar for the following:

<image label="image1" src="image.png">Image caption</image>

<paragraph>
  Check out Image <ref to="image1"><var name="TARGET_NUMBER"/></ref>!
</paragraph>

We can do more cool tricks:

<image label="image1" src="image.png">Image caption</image>

<paragraph>
  Check out the Image on page <ref to="image1"><var name="TARGET_PAGE"/></ref>!
</paragraph>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions