kind of a k1-ified version of
this.
function Page::print_linklist() {
var string header_bullet = "x "; # bullet for headers
var string link_bullet = "x "; # bullet for links
var string header_sep = "
"; # seperator between headers and links
var string link_sep = "
"; # seperator between links
var int columns = 3; # number of columns in table
# start table cell for linklist
"""
""";
if(size $.linklist > 0) {
# start table for links
"""\n""";
var int count = 0;
var int headers = 0;
var int rows = 1;
var bool section_open = false;
print " \n";
# count number of headings
foreach var UserLink m ($.linklist) {
if($m.title != "" and $m.is_heading) {
$headers++;
}
}
foreach var UserLink l ($.linklist) {
if($l.title) {
if($l.is_heading) {
if($section_open) {
print " \n \n";
}
# if it's break time, do it
if(($count >= $columns) and ($count % $columns == 0)) {
" \n";
if($count < $headers) {
" \n";
$rows++;
}
}
# print a new table cell and a heading
print """ \n $header_bullet$l.title$header_sep\n""";
$count++;
$section_open = true;
} else {
# print a link
print """$link_bullet
$l.title$link_sep\n""";
}
}
}
# close table cell
if($section_open) {
print " \n";
}
# calculate number of extra empty boxes to print to make the table pretty
if($count % $columns) {
var int post_empty = ($rows * $columns) - $headers;
foreach var int i (1 .. $post_empty) {
" \n \n \n";
}
}
" \n";
"";
}
"""
""";
}