Hi Stuart,

I've get latest revisions (commits)

asciidoc.py
http://code.google.com/p/asciidoc/source/detail?spec=svnb00f876aa3fdd1f029d2d7607c354a43223fd5d6&r=00828f68cb8a8bddc7324d1ef6ad0c7f9fcbaa3f

filters/sources/source-highlight-filter.conf
http://code.google.com/p/asciidoc/source/detail?spec=svnb00f876aa3fdd1f029d2d7607c354a43223fd5d6&r=d66e74ae22fa83306a200e68ae50a942dcb85d2d

I've also removed from my pygmentize.bat script the -O encoding=utf-8
so it's only
@python.exe %~dp0pygmentize %*

Either with

asciidoc.conf
[attributes]
encoding=UTF-8

or by putting in my file (QA.txt) header
:encoding: utf-8

None gave the expected result. What did I missed ?
Still get error as encoding attribute was not given

--------
*** Error while highlighting:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 57:
ordinal
 not in range(128)
   (file "C:\Python27\lib\site-packages\pygments\lexer.py", line 148, in
get_tokens)
asciidoc: WARNING: QA.txt: line 203: filter non-zero exit code: pygmentize
-f html -l php: returned 1
--------

Laurent


2010/11/7 Stuart Rackham <[email protected]>

> Hi Laurent
>
>
> On 06/11/10 23:14, Laurent Laville wrote:
>
>> Hi all,
>>
>> Asciidoc user since version 8.5.3, I used it on a Windows plateform
>> with Cygwin.
>> Recently, I've decided to use the latest version 8.6.2 on a native
>> Windows platform (so, without Cygwin).
>>
>> I've also decided to try all cool features such as syntax highlighter
>> with pygments.
>>
>> Install procedure :
>> - download Python 2.7 from http://www.python.org/download/  (with
>> Windows installer - binaries without source)
>> - download Pygments 1.3.1 from http://pygments.org/download/
>>
>> I got the pygmentize python script commant in folder c:
>> \Python27\Scripts
>>
>> First Problem :
>> ==========
>> Windows did not recognize pygmentize script, because association was
>> with .py extension file
>>
>> First Solution:
>> ==========
>> make a pygmentize.bat with content
>>
>>     @python.exe c:\Python27\Scripts\pygmentize %*
>>
>> Second Problem:
>> ============
>> As I am french user, and I have comment with accents in my source code
>> that are UTF-8 encoded, I run in trouble with encoding file
>> I got these error lines
>> ----------
>> *** Error while highlighting:
>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
>> 57: ordinal
>>  not in range(128)
>>    (file "C:\Python27\lib\site-packages\pygments\lexer.py", line 148,
>> in get_tokens)
>> asciidoc: WARNING: QA.txt: line 201: filter non-zero exit code:
>> pygmentize -f html -l php: returned 1
>> ----------
>>
>> As pygments allow to change encoding  (default is iso8859-1) with its -
>> O switch (http://pygments.org/docs/cmdline/)
>>
>> I wanted to have
>>     pygmentize -f html -l php -O encoding=utf-8
>>
>> But I don't yet find a solution to give extra arguments
>> Perharps a new feature for next version 8.6.3 of AsciiDoc and its
>> source-highlight-filter.conf file
>>
>
> I've passed the source file {encoding} attribute to to the
> source-highlight-filter.conf:
>
>
> http://code.google.com/p/asciidoc/source/detail?r=d66e74ae22fa83306a200e68ae50a942dcb85d2d
>
>
>
>
>> Second solution :
>> ============
>> Helped by an article I found on the Net
>> http://skim.la/2010/02/14/how-to-run-jekyll-pygmentize-on-windows/
>>
>> Change content of my pygmentize.bat script as follow
>>     @python.exe %~dp0pygmentize %* -O encoding=utf-8
>>
>>
>> Third problem
>> ==========
>> Generate a PDF target with A2X toolchain, with such command
>>
>> a2x.py --icons --fop -f pdf -v -L -d book \source_folder
>> \source_file.txt
>>
>> I cannot pass the XSLT transformation, and cannot generate the .fo
>> file for FOP
>>
>> Got these error lines
>> ----------
>> a2x: ERROR: xsltproc  --nonet
>> --stringparam callout.graphics 1 --stringparam navig.graphics 1 --
>> stringparam admon.textlabel 0 --stringparam admon.graphics 1
>> --output C:\docs\QA.fo C:\asciidoc-8.6.2\docbook-xsl\fo.xsl C:\docs
>> \QA.xml
>> returned non-zero exit status 5
>> ----------
>>
>> Third Solution:
>> ==========
>> In my situation the  --nonet  was the problem, without it, XSLTproc
>> can generate the target file
>>
>> I read the asciidoc a2x.py source script and put line 425
>> ( self.xsltproc_opts += ' --nonet' ) in comment
>>
>> My PDF was generated
>>
>> I suggest to modify asiidoc and put the --nonet as optional
>> Users as always ability to put this parameter on the command line
>> with
>>      --xsltproc-opts=XSLTPROC_OPTS
>>
>>
> I've done this:
>
>
> http://code.google.com/p/asciidoc/source/detail?r=b00f876aa3fdd1f029d2d7607c354a43223fd5d6
>
>
>
>> Hope my explains are enough clear, and will help other Windows users.
>>
>> To finish, while I tried to find a solution to got color syntax on
>> final PDF files through the a2x toolchain, I read a cool article on
>> the Net about Pygments :
>>
>> Pygments as syntax highlighter for DocBook documents
>>
>> Summary
>> "This article explains how to use Pygments as syntax highlighter for
>> DocBook documents processed with the DocBook XSL stylesheets in order
>> to replace the rather poor standard XSLTHL syntax highlighting."
>>
>> http://lunaryorn.de/articles/docbook_pygments.html
>>
>> Enjoy, and I hope we can have a such solution with futur AsciiDoc
>> release
>>
>> Laurent Laville
>>
>>
> Nice post, I develop and test on Linux so Windows does get a bit neglected.
>
> If you get a chance could you please test these changes and report back.
>
>
> Cheers, Stuart
>
>
> --
> 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]<asciidoc%[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