Hi perceps users,
I'm getting very near to finishing some C to HTML templates, but I've
run into error processing if's within foreach loops.
I have loops like
{foreach typedef sort "$a cmp $b;"}
{if first}
<h3 class=toc-section-title><a
name="types">Types</a></h3>
<ul>
{endif}
<li>
<p><span class=toc-entry><a
href="#type-{name}"><strong>{name}</strong></a></span><br>
<span class=toc-summary><em>{brief}</em></span></p>
</li>
{if last}
</ul>
{endif}
{next}
to generate the table of contents. The first or last directive is
skipped, apparently at random, leading to lists within lists that crawl
towards the right of the screen. It's probably my stupidity, but I've
been staring at it too long to see what's wrong. Either that or it's
gremlins. Or there is a bug in Perceps. Attached below is the full
template. I plan to release these soon, in case anyone is interested.
I'm also curious about the Perceps replacement under development. What's
this projects hackability? As a side-note, it seems that a real parser
would be a good thing. Regexp only go so far (which admittedly is quite
far), but they inevitably reach limitation as seen with Emacs cc-mode.
Thanks in advance,
Noel
---
{keephtml}
Description of {module}
Documentation |
{module} |
macros types variables functions
{foreach macro} {if name /MODULE/}{brief}
{detail}
{endif} {next}{name}
{brief}
{name}
{brief}
{name}
{brief}
{name}
{brief}
public {name}
{brief}
{detail}
private {name}
{brief}
{detail}
public {name}
{brief}
{detail}
private {name}
{brief}
{detail}
public {name}
{brief}
{detail}
private {name}
{brief}
{detail}
public {type} {name}({args})
{brief}
{if return}{return}
{endif} {if see}{see}
{endif}{detail}
private {type} {name}({args})
{brief}
{if return}{return}
{endif} {if see}{see}
{endif}{detail}