Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variables #28

Open
bennyboer opened this issue May 24, 2023 · 0 comments
Open

Variables #28

bennyboer opened this issue May 24, 2023 · 0 comments
Labels
enhancement New feature or request planned

Comments

@bennyboer
Copy link
Owner

bennyboer commented May 24, 2023

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request planned
Projects
None yet
Development

No branches or pull requests

1 participant