On 12/02/2010 05:03, P.H. wrote:
> (1) Is it possible / easy to filter a region of text with either some
> external program or python function.
> I would for example be interested to add line numbers to a code
> sample...
> (I thing I saw a discussion about that being planned for txt2tags-3, but
> I cannot find it any more, so I may have invented it.)
The easiest way for pretty printing code is to use a dedicated external 
program and include the result. Like
%!include(html): ''prettysource.html''

This is (and I think there is) not a simple solution for code snippets.
> (2) Is it possible to define a "tagged" raw environments, typically for
> code samples.
> (This might be related to the current thread about raw and ultraraw
> blocks...)
Yes, and this is indeed a very interesting case.
> {{{C
> int main () {
>    ...
> }}}
> It is easy to have a preproc rule to replace '{{{C' by some target
> dependent markup tag. (<source lang="C">  for example)

With the tagged mark you will replace {{{C by
''<source lang="C">''
and finally get something like
''<source lang="C">''
int main(){
   for(int i=0;i<10;i++){

So, you do not want escaping for the <source> tags, but you need 
escaping for the C code (eg because of the <10).

Note that if you have only C code in your document, you could also use 
the verbatim block
   printf("this is %s",strings[i]);
and postproc the <PRE> tags as <source lang="C"> tag.

Or more efficiently, you will mix the two solution above to replace
{{{C by
''<source lang="C">''
and remove any <PRE> tag.

So to conclude, back to the discussion about escaping. It seems that, 
again, maybe you can avoid to use the raw mark...


SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
txt2tags-list mailing list

Reply via email to