Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Maintable templates, used in building/tracking the main content table…
… that starts in header;misc;default and continues through index;index;default and similar content templates, concluding in footer;misc;default. Allows other templates that build the content of the main table to not worry too carefully about placement of <TD> as long as they follow simple rules.
- Loading branch information
1 parent
1cb8a10
commit 5b9f762
Showing
3 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
__section__ | ||
default | ||
__description__ | ||
Template to close up the maintable. | ||
|
||
__title__ | ||
|
||
__page__ | ||
misc | ||
__lang__ | ||
en_US | ||
__name__ | ||
maintable_end | ||
__template__ | ||
|
||
[% | ||
|
||
num_rows = 0; | ||
num_cols = user.state.mt.cols.max; | ||
FOR rowcount = user.state.mt.cols; | ||
IF rowcount > num_rows; num_rows = rowcount; END; | ||
END; | ||
"<!-- num_rows (max rowcount) '"; num_rows; "' and num_cols '"; num_cols; "' curcol '"; user.state.mt.curcol; "' -->"; | ||
WHILE user.state.mt.curcol < num_cols; | ||
user.state.mt.curcol = user.state.mt.curcol + 1; | ||
IF user.state.mt.cols.${user.state.mt.curcol} < num_rows; | ||
'<TD ROWSPAN="'; | ||
num_rows - user.state.mt.cols.${user.state.mt.curcol}; | ||
'"> </TD>'; | ||
user.state.mt.cols.${user.state.mt.curcol} = num_rows; | ||
END; | ||
END; | ||
"</TR>"; | ||
need_another_row = 0; | ||
FOR rowcheck = user.state.mt.cols; | ||
NEXT IF loop.first; | ||
need_another_row = 1 IF rowcheck < num_rows; | ||
END; | ||
"<!-- need_another_row '"; need_another_row; "' -->"; | ||
IF need_another_row; | ||
"<TR>"; | ||
user.state.mt.curcol = 0; | ||
WHILE user.state.mt.curcol < num_cols; | ||
user.state.mt.curcol = user.state.mt.curcol + 1; | ||
IF user.state.mt.cols.${user.state.mt.curcol} < num_rows; | ||
'<TD ROWSPAN="'; num_rows - user.state.mt.cols.${user.state.mt.curcol}; | ||
'"> </TD>'; | ||
END; | ||
END; | ||
"</TR>"; | ||
END; | ||
|
||
%] | ||
|
||
</TABLE> | ||
|
||
__seclev__ | ||
10000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
__section__ | ||
default | ||
__description__ | ||
Template to drop in a TD for the maintable (and update state vars). | ||
|
||
* valign | ||
* align | ||
* rowspan | ||
* colspan | ||
* width | ||
|
||
__title__ | ||
|
||
__page__ | ||
misc | ||
__lang__ | ||
en_US | ||
__name__ | ||
maintable_td | ||
__template__ | ||
|
||
<TD[% | ||
IF align %] ALIGN="[% align %]"[% END; | ||
IF valign %] VALIGN="[% valign %]"[% END; | ||
IF rowspan %] ROWSPAN="[% rowspan %]"[% END; | ||
IF colspan %] COLSPAN="[% colspan %]"[% END; | ||
IF width %] WIDTH="[% width %]"[% END %]> | ||
<!-- maintable_td rowspan '[% rowspan %]' colspan '[% colspan %]' curcol_start '[% user.state.mt.curcol %]' --> | ||
|
||
[% | ||
IF !rowspan; rowspan = 1; END; | ||
IF !colspan; colspan = 1; END; | ||
curcol = user.state.mt.curcol; | ||
"<!-- curcol '"; curcol; "' colspan '"; colspan; "' -->"; | ||
WHILE colspan > 0; | ||
curcol = curcol + 1; | ||
"<!-- max '"; user.state.mt.cols.max; "' -->"; | ||
WHILE curcol > user.state.mt.cols.max; | ||
"<!-- pushing 0 -->"; | ||
user.state.mt.cols.push(0); | ||
"<!-- new max '"; user.state.mt.cols.max; "' -->"; | ||
END; | ||
"<!-- bumping col '"; curcol; "' up from '"; user.state.mt.cols.${curcol}; "' by '"; rowspan; "' -->"; | ||
user.state.mt.cols.$curcol = (user.state.mt.cols.$curcol) + rowspan; | ||
"<!-- bumped col '"; curcol; "', now cols: '"; | ||
user.state.mt.cols.1; "' '"; | ||
user.state.mt.cols.2; "' '"; | ||
user.state.mt.cols.3; "' '"; | ||
user.state.mt.cols.4; "' '"; | ||
user.state.mt.cols.5; "' -->"; | ||
colspan = colspan - 1; | ||
END; | ||
user.state.mt.curcol = curcol; | ||
rowspan = 0 | ||
%] | ||
|
||
<!-- curcol_now [% user.state.mt.curcol %], with [% user.state.mt.cols.${user.state.mt.curcol} %] rows --> | ||
|
||
__seclev__ | ||
10000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
__section__ | ||
default | ||
__description__ | ||
Template to drop in a TR for the maintable (and update state vars). | ||
|
||
* valign | ||
|
||
__title__ | ||
|
||
__page__ | ||
misc | ||
__lang__ | ||
en_US | ||
__name__ | ||
maintable_tr | ||
__template__ | ||
|
||
<TR[% IF valign %] VALIGN="[% valign %]"[% END %]> | ||
<!-- maintable_tr --> | ||
|
||
[% | ||
min_cols = 999; | ||
FOR rowcheck = user.state.mt.cols; | ||
NEXT IF loop.first; | ||
IF rowcheck < min_cols; | ||
min_cols = rowcheck; | ||
user.state.mt.curcol = loop.index; | ||
END; | ||
END | ||
%] | ||
|
||
__seclev__ | ||
10000 |