I'd like to generate a PDF from an .adoc file with asciidoctor using
asciidoctor-pdf Doku.adoc
How can I print the current git sha1-hash into the PDF?
I'd like to generate a PDF from an .adoc file with asciidoctor using
asciidoctor-pdf Doku.adoc
How can I print the current git sha1-hash into the PDF?
Copyright © 2021 Jogjafile Inc.
Use DocumentAttributes
asciidoctor-pdf -acommitHash=$(git rev-parse HEAD) Doku.adocYou can now use the document attribute
commitHashwithin your document by writing:{commitHash}Use
ifdefto test if the variable is set.You can also define a default as fallback if no attribute is defined from the CLI
The command line
-awill override the document internal declaration.