I've just committed a patch that adds and 'args' block attribute to source highlight blocks to allow arbitrary parameters to be passed to the source highlighters, so your example can now be done out of the box with:

["source","ruby","numbered",args="-O \"hl_lines=1 10 13\""]
-------
the source code
-------

See: http://code.google.com/p/asciidoc/source/detail?r=64df5f6321971483a2d67c503fb8cd25db59bc11

Cheers, Stuart


On 01/11/11 04:46, Ramzi Akremi wrote:
Thanks a lot Lex

I had to read a little bit about asciidoc configuration files, but it
worked
Here is the configuration setting that I've added to source-highlight-
filter.conf

ifdef::pygments[source-style=template="source-highlight-
block",presubs=(),postsubs=("callouts",),posattrs=("style","language","src_numbered","src_emphasize"),filter="pygmentize
-f html -l {language} {src_numbered?-O linenos=table} {encoding?-O
encoding={encoding}} {src_emphasize?-O \"hl_lines={src_emphasize}\"}"]

Worked really well, so now in an asciidoc file I can declare this :

[source, ruby, numbered, 1 10 13]
-------
the source code
-------

Thanks again

On Oct 30, 11:03 pm, Lex Trotman<[email protected]>  wrote:
On 31 October 2011 08:31, Ramzi Akremi<[email protected]>  wrote:









Hi all,

I would like to emphasize some part of a source when using asciidoc

for instance, I have this portion of text

[source, ruby, numbered]
------------
  total_amount, frequent_renter_points = 0, 0
  result = "Rental Record for #{name}\n"
  @rentals.each do |element|
    this_amount = 0
-------------

I would like to make lines 2 to 4 appear differently (another
background or in bold), how can I pass these kind of parameters to the
pigments highlighter

There is no built-in for extra parameters for pygmentize, you will
have to make a custom conf file containing:

source-style=template="source-highlight-block",presubs=(),postsubs=("callou 
ts",),posattrs=("style","language","src_numbered"),filter="pygmentize
-f html -l {language} {src_numbered?-O linenos=table} {encoding?-O
encoding={encoding}}"

with attributes for the extra parameters added.

Cheers
Lex









I've followed the hl_lines trail which works well in command line but
I would like to streamline this with my asciidoc workflow.

thanks in advance

--
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 
athttp://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