Hello,

> The easiest way for pretty printing code is to use a dedicated external 
> program and include the result. Like
> %!include(html): ''prettysource.html''
>
That's what I thought, and I am not a huge fan of it...

%!filter(function)
"""
...
...
"""

could be a useful addition, where "function" is a python function
defined somewhere in the preamble...


> With the tagged mark you will replace {{{C by
> ''<source lang="C">''
> """
>
Actually, I first had the """ before the <source ...> line, but it
didn't work either.
I thought it might have been because txt2tags didn't reinterpret the
filtered line...

I find this quite confusing. What exactly is the semantics of a preproc
filter?
It seems it is not
  - sed like magic on the original document (preproc),
  - tags converting (txt2tags),
  - sed like magic on the resulting document (postproc).


> Note that if you have only C code in your document, you could also use 
> the verbatim block
> and postproc the <PRE> tags as <source lang="C"> tag.
>
Well, I would need at least 2: "real Caml code" and "pseudo Caml code".
The former will probably be extracted to be automatically checked...

Right now, I use

"""
{{{Caml
...
}}}
"""

which works well...


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

Neither

%!preproc(html): '{{{C' '```\nBEGINSOURCE'
%!preproc(html): '}}}' 'ENDSOURCE\n```'

nor

%!preproc(html): '{{{C' 'BEGINSOURCE\n```'
%!preproc(html): '}}}' '```\nENDSOURCE'

seem to work.


Could it be that the string resulting from a proc rule isn't split? That
could explain why txt2tags doesn't see the starting / ending ``` or """
marks.
ZZZ...
line 4746 in the svn version. That might be it, I haven't looked at the rest...

(A possibly simpler solution might be using a different regexp for """
and such to allow them appearing in the middle of a line as long as they
have a "\n" before and some "\s*\n" after...)


Pierre
-- 
I have not failed. I've just found 10,000 ways that
won't work.
    --Thomas Alva Edison (1847-1931)

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
txt2tags-list mailing list
https://lists.sourceforge.net/lists/listinfo/txt2tags-list

Reply via email to