Hi Miguel

Miguel Farah wrote:
> I'm using AsciiDoc on a Windows only machine (for the time being).
> 
> If I want to read a custom configuration file, I'm forced to specify
> it with a relative
> path, or it won't work properly:
> 
> C:\AsciiDoc>asciidoc.py -v --conf-file=.\CONFIGURACION.conf
> minimanual_de_AsciiDoc.txt
> reading: C:\AsciiDoc\asciidoc.conf
> reading: C:\AsciiDoc\xhtml11.conf
> reading: C:\AsciiDoc\xhtml11-quirks.conf
> reading: C:\AsciiDoc\filters\code-filter.conf
> reading: C:\AsciiDoc\filters\music-filter.conf
> reading: C:\AsciiDoc\filters\source-highlight-filter.conf
> reading: .\CONFIGURACION.conf
> reading: C:\AsciiDoc\minimanual_de_AsciiDoc.txt
> writing: C:\AsciiDoc\minimanual_de_AsciiDoc.html
> 
> C:\AsciiDoc>asciidoc.py -v --conf-file=CONFIGURACION.conf
> minimanual_de_AsciiDoc.txt
> reading: C:\AsciiDoc\asciidoc.conf
> reading: C:\AsciiDoc\xhtml11.conf
> reading: C:\AsciiDoc\xhtml11-quirks.conf
> reading: C:\AsciiDoc\filters\code-filter.conf
> reading: C:\AsciiDoc\filters\music-filter.conf
> reading: C:\AsciiDoc\filters\source-highlight-filter.conf
> reading: CONFIGURACION.conf
> FAILED: unexpected error:
> ------------------------------------------------------------
> Traceback (most recent call last):
>   File "C:\AsciiDoc\asciidoc.py", line 3963, in asciidoc
>     config.load(conf)
>   File "C:\AsciiDoc\asciidoc.py", line 3488, in load
>     while not rdr.eof():
>   File "C:\AsciiDoc\asciidoc.py", line 3262, in eof
>     return self.read_next() is None
>   File "C:\AsciiDoc\asciidoc.py", line 3265, in read_next
>     result = self.read()
>   File "C:\AsciiDoc\asciidoc.py", line 3208, in read
>     result = self.read_super()
>   File "C:\AsciiDoc\asciidoc.py", line 3203, in read_super
>     result = Reader1.read(self,self.skip)
>   File "C:\AsciiDoc\asciidoc.py", line 3136, in read
>     fname = safe_filename(fname, os.path.dirname(self.fname))
>   File "C:\AsciiDoc\asciidoc.py", line 140, in safe_filename
>     if not is_safe_file(fname, parentdir):
>   File "C:\AsciiDoc\asciidoc.py", line 128, in is_safe_file
>     return not safe() or file_in(fname,dir)
>   File "C:\AsciiDoc\asciidoc.py", line 115, in file_in
>     assert os.path.isdir(dir)
> AssertionError
> ------------------------------------------------------------
> 
> C:\AsciiDoc>
> 
> 
> It's kinda surprising because the source file
> (minimanual_de_AsciiDoc.txt) doesn't
> have the same problem.
> 

This looks like a bug, my guess is that you have an include::[] macro in 
your CONFIGURACION.conf file and when asciidoc checks the include is 
safe it checks the include file is in the the same directory branch as 
CONFIGURACION.conf, but since CONFIGURACION.conf has a directory of '' 
the os.path.isdir() assertion fails.

Try replacing at lines 126,127 in asciidoc.py:

     if dir is None:
         dir = os.path.dirname(document.infile)

with:

     if dir is None:
         dir = os.path.dirname(document.infile)
     elif dir == '':
         dir = '.'

This should fix the problem.


Cheers, Stuart
-- 
Stuart Rackham

_______________________________________________
Asciidoc-discuss mailing list
Asciidoc-discuss@metaperl.com
http://metaperl.com/cgi-bin/mailman/listinfo/asciidoc-discuss

Reply via email to