On 18/09/12 03:02, David Favor wrote:
> This is my first time using asciidoc, so maybe I misunderstand conf file
> processing logic.
> 
> Summary: user asciidoc.conf files are always ignored + conf files are
> read multiple times.
> __________
> 
> David-Favor-iMac> asciidoc --version
> asciidoc 8.6.8
> 
> This is a Macports install where /opt/local/etc/asciidoc/images/icons
> contains icons.
> 
> David-Favor-iMac> asciidoc -v -b html5 -a icons -a toc2 -a theme=flask
> article.txt 2>&1 | grep asciidoc.conf
> asciidoc: reading: /opt/local/etc/asciidoc/asciidoc.conf
> 
> Shows the system file is read, which contains the directive.
> 
> David-Favor-iMac> egrep ^iconsdir= /opt/local/etc/asciidoc/asciidoc.conf
> iconsdir=./images/icons
> 
> All this appears correct... Now for the broken part... Let's drop in a
> user conf
> file and see what occurs...
> 
> David-Favor-iMac> mkdir -p ~/.asciidoc
> David-Favor-iMac> echo 'iconsdir=/opt/local/etc/asciidoc/images/icons' >
> ~/.asciidoc/asciidoc.conf
> David-Favor-iMac> cat ~/.asciidoc/asciidoc.conf
> iconsdir=/opt/local/etc/asciidoc/images/icons

Attributes must reside in the [attributes] section of a configuration
file otherwise it won't be picked up (see
http://www.methods.co.nz/asciidoc/userguide.html#_configuration_file_format
and
http://www.methods.co.nz/asciidoc/userguide.html#_attributes_section)
i.e. your custom conf file should be:

[attributes]
iconsdir=/opt/local/etc/asciidoc/images/icons

I think that would explain most of your ensuing problems.
Thanks for clearly annunciating the issue, without the session dump it
would have been impossible to guess what was going on.


> David-Favor-iMac> ls /opt/local/etc/asciidoc/images/icons
> READMEcaution.pnghome.pngnext.pngprev.pngup.png
> callouts/example.pngimportant.pngnote.pngtip.pngwarning.png
> 
> Here's what occurs...
> David-Favor-iMac> r as
> asciidoc -v -b html5 -a icons -a toc2 -a theme=flask article.txt 2>&1 |
> grep asciidoc.conf
> asciidoc: reading: /opt/local/etc/asciidoc/asciidoc.conf
> asciidoc: reading: /Users/david/.asciidoc/asciidoc.conf
> asciidoc: reading: /opt/local/etc/asciidoc/asciidoc.conf
> asciidoc: reading: /Users/david/.asciidoc/asciidoc.conf
> 
> Breakage #1: conf files are read twice.

It's normal (though not optimal) for conf files to be read multiple
times -- asciidoc is trying to ensure the precedence is correct as it
aggregates new configuration entries from the various sources up until
the source header is parsed.


Cheers, Stuart

> 
> David-Favor-iMac> grep note.png article.html
> <img src="./images/icons/note.png" alt="Note">
> 
> Breakage #2: user conf file is read last and fails to override system
> conf file.
> 
> Now specify the user conf file on the command line and same thing occurs...
> 
> David-Favor-iMac> r
> asciidoc -v -f /Users/david/.asciidoc/asciidoc.conf -b html5 -a icons -a
> toc2 -a theme=flask article.txt 2>&1 | grep asciidoc.conf
> asciidoc: reading: /opt/local/etc/asciidoc/asciidoc.conf
> asciidoc: reading: /Users/david/.asciidoc/asciidoc.conf
> asciidoc: reading: /opt/local/etc/asciidoc/asciidoc.conf
> asciidoc: reading: /Users/david/.asciidoc/asciidoc.conf
> 
> David-Favor-iMac> grep note.png article.html
> <img src="./images/icons/note.png" alt="Note">
> 
> Breakage #3: --conf-file/-f command line flag is ignored.
> 
> Now let's try to remove the local conf file and change the system file,
> which will only work for people with root access...
> 
> David-Favor-iMac> egrep 'iconsdir='
> /opt/local/etc/asciidoc/asciidoc.conf | grep images/icons
> #iconsdir=./images/icons
> iconsdir=/opt/local/etc/asciidoc/images/icons
> 
> David-Favor-iMac> asciidoc -v -b html5 -a icons -a toc2 -a theme=flask
> article.txt 2>&1 | grep asciidoc.confasciidoc: reading:
> /opt/local/etc/asciidoc/asciidoc.conf
> 
> Hum... now the one conf file is processed once... and...
> 
> David-Favor-iMac> grep note.png article.html
> <img src="/opt/local/etc/asciidoc/images/icons/note.png" alt="Note">
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "asciidoc" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/asciidoc/-/od1IBcuq6UYJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/asciidoc?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"asciidoc" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/asciidoc?hl=en.

Reply via email to