Welcome, Registration, and other StartingPoints; TWiki history & Wiki style; All the docs...

GluePlugin

Description

Powered by
WikiRing Consultants
This plugin will help you to write readable markup (TWikiMarkup, HMTL, ...) within TWiki by allowing tags and arguments to be formatted on multiple lines. This is done by removing whitespaces surrounding tilde characters at the beginning of a line and recombine consecutive lines again. Basically, there are two ways of glueing and recombining lines by either removing all whitespaces between two lines using %*~~ or by removing all whitespaces and separateing lines with a single space using %~~~. There's a helper character sequence %~~ that prevents the TWiki engine to interprete tags before the GluePlugin could reformat the text. In addition there's a glue sequence #~~ to insert comments within a TWikiMarkup expression.

While these glue sequences might feel strange at the beginning they help you to format and recognize your markup and make it more readable. That way you will be able to format a TWikiApplications that looked like this

%SEARCH{"..." type="query" header="<table width="100%" border="5px"><thead><tr><th>Name</th><th>Description</th><th>Date</th></tr></thead>" format="<tr><th>$formfield(Name)</th><th>$summary</th><th>$createdate</th></tr>" footer="</table>"}%

somewhat like this

#~~ #################################
#~~ # This is my new TWikiApplication
~~~
%~~ SEARCH{
#~~ #################################
#~~ # this is the search expression
~~~   "..."
~~~
~~~   type="query"
~~~
#~~ #################################
#~~ # this is the header of the result table
~~~ 
~~~   header="
~~~      <table
~~~        width="100%"
~~~        border="5px"
~~~      >
~~~      <thead>
~~~        <tr>
~~~          <th>Name</th>
~~~          <th>Description</th>
~~~          <th>Date</th>
~~~        </tr>
~~~      </thead>"
#~~ #################################
#~~ # every row will be formatted like this
~~~
~~~   format="
~~~      <tr>
~~~        <th>$formfield(Name)</th>
~~~        <th>$summary</th>
~~~        <th>$createdate</th>
~~~      </tr>"
#~~ #################################
#~~ # and finally we close this html table
~~~
~~~   footer="</table>"
~~~ }%
#~~ #################################
#~~ # sure we could have used 
#~~ # | TWikiTables | as well |
#~~ # but these aren't robust against newlines
#~~ # in the $summary field
#~~ #################################

Syntax

Line prefixdown Action
~~~<space> combine lines by removing all, insert one whitespaces
*~~<space> recombine lines by removing any whitespaces between them
%~~<space> escape tag interpretation
#~~<space> comment line, all chars on the same line are removed

The <space> is a literal whitespace blank. The ~~~<space> and *~~<space> sequences are recognized only at the beginning of a line, whereas the %~~<space> escape sequence might appear everywhere. The basic anatomy of writing a TWiki tag using the GluePlugin is exemplified by

%~~ TAG{
~~~ key="
*~~      hello
~~~      world
*~~ "
~~~ }%
which will be recombined to
%<nop>TAG{ key="hello world" }%

Examples

You type:
This is a line
~~~ glued to another line.
You get (faked):
This is a line glued to another line.
You get if installed:
This is a line glued to another line.

You type:
Glue
*~~ Plugin
You get (faked):
GluePlugin
You get if installed:
GluePlugin

You type:
Apples

~~~  

And

~~~

Oranges
You get (faked):
Apples And Oranges
You get if installed:
Apples And Oranges

You type:
%~~ SEARCH{"GluePlugin"
~~~        nosearch="on" nosummary="on" nototal="on"
~~~        separator=", "
~~~        scope="topic"
~~~        format="$topic"
~~~ }%
You get (faked):
GluePlugin
You get if installed:
GluePlugin

Plugin Installation Instructions

  • Download the ZIP file
  • Unzip it in your twiki installation directory. Content:
    File: Description:
    data/TWiki/GluePlugin.txt  
    lib/TWiki/Plugins/GluePlugin.pm  
    pub/TWiki/GluePlugin/wikiringlogo40x40.png  

  • Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.
  • Set the plugins evaluation order to put the GluePlugin in first position, e.g.
    $TWiki::cfg{PluginsOrder} = 'GluePlugin,IfDefinedPlugin,SpreadSheetPlugin';
  • If the plugin is installed correctly then the following two fruits will appear joined on one line: Apples and Oranges

Plugin Info

Plugin Author: TWiki:Main.MichaelDaum
Copyright ©: 2005-2007, Michael Daum http://michaeldaumconsulting.com
License: GPL (GNU General Public License)
Plugin Version: v2.00
Change History:  
23 Nov 2007: added way to add comments in the middle of a TWikiMarkup expression
31 Aug 2006: added NO_PREFS_IN_TOPIC
28 Jul 2006: fixed MANIFEST; some minor docu updates; added use strict;
28 Aug 2005: changed glue syntax; added glue escape sequence to work arround tags been interpreted before lines are recombined
16 Aug 2005: properly support internal tags; performance improvements; fixed use if uninitialized value
15 Aug 2005: Initial version
TWiki Dependency: $TWiki::Plugins::VERSION 1.024
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
TWiki:Plugins/Benchmark: GoodStyle nn%, FormattedSearch nn%, GluePlugin nn%
Plugin Home: TWiki:Plugins/GluePlugin
Feedback: TWiki:Plugins/GluePluginDev
Appraisal: TWiki:Plugins/GluePluginAppraisal

-- TWiki:Main.MichaelDaum - 23 Nov 2007

Go

Navigation

Webs Webs

Attachments Attachments

  Attachment Action Size Date Who Comment
png wikiringlogo40x40.png props, move 2.5 K 23 Nov 2007 - 15:03 TWikiAdminGroup Saved by install script
r2 - 03 Jan 2008 - 18:46:13 - TWikiAdminGroup
This site is powered by the TWiki collaboration platform.
All material on this collaboration platform is the property of the contributing authors.
All material marked as authored by Eben Moglen is available under the license terms CC-BY-SA version 4.
Syndicate this site RSSATOM