Page History

Turn Off History

Custom Markup Cookbook

This is just a rough idea of things that can be done via the custom markup functionality of #301 and #405. It'll be a work in progress.

HTML Markup Shortcuts

Rather than having to do things like <html><big>text</big></html>, you can define markups as shortcuts (the HTML would go in the custom formatter section):

Emulating Other Wikis

Many other Wiki styles implement something like [wiki:page description]. This can be easily done with a {wiki: page description} markup using as a formatter <a href="wiki?p=%k">%a</a>.

This can also be combined with an {anchor: name} markup (which just formats as <a name="%k">) to link to different parts of a wiki page. That is, {wiki: page#anchorname} would cause the browser to skip right to the {anchor:anchorname} markup in the given page.

Want a link into the CVS repository without a cumbersome URL? {getfile cvstrac/main.c} with <a href="getfile?f=%k"><tt>%x</tt></a>. The %x substitution allows you to use things like {getfile cvstrac/main.c} or {getfile cvstrac/main.c CVSTrac's main.c}.

Some wikis implement "verbatim" blocks. This can easily be done with two separate custom markups, {verbatim} and {endverbatim} which respectively generate <PRE> and </PRE> HTML tags. For contrast, {verbatim} can use a inline style tag to generate an off-white background such as <PRE STYLE="background: #e8e8e8">.

External Resources

Most external resources will simply be markups as convenient links. The advantage of using a custom markup rather than {link:} markups or straight HTML is that if a service changes, you only have to change the custom markup.

CPAN module? {cpan: module} using <a href="http://search.cpan.org/?query=%k">%x</a>.

An external resource section wouldn't be complete without {google: search terms} with <a href="http://google.com/?q=%k %a">%k %a</a>.

Program Markups

It's possible to write custom markups that call external programs. This isn't always a good idea (from a performance and security perspective), but it may be the only way to do some things. Note that some of these examples are simply that, examples, and have not be exhaustively auditted from a security perspective.

Trvial examples are markups which just run a command and spit out information. Date/time stamps, system information, etc. For example, a trivial {timestamp} markup would simply use /bin/date as a formatter with no substitution arguments.

A more complicated example is a markup to inline something from the CVS repository into the wiki page, such as {include: cvstrac/main.c}. Using the formatter /path/to/include '%r/%k', the following script could be used to inline the latest version of any file found under the repository:

  #!/bin/sh        
  FILE=`/bin/echo $1 | /bin/sed 's/\.\.//g'`        
  /bin/cat <<END        
  <pre style="background: #e8e8e8">        
  `/usr/bin/co -q -p $FILE,v 2>/dev/null`        
  </pre>        
  END

Attachments: