Roxen.git / server / modules / examples / fnord.pike

version» Context lines:

Roxen.git/server/modules/examples/fnord.pike:1:   // This is a small sample module. It is intended to show a simple example   // of a container.    - // This variable is shown in the configinterface as the varion of the module. - string cvs_version = "$Id: fnord.pike,v 1.5 1998/03/08 13:48:48 per Exp $"; + // This variable is shown in the configinterface as the version of the module. + string cvs_version = "$Id: fnord.pike,v 1.6 1999/12/14 01:47:21 nilsson Exp $";      // Tell Roxen that this module is threadsafe. That is there is no   // request specific data in global variables.   int thread_safe=1;    -  + // Include and inherit code that is needed in every module.   #include <module.h>   inherit "module";         // Documentation:      // The purpose of this module is to allow comments in the SPML source   // that are invisible to average viewers, but can be seen with the   // right magic incantation. Fnord! The special text is rendered in   // the "sample" font, if available, which makes it possible for
Roxen.git/server/modules/examples/fnord.pike:50:   // This server <FNORD ALT="provides">will provide, when we   // actually get to it,</FNORD> complete source for the ...      // The way the normally hidden text is made visible is by including   // "fnord" in the prestates (i.e. add "/(fnord)" before the "filename"   // part of the URL).      // Michael A. Patton <map@bbn.com>       + // This is the code for the actual container. By naming it "container_" + // it is automatically recognized by Roxen as the code for a container + // tag and is registered in its list of container tags.    - array register_module(); -  -  +    // First, check the 'request_id->prestate' multiset for the presence   // of 'fnord'. If it is there, show the contents, otherwise, if there   // is an 'alt' text, display it, if not, simply return an empty string    - string tag_fnord(string tag, mapping m, string q, object request_id ) + string container_fnord(string tag_name, mapping arguments, string contents, +  RequestID id )   { -  if(m->help) // This is a standard argument. -  return register_module()[2]; -  if (request_id->prestate->fnord) -  return "<SAMP>"+q+"</SAMP>"; -  else if (m->alt) -  return m->alt; -  else +  if (id->prestate->fnord) +  return contents; +  if (arguments->alt) +  return arguments->alt;    return "";   }         // This function is needed in _all_ modules. The first index in the   // resulting array is the type of the module, the second is the 'short name',   // the third is a documentation string, the next is reserved, and the last one   // indiceates wheter or not there can be more than one of this module   // active in any virtual server at any time. If it is 0, there can be more   // than one, othervise not. This is a 'one of a kind' module, only one   // copy of this module can be included in any virtual server at any time.      array register_module()   {    return ({ MODULE_PARSER,    "Fnord!", -  ("Adds an extra container tag, 'fnord' that's supposed to make " +  ("Adds an extra container tag, &lt;fnord&gt; that's supposed to make "    "things invisible unless the \"fnord\" prestate is present."    "<p>This module is here as an example of how to write a " -  "very simple RXML-parsing module."), +  "very simple RXML-parsing module.</p>"),    0, 1    });   }    - // This is nessesary functions for all MODULE_PARSER modules. - mapping query_container_callers() { return (["fnord":tag_fnord,]); } +     -  + // Last, but not least, we want a documentation that can be integrated in the + // online manual. The mapping tagdoc maps from container names to it's description. +  + TAGDOCUMENTATION; + #ifdef manual + constant tagdoc=(["fnord":#"<desc cont>The fnord container tag hides its " +  "contents for the user, unless the fnord prestate is used.</desc>" +  "<attr name=alt value=string>An alternate text that should be written " +  "in place of the hidden text.</attr>"]); + #endif