Skip to content

Instantly share code, notes, and snippets.

@dr-kd
Created February 11, 2011 01:55
Show Gist options
  • Save dr-kd/821783 to your computer and use it in GitHub Desktop.
Save dr-kd/821783 to your computer and use it in GitHub Desktop.
[%- MACRO render_submenu(node) BLOCK -%]
[%- FOREACH item IN node.getAllChildren -%]
-[% NEXT IF item.getNodeValue == "descr.txt" %]
+[% NEXT IF item.getNodeValue == 0 %]
<li> [% print_metadata(node) %]
-[% IF item.getAllChildren.size %] <ul> [% render_submenu(item) %] </ul> [% END %] </li>
-[%- END -%]
+[% IF item.getAllChildren.size %] <ul> [% render_submenu(item) %] </ul>
+[% ELSIF item.getNodeValue !=0 %] <li> [% render_node(item) %] [% END %]
+[% END %] </li>
[%- END -%]
</ul>
[% MACRO print_metadata(node) BLOCK -%]
[% FOREACH i IN item.getAllChildren %]
-<li id="[% i.getNodeValue() %]"><h3>[% i.getMetaDataFor('description') %]</h3>
-<form action="[% c.uri_for(annotate_code, i.getNodeValue()) %]" method="get">
+[% render_node(i) %]
+</li>
+[% END %]
+[% END %]
+
+[% MACRO render_node(x) BLOCK %]
+<li id="[% x.getNodeValue() %]"><h3>[% x.getMetaDataFor('description') %] </h3> ([% x.getNodeValue() %]).
+<form action="[% c.uri_for(annotate_code, x.getNodeValue()) %]" method="get">
[% FOREACH group IN groups; SET row = loop.index %]
[% FOREACH g IN group %]
<input type="checkbox" name="[% row %]" value="[% g %]">[% g %]</input>
[% END %]
<br>
[% END %]
-<input type="submit" value="Annotate '[% i.getMetaDataFor('description') %]'">
+<input type="submit" value="Annotate '[% x.getMetaDataFor('description') %]'">
</form>
-</li>
[% END %]
-[% END %]
-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment