empty attribute after cmdline reassignment

15 views
Skip to first unread message

Suraj Kurapati

unread,
Jun 29, 2011, 3:28:06 AM6/29/11
to asciidoc

Hello,

I am trying to reassign the iconsdir attribute on the command-line
so that it becomes an absolute path (to allow base64 embedding of
icon images into the resulting HTML output). But it doesn't work:

# asciidoc --version
asciidoc 8.6.5

# echo -e '{asciidoc-confdir}\n{iconsdir}' > /tmp/foo.txt

# asciidoc /tmp/foo.txt
# grep etc /tmp/foo.html
<div class="paragraph"><p>/etc/asciidoc
# grep images /tmp/foo.html
./images/icons</p></div>

# asciidoc -a 'iconsdir={asciidoc-confdir}/{iconsdir}' /tmp/foo.txt
# grep etc /tmp/foo.html
<div class="paragraph"><p>/etc/asciidoc</p></div>
# grep images /tmp/foo.html
exit 1

Am I misunderstanding the order of attribute evaluation?

Thanks for your consideration.

Lex Trotman

unread,
Jun 29, 2011, 5:43:36 AM6/29/11
to asci...@googlegroups.com
On 29 June 2011 17:28, Suraj Kurapati <sun...@gmail.com> wrote:
>
> Hello,
>
> I am trying to reassign the iconsdir attribute on the command-line
> so that it becomes an absolute path (to allow base64 embedding of
> icon images into the resulting HTML output).  But it doesn't work:
>
> # asciidoc --version
> asciidoc 8.6.5
>
> # echo -e '{asciidoc-confdir}\n{iconsdir}' > /tmp/foo.txt
>
> # asciidoc /tmp/foo.txt
> # grep etc /tmp/foo.html
> <div class="paragraph"><p>/etc/asciidoc
> # grep images /tmp/foo.html
> ./images/icons</p></div>
>
> # asciidoc -a 'iconsdir=asciidoc -a 'iconsdir={asciidoc-confdir}/{iconsdir}' /tmp/foo.txt' /tmp/foo.txt

> # grep etc /tmp/foo.html
> <div class="paragraph"><p>/etc/asciidoc</p></div>
> # grep images /tmp/foo.html
> exit 1
>
> Am I misunderstanding the order of attribute evaluation?

No, I think you are misunderstanding that attributes are not
substituted in command line attribute definitions and attributes are
not recursively substituted. So when iconsdir is substituted the
literal text '{asciidoc-confdir}/{iconsdir}' is substituted which
shows up as unsubstituted attributes which gets the line dropped.

You are just going to have to type the path.

Cheers
Lex

Suraj Kurapati

unread,
Jun 29, 2011, 12:03:55 PM6/29/11
to asciidoc
On Jun 29, 2:43 am, Lex Trotman wrote:
> On 29 June 2011 17:28, Suraj Kurapati wrote:
> > I am trying to reassign the iconsdir attribute on the
> > command-line so that it becomes an absolute path
>
> attributes are not substituted in command line attribute
> definitions and attributes are not recursively substituted.  So
> when iconsdir is substituted the literal text
> '{asciidoc-confdir}/{iconsdir}' is substituted which shows up as
> unsubstituted attributes which gets the line dropped.

That makes sense. Thanks for explaining.

> You are just going to have to type the path.

Actually, I found a workaround: moving the attribute value
reassignment into the AsciiDoc document itself makes it work.

# cat /tmp/foo.txt
:iconsdir: {asciidoc-confdir}/{iconsdir}

{asciidoc-confdir}

{iconsdir}

# asciidoc /tmp/foo.txt
# grep etc /tmp/foo.html
<div class="paragraph"><p>/etc/asciidoc</p></div>
<div class="paragraph"><p>/etc/asciidoc/./images/icons</p></div>
# grep images /tmp/foo.html
<div class="paragraph"><p>/etc/asciidoc/./images/icons</p></div>
Reply all
Reply to author
Forward
0 new messages