Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 53 by [email protected]: Allow PreProc to generate multiple
input lines
http://code.google.com/p/txt2tags/issues/detail?id=53
The attached small patch allows PreProc statements to generate multiple
input lines.
I.e. each line of the output generated by the PreProc is processed as if it
were a separate input line (and not 1 line containing '\n' characters).
This allows you to do things that are otherwise difficult or impossible.
It uses '\f' (form-feed) in the output expression as the line separator so
as not to break existing PreProcs that may already use '\n'.
Please feel free to include this in txt2tags.
Examples:
Desc: Generate two output elements from a single input line.
File: Split1.t2t
Split1
%!preproc: 'NOTE{([^,]+),\s*([^}]+)}' '== \1 ==\f \2'
NOTE{A Note, Content of a note.}
Cmd: txt2tags -i Split1.t2t -o- -t xhtml --no-headers
Output:
<h2>A Note</h2>
<blockquote>
Content of a note.
</blockquote>
--------------------
Desc: PostProc this to make a table's title appear in the TOC.
File: Split2.t2t
Split2
%!preproc: 'TABLE{(\w+),\s*([^}]+)}' '== \2 ==[\1]\f| \2 |'
TABLE{tbl1, Heading and Table Title}
| Table contents |
Cmd: txt2tags -i Split2.t2t -o- -t xhtml --no-headers
Output:
<a id="tbl1" name="tbl1"></a>
<h2>Heading and Table Title</h2>
<table border="1" cellpadding="4">
<tr>
<td>Heading and Table Title</td>
</tr>
<tr>
<td>Table contents</td>
</tr>
</table>
--------------------
Desc: Four line list example.
File: Split3.t2t
Split3
%!preproc: 'LIST{(.+),(.+),(.+),(.+)}' ' - \1\f - \2\f - \3\f -
\4\f\f'
LIST{one,two,three,four}
Cmd: txt2tags -i Split3.t2t -o- -t xhtml --no-headers
Output:
<ul>
<li>one
</li>
<li>two
</li>
<li>three
</li>
<li>four
</li>
</ul>
Attachments:
PreProc Split r297.patch 666 bytes
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
txt2tags-list mailing list
https://lists.sourceforge.net/lists/listinfo/txt2tags-list