Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Highlight some part of a source code (pygments)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Ramzi Akremi  
View profile  
 More options Oct 30 2011, 5:31 pm
From: Ramzi Akremi <ramzi.akr...@gmail.com>
Date: Sun, 30 Oct 2011 14:31:40 -0700 (PDT)
Local: Sun, Oct 30 2011 5:31 pm
Subject: Highlight some part of a source code (pygments)
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

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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lex Trotman  
View profile  
 More options Oct 30 2011, 6:03 pm
From: Lex Trotman <ele...@gmail.com>
Date: Mon, 31 Oct 2011 09:03:06 +1100
Local: Sun, Oct 30 2011 6:03 pm
Subject: Re: Highlight some part of a source code (pygments)
On 31 October 2011 08:31, Ramzi Akremi <ramzi.akr...@gmail.com> wrote:

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ramzi Akremi  
View profile  
 More options Oct 31 2011, 11:46 am
From: Ramzi Akremi <ramzi.akr...@gmail.com>
Date: Mon, 31 Oct 2011 08:46:04 -0700 (PDT)
Local: Mon, Oct 31 2011 11:46 am
Subject: Re: Highlight some part of a source code (pygments)
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 <ele...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stuart Rackham  
View profile  
 More options Nov 7 2011, 12:18 am
From: Stuart Rackham <srack...@gmail.com>
Date: Mon, 07 Nov 2011 18:18:05 +1300
Local: Mon, Nov 7 2011 12:18 am
Subject: Re: Highlight some part of a source code (pygments)
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=64df5f6321971483a2d...

Cheers, Stuart

On 01/11/11 04:46, Ramzi Akremi wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »