on top10 (adroutline) {
«Changes
«12/16/03; 12:30:14 PM by DW
«Created. Renders an outline as a Top-10 list, as illustrated here:
«http://top10.scripting.com/whyRssRules
local (pta = html.getpagetableaddress ());
local (ctsummits = op.countsummits ());
local (fontopen = "");
local (itemnum = ctsummits);
bundle { //see if we can get itemnum from the getargs
try {
local (getargs);
new (tabletype, @getargs);
webserver.parseArgs (pta^.searchArgs, @getargs);
if defined (getargs.item) {
itemnum = number (getargs.item);
if itemnum > ctsummits {
itemnum = ctsummits};
if itemnum < 1 {
itemnum = 1}}}};
local (htmltext = "", indentlevel = 0);
on add (s) {
htmltext = htmltext + string.filledstring ("\t", indentlevel) + s + "\r"};
op.firstsummit ();
op.go (down, infinity);
op.go (up, ctsummits - itemnum);
local (ix = itemnum);
if itemnum > 1 {
add ("Reason #" + (itemnum - 1) + ": " + pta^.title + "
")};
add ("
| " + fontopen + ix++ + ". | " + fontopen + op.getlinetext () + " |