DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:xssnipper

xssnipper Plugin

Compatible with DokuWiki

rincewind, angua

plugin Exctract a snippet of a file and publish it on your page.

Last updated on
2012-02-10
Provides
Syntax
Repository
Source

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Similar to code, code2

Tagged with snippet

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)}

output example

Live demo examples can be found here: http://www.fristercons.de/fcon/doku.php?id=xssnipper:xssnipper#intro

Installation

Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin.
Refer to Plugins on how to install plugins manually.

Or just download and extract it as folder “xssnipper” into your “\lib\plugins” directory.

:!: External requirements:

  • none

Changes

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

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).

plugin/xssnipper.txt · Last modified: 2013-08-30 04:00 by 122.212.225.106