====== Horizontal Rule Syntax PlugIn ======
---- plugin ----
description: Add horizontal rules
author : Matthias Watermann
email : support@mwat.de
type : syntax
lastupdate : 2007-08-15
compatible : 2005-07-13+
depends :
conflicts :
similar :
tags : formatting
downloadurl: http://dev.mwat.de/dw/syntax_plugin_hr.zip
----
This [[#Plugin Source|plugin]] //replaces// DokuWiki's built-in horizontal rule markup.
Its main purpose is to allow for using horizontal rules inside other block elements((such as list items)).
===== Usage =====
To add a horizontal rule to your document just write at least four
consecutive dashes((or: hyphens (the minus character); ASCII char #45)) on a separate line:\\ ''%%----%%''\\
This will be replaced by the
[[http://www.w3.org/TR/html401/present/graphics.html#edef-HR|HTML HR]] tag((The ''HR'' element causes a horizontal rule to be rendered by visual user agents.
The visual appearance can be styled by CSS rules.)).
In contrast to DokuWiki's similar builtin horizontal rule markup this plugin not only ignores any leading whitespace((i.e. spaces (ASCII char #32) and TABulatator (ASCII char #9))) -- which allows for indenting markup -- but will take care of a possibly empty paragraph((generated by DokuWiki's parser/renderer)) in front of it (which gets silently removed).
===== Installation =====
Search and install the plugin using the [[plugin:extension|Extension Manager]].
Alternatively, refer to [[:Plugins]] on how to install plugins manually. It's quite easy to integrate this plugin with your DokuWiki:
- Download the [[http://dev.mwat.de/dw/syntax_plugin_hr.zip|source archive]] (~3KB) and unpack it in your DokuWiki plugin directory ''{dokuwiki}/lib/plugins'' (make sure, included subdirectories are unpacked correctly); this will create the directory ''{dokuwiki}/lib/plugins/hr''.
- Make sure both the new directory and the files therein are readable by the web-server e.g.
* Just put four (or more) consecutive hyphens (minus signs) on
* a separate line:
* The returned array holds the following fields:
*
* This method is important for correct XHTML nesting. It returns
* one of the following values:
*
* The $aState parameter gives the type of pattern
* which triggered the call to this method:
*
* The method checks for the given $aFormat and returns
* FALSE when a format isn't supported. $aRenderer
* contains a reference to the renderer object which is currently
* handling the rendering. The contents of $aData is the
* return value of the handle() method.
* (?:\s* \s*
chown apache:apache dokuwiki/lib/plugins/* -Rc
===== Plugin Source =====
Here comes the [[http://www.gnu.org/licenses/gpl.html|GPLed]] PHP source((The comments within the [[#Plugin Source|source]] file are suitable for the OSS [[http://www.stack.nl/~dimitri/doxygen/index.html|doxygen]] tool, a documentation system for C++, C, Java, Objective-C, Python, IDL and to some extent PHP, C#, and D. ---
Since I'm working with different programming languages it's a great ease to have one tool that handles the docs for all of them.)) for those who'd like to scan it before actually installing it:
syntax_plugin_hr.php - A PHP4 class that implements
* a DokuWiki plugin for horizonal rule (HR)
* elements.
*
*
==== Changes ====
__2007-08-15__:\\
* added GPL link and fixed some doc problems;
__2007-01-05__:\\
* minor changes in empty paragraph handling;
__2005-08-29__:\\
+ initial release;
//[[support@mwat.de|Matthias Watermann]] 2007-08-15//
===== See also =====
==== Plugins by the same author ====
* [[bomfix|BOMfix Plugin]] -- ignore Byte-Order-Mark characters in your pages
* [[code2|Code Syntax Plugin]] -- use syntax highlighting of code fragments in your pages
* [[deflist|Definition List Syntax Plugin]] -- use the only complete definition lists in your pages
* [[diff|Diff Syntax Plugin]] -- use highlighting of diff files (aka "patches") in your pages((obsoleted by incorporating its ability into the [[code2|Code]] plugin))
* [[hr|HR Syntax Plugin]] -- use horizontal rules in nested block elements of your pages
* [[lang|LANGuage Syntax Plugin]] -- markup different languages in your pages
* [[lists|Lists Syntax Plugin]] -- use the only complete un-/ordered lists in your pages
* [[nbsp|NBSP Syntax Plugin]] -- use Non-Breakable-Spaces in your pages
* [[nstoc|NsToC Syntax Plugin]] -- use automatically generated namespace indices
* [[shy|Shy Syntax Plugin]] -- use soft hyphens in your pages
* [[tip|Tip Syntax Plugin]] -- add hint areas to your pages
===== Discussion =====
Hints, comments, suggestions ...
> This functionality is in DokuWiki already, use four dashes (''----'') for doing an horizontal line //(an HTML ''
* ----
*
* Copyright (C) 2005, 2007 DFG/M.Watermann, D-10247 Berlin, FRG
* All rights reserved
* EMail : <support@mwat.de>
*
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
*
* @return Array Information about this plugin class.
* @public
* @static
*/
function getInfo() {
return array(
'author' => 'Matthias Watermann',
'email' => 'support@mwat.de',
'date' => '2007-08-15',
'name' => 'Horizontal Rule Syntax Plugin',
'desc' => 'Add HTML Style Horizontal Rule [ ---- ]',
'url' => 'http://www.dokuwiki.org/plugin:hr');
} // getInfo()
/**
* Define how this plugin is handled regarding paragraphs.
*
*
*
* @return String 'block'.
* @public
* @static
*/
function getPType() {
return 'block';
} // getPType()
/**
* Where to sort in?
*
* @return Integer 6.
* @public
* @static
*/
function getSort() {
// class 'Doku_Parser_Mode_hr' returns 160
// class 'Doku_Parser_Mode_listblock' returns 10
// class 'syntax_plugin_lists' returns 8
return 6;
} // getSort()
/**
* Get the type of syntax this plugin defines.
*
* @return String 'substition' (i.e. 'substitution').
* @public
* @static
*/
function getType() {
return 'substition'; // sic! should be __substitution__
} // getType()
/**
* Handler to prepare matched data for the rendering process.
*
*
*
* @param $aMatch String The text matched by the patterns.
* @param $aState Integer The lexer state for the match.
* @param $aPos Integer The character position of the matched text.
* @param $aHandler Object Reference to the Doku_Handler object.
* @return Integer The current lexer state for the match.
* @public
* @see render()
* @static
*/
function handle($aMatch, $aState, $aPos, &$aHandler) {
return $aState;
} // handle()
/**
* Handle the actual output creation.
*
*
'
: preg_replace('|\s*
';
} // if
return TRUE;
} // render()
//@}
} // class syntax_plugin_hr
} // if
//Setup VIM: ex: et ts=2 enc=utf-8 :
?>