Source Code for user.html.renderers.faqman
on faqman (adroutline) {
«faqman © 1999 by Philip Suh.
«Terms of Use:
«Permission granted to use and redistribute this script
«only if this documentation and copyright statement are
«included and unmodified. Use of this script is governed
«by the full copyright statement, available from the Script Archive.
«From the filsa.net Frontier Script Archive:
«Full documentation, updates, and other scripts are available from
«http://www.filsa.net/frontier/scripts/
«Docs - Mon, Jan 25, 1999 at 2:01:16 PM by PS
«this is sample code :) modify to taste
«call from your OUTLINE type html page w/
«#renderOutlineWith "faqman"
local (s, ttr, oldTarget, oldDisplay);
local (qlist={}, alist={}, oneAnswer="", ct, i);
on add (x) {
ttr = ttr + x + cr};
bundle { // build question and answer lists
oldTarget = target.set (adrOutline);
oldDisplay = op.getdisplay ();
op.setDisplay (false);
op.firstsummit ();
op.fullExpand ();
loop {
s = op.getlinetext ();
if op.level () == 1 {
if s == "" || script.iscomment () { // skip blank, commented summits
if not op.go (down, 1) {
break};
continue};
if oneAnswer != "" {
alist[0] = oneAnswer;
oneAnswer = ""};
qlist[0] = s}
else {
oneAnswer = oneAnswer + s};
if not op.go (flatdown, 1) {
break}};
op.setDisplay (oldDisplay);
try {target.set (oldTarget)};
alist[0] = oneAnswer}; // grab the last answer
bundle { // format output
ct = sizeOf (qlist);
for i = 1 to ct { // top question index links
add ("<a href=\"#faq" + string.padwithzeros (i, 4) + "\">");
add ("Q" + i + ": ");
add (qlist[i] + "</a><br>" + cr)};
bundle { // middle formatting
add ("<br><p>" + cr + "<br><p>" + cr +cr)};
for i = 1 to ct { // Q&A main text
add ("<p>");
add ("<a name=\"faq" + string.padwithzeros (i, 4) + "\">");
add ("<b>Q" + i + ": ");
add (qlist[i] + "</b></a><br>" + cr );
add (" <blockquote>");
add (string.davenetmassager (4, 80, alist[i]) );
add (" </blockquote>" + cr + "</p>" + cr )}};
return (ttr)};
bundle { //test code
local (adr);
adr = @websites.filsa.frontier.scripts.WeirdMacros.faqrenderer;
local (outline);
local (datatable); new (tabletype, @datatable);
outline = adr^;
html.runoutlinedirectives (@outline, @datatable);
s = faqman (@outline);
webbrowser.displaytext ("<html><body>" + s + "</body></html>")}
Go back to the main page for this script