I have an asciidoc book
that consists of several .adoc
files, and I want to use a custom attribute in each file.
I've created .attribute.adoc
and included it in each file like this:
include::.attriutes.adoc[]
It works... but at the end of each chapter (one .adoc
file is one chapter) asciidoctor
renders the "include statement" as-is. Let's assume .attribute.adc
contains the following string:
:appname: MyApp
asciidoctor
replaces each occurrence of {appname}
with MyApp
, but also adds the string :appname: MyApp
to the end of the chapter. Any idea?
In the end, the only way to make this work correctly, was to pass the custom attribute (appname
) to asciidoctor-pdf
. Here's a snippet of my Makefile
:
$(PDF_FILE): $(ADOC_FILES) | $(PDF_DIR)
bundle exec asciidoctor-pdf \
-r asciidoctor-diagram \
-a appname=$(APPNAME) \
-a imagesdir=$(IMGDIR) \
-a pdf-themesdir=$(THEMEDIR) \
-a pdf-fontsdir="$(THEMEDIR);GEM_FONTS_DIR" \
-a pdf-theme=custom \
$(SRCDIR)/main.adoc \
-o $@
Passing appname
to asciidoctor-pdf
solves my problem... and the resulting PDF no longer contains :appname: MyApp at end of some chapters.