Color Plugin
Informazioni generali
Questo plugin consente di formattare il testo specificato come se fosse la console di linux.
Sito: http://www.dokuwiki.org/plugin:cli
This plugins brings a Command Line Interface formatter to DokuWiki allowing you to format the output of a transcript say for a user manual or on-line tutorial. It is designed to work with the output of a standard Unix Bash Shell, but should be suitable to document other kinds of CLI interaction, e.g. Windows Command Window, Python and Ruby, Matlab, etc.
The assumptions made are
- all user commands start with a prompt
- the CLI prompt will end in a recognizable character (typically '$' or '>')
- user commands will follow the CLI prompt on the same line
- lines that do not start with a prompt are outputs from the CLI1)
A key design feature is that it should be possible to display a CLI transcript (e.g. output from a history file or copy of text from a console window) for display with the mimumum of additional markup.
It is possible to adjust the style of the display using a style sheet. For details refer to style.css.
Acknowledgements
A similar feature is to be found in MoinMoin Wiki and TiddlyWiki. The styles are based on those developed for the UNIX Tutorial for Beginners by Michael Stonebank. The plugin and its documentation are based on lessons learned from the Plugin Tutorial and Christopher Smith's implementation and documentation of the boxes plugin.
Several improvements suggested by Stephane Chazelas and Andy Webber.
Syntax
A simple Bash Shell interaction:
<cli> user@host:~/somedir $ ls # List current directory conf lang README screen.gif ui info.txt manager.dat renderer.php syntax.php user@host:~/somedir $ </cli>
Should be rendered:
<pre class="cli"> <span class="cli_prompt">user@host:~/somedir $</span> <span class="cli_command">ls</span> <span class="cli_comment"># List current directory</span> <span class="cli_output">conf lang README screen.gif ui</span> <span class="cli_output">info.txt manager.dat renderer.php syntax.php</span> <span class="cli_prompt">user@host:~/somedir $</span> </pre>
The full syntax:
<cli prompt='prompt ' comment='comment'> transcript </cli>
- comment — [optional] the comment string used by the CLI. If omitted, '#' is assumed 4).
- continue – [optional] the prompt used for continuation markers: regex '/^> /' is the default.
- The defaults above match Bourne shell ${PS1} and ${PS2} prompts and comments
The opening <cli … > must all appear on one line. The transcript contents can appear over as many lines as are needed.
Esempi
Code
<cli> user@host:~/somedir $ ls # List current directory conf lang README screen.gif ui info.txt manager.dat renderer.php syntax.php user@host:~/somedir $ </cli>
<cli prompt="$"> $ rpm -ivh darcs-1.0.9-3.fc6.i386.rpm Preparing... ########################################### [100%] 1:darcs ########################################### [100%] </cli>
Result
user@host:~/somedir $ ls # List current directory conf lang README screen.gif ui info.txt manager.dat renderer.php syntax.php user@host:~/somedir $
$ rpm -ivh darcs-1.0.9-3.fc6.i386.rpm Preparing... ########################################### [100%] 1:darcs ########################################### [100%]

