Roxen.git
/
server
/
modules
/
tags
/
indirect_href.pike
version
»
Context lines:
10
20
40
80
file
none
3
Roxen.git/server/modules/tags/indirect_href.pike:1:
-
// This is a
virtual
"file-system"
.
-
//
It
will
be
located
somewhere
in
the
name-space
of
the
server
.
+
// This is a
roxen
module
.
(c) Informationsvvarna AB 1996.
+
+
//
This
module
makes
it
possible
to
write
symbolic
names instead
of
+
//
absoulte
hrefs
.
+
// Written by Mattias Wingstedt, <wing@infovav.se>, please refer
+
// to him for further info.
+
#include <module.h> inherit "module"; inherit "roxenlib"; mapping hrefs; string tagname; void create() { defvar( "hrefs", "", "Indirect hrefs", TYPE_TEXT_FIELD,
-
"Syntax:\n"
-
+
"[name] = [URL]\n" );
+
"Syntax:
<br>
\n"
+
"[name] = [URL]\n" );
+
defvar( "tagname", "newa", "Tagname", TYPE_STRING, "Name of the tag\n"
-
+
"<tag name=[name]>foo</tag> will be replaced with\n"
-
+
"<a href=[URL]>foo</a>" );
+
"<tag name=[name]>foo</tag> will be replaced with\n"
+
"<a href=[URL]>foo</a>" );
}
-
mixed
*
register_module()
+
array (
mixed
)
register_module()
{
-
return ({
-
MODULE_PARSER,
-
"Indirect href",
-
(
"Indirect href"
)
-
});
+
return ({ MODULE_PARSER, "Indirect href", "Indirect href"
,
});
} void start() {
-
string
*
lines, line;
-
string variable, value
, *foo
;
+
array (
string
)
lines,
foo;
+
string
line;
+
string variable, value;
string dir = ""; mapping all = ([ ]); hrefs = ([ ]); if (lines = query( "hrefs" ) /"\n") foreach (lines, line) if (sscanf( line, "%s=%s", variable, value ) >= 2) hrefs[ variable - " " - "\t" ] = value - " " - "\t"; tagname = query( "tagname" ); }