On 1 April 2013 05:06, Henrik Bengtsson <[email protected]> wrote:
> Hi Lex, > > thanks for the quick reply. > > On Sat, Mar 30, 2013 at 5:08 PM, Lex Trotman <[email protected]> wrote: > > Hi Henrick, > > > > Thanks for the excellent analysis. > > > > > > On 31 March 2013 06:17, Henrik Bengtsson <[email protected]> > wrote: > >> > >> Hi, > >> > >> it appears that asciidoc v8.6.8 have problems encoding image files if > they > >> have commas in their names; probably an issue with 'sys3'. > >> > >> EXAMPLE: > >> > >> C:\tmp>echo "image:foo,bar.png[]" > test.txt > >> > >> C:\tmp>cat test.txt > >> image:foo,foo.png[] > >> > >> C:\tmp>dir "foo,bar.png" > >> 03/30/2013 12:01 PM 2,494 note,foo.png > >> > >> C:\tmp>asciidoc test.txt > >> ## <img src="foo,bar.png" alt="foo,bar.png" /> > >> > >> C:\tmp>asciidoc -a data-uri test.txt > >> The system cannot find the file specified. > >> asciidoc: WARNING: test.txt: line 1: {sys3:"C:\Python27\python.exe" -u > -c > >> "import base64,sys; base64.encode(sys.stdin,sys.stdout)" < > >> "C:\tmp\foo,bar.png"}: non-zero exit status > >> > >> Using an image filename without a comma and things work just fine. > >> (Before anyone suggests not to use commas in the first place; they are > >> > >> > >> TROUBLESHOOTING: > >> Making that system call at the command line does indeed work: > >> > >> C:\tmp>"C:\Python27\python.exe" -u -c "import base64,sys; > >> base64.encode(sys.stdin,sys.stdout)" < "C:\tmp\foo,bar.png" > >> iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABX[...] > >> [...]yCoCXW14B8HLLvwDd67nwZIEPdgAAAABJRU5ErkJggg== > >> > >> Could it be that 'sys3' drops/does not pass the filename with quotes? > >> Indeed, when unquoting the filename I get the same error message as > above; > > > > > > Yes, on NT type operating systems only, the quotes that do not surround a > > space are dropped, the comment in the code is: > > > > # Remove redundant quoting -- this is not just > > # cosmetic, unnecessary quoting appears to cause > > # command line truncation. > > > > It would appear that "unnecessary" is not just "without spaces" but > "without > > spaces or commas"? Are there other characters that require quoting? I > > can't find any exact version of such definition, do you know what it is? > > I've checked with the following 13 special characters " ,#$@[]^_`{}~" > (=20 2c 23 24 40 5b 5d 5e 5f 60 7b 7d 7e). Out of those, you need to > quote pathnames that have " " (20) , "," (2c), and "^" (5e). > > Here's a patch: > > x:\_GITHUB\asciidoc>hg diff asciidoc.py > diff -r 1ebcbfc71e2f asciidoc.py > --- a/asciidoc.py Sun Feb 17 10:37:43 2013 +1300 > +++ b/asciidoc.py Sun Mar 31 11:04:09 2013 -0700 > @@ -815,7 +815,7 @@ > # Remove redundant quoting -- this is not just > # cosmetic, unnecessary quoting appears to cause > # command line truncation. > - filter_cmd = re.sub(r'"([^ ]+?)"', r'\1', filter_cmd) > + filter_cmd = re.sub(r'"([^^ ,]+?)"', r'\1', filter_cmd) > So just to confirm, only the circumflex, space and comma needs quoting on windows? Cheers Lex > try: > p = subprocess.Popen(filter_cmd, shell=True, > stdin=subprocess.PIPE, stdout=subprocess.PIPE) > @@ -893,7 +893,7 @@ > # Remove redundant quoting -- this is not just > # cosmetic, unnecessary quoting appears to cause > # command line truncation. > - cmd = re.sub(r'"([^ ]+?)"', r'\1', cmd) > + cmd = re.sub(r'"([^^ ,]+?)"', r'\1', cmd) > message.verbose('shelling: %s' % cmd) > if os.system(cmd): > message.warning('%s: non-zero exit status' % syntax) > > Cheers, > > Henrik > > > > > Cheers > > Lex > > > > > >> > >> > >> C:\tmp>"C:\Python27\python.exe" -u -c "import base64,sys; > >> base64.encode(sys.stdin,sys.stdout)" < C:\tmp\foo,bar.png > >> The system cannot find the file specified. > >> > >> This may or may not be Windows only issue. > >> > >> > >> SESSION INFO (Windows 7 64-bit Ultimate): > >> > >> > asciidoc --version > >> asciidoc 8.6.8 > >> > >> > "C:\Python27\python.exe" --version > >> Python 2.7.4rc1 > >> > >> > >> Thanks, > >> > >> Henrik > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "asciidoc" group. > >> To unsubscribe from this group and stop receiving emails from it, send > an > >> email to [email protected]. > >> To post to this group, send email to [email protected]. > >> Visit this group at http://groups.google.com/group/asciidoc?hl=en. > >> For more options, visit https://groups.google.com/groups/opt_out. > >> > >> > > > > > > -- > > You received this message because you are subscribed to the Google Groups > > "asciidoc" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to [email protected]. > > To post to this group, send email to [email protected]. > > Visit this group at http://groups.google.com/group/asciidoc?hl=en. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > -- > You received this message because you are subscribed to the Google Groups > "asciidoc" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/asciidoc?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "asciidoc" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/asciidoc?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
