Table of Contents
xsSnipper Plugin
Compatible with DokuWiki
Rincewind, Angua
Feature Overview
This is a very small and simple plugin to place defined snippets of a file onto your page or just output a code snipped with line numbering.
This plugin delivers following:
- code snippets directly from files or just copy-paste a code block
- code line numbering
- direct link of commands to online descriptions (e.g. php.net)
- downloadable code blocks
- css supported box style
- add code buttons to the Editor Toolbar
Demo: http://www.fristercons.de/fcon/doku.php?id=xssnipper:xssnipper
Syntax
Case 1: Standard code snipped
The following syntax does apply: {(xssnipper>,[start line],[code language] [code block file] [slide],[ code ])}
where [ code ] is the snipped you want to show.
Syntax Example (no slide):
{(xssnipper>,1,php test, // 1. check if $xssnipper['filepath'] exist, else error message if(!file_exists($xssnipper['filepath'])) { msg('file '.$xssnipper['filepath'].' not found',-1); return false; } )}
Case 2: Code snipped from file
The following syntax does apply: {(xssnipper>[PATH],[from line],[to line],[code language] [code block file] [slide])} \\.
Parameter | Necessity | Meaning |
---|---|---|
[PATH] | mandatory | specifies the file where content to be picked up |
[from line] | optional | defines the first line to be displayed, if empty it will be set to zero; if further parameter will be given at least the colon separator to be written |
[to line] | optional | defines the last line to be displayed, if empty it will be set to end of file; if further parameter will be given at least the colon separator to be written |
[code language] | optional | tells code block/GeSHi what language file to be used for coloring, file extension of the [path] parameter will be used if empty |
[code block file] | optional | enables the download cod blocks feature and specifies the file name, if empty no downloadable code block provided. (file name must not contain space character !) |
[slide] | optional | enables the view/hide (slide) function of the code block. Any value will switch on this function (e.g. 1 or on or slide). If set the code will be hidden initially. |
Simply place syntax like following into your page markup:
{(xssnipper>./lib/plugins/xssnipper/plugin.info.txt,1,5,txt test.txt)}
The snippets are displayed with Syntax Highlighting of DokuWiki (GeSHi).
The following example visualize it for better understanding:
{(xssnipper>./lib/plugins/xssnipper/syntax.php,85,104,php)}
Live demo examples can be found here: http://www.fristercons.de/fcon/doku.php?id=xssnipper:xssnipper#intro
Installation
Search and install the plugin using the Extension Manager.
Alternatively, refer to Plugins on how to install plugins manually. Or just download and extract it as folder “xssnipper” into your “\lib\plugins” directory.
Changes
- register controller & handler (2016-06-02 10:55)
- version compatibility and minor improvement (2012-06-22 19:44)
- small modification (2012-06-22 13:48)
- NewFeature: view/hide option for code block (2012-06-22 13:08)
- New Features: standard code blocks and Toolbar Buttons (2012-02-10 21:23)
- New Features: code line numbering, css supported box style, optional … (2012-01-18 16:26)
- initial version of xsSnipper (2012-01-15 18:02)
Configuration
not necessary
Known Bugs and Issues
Please visit the xsSnipper IssueTracker.
ToDo/Wish List
Please let me know if there is a need to extend the functionality to paste code directly into the page syntax as alternative to loading from a file.
To send us your wishes you may use xsSnipper IssueTracker or our Contact form.
Sites using this Plugin
Feel free to add yours here:
FAQ
Please check FAQ section on xsSnipper home.
Discussion
Please use only the DokuWiki Forum for discussion and xsSnipper IssueTracker to raise your problems. You can mention it here but this page is not regularily tracked and if something is solved it will be cleaned from this page (better to use the forum due to automated notifications on an issue).