====== xterm plugin ======
---- plugin ----
description: documenting xterminal output without forcing linefeeds
author : Tom Trenker
email : tom_trenker@yahoo.com
type : syntax
lastupdate : 2006-08-26
compatible :
depends :
conflicts :
similar : cli, code
tags : formatting, code
----
===== Description =====
This plugin is intended to allow users to easily document the output of x-terminals
by cutting and pasting directly to the the wiki edit window, without adding line feeds.
DokuWiki formatting options (bold, italic, etc...) can be applied to the text.
===== CascadingStyleSheet =====
To show the xterm text a CSS class needs to be defined. Add the following CSS to a new file ''/lib/plugins/xterm/style.css'' which will be automatically included when the plugin is loaded (recommended method), or add it to your existing ''/lib/tpl/default/design.css'':
.xterm {
font-family:MiscFixed;
white-space:pre;
}
===== Plugin =====
Put the following PHP file in /lib/plugins/xterm/syntax.php
text
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Tom Trenker
===== Discussion =====
* This is my first attempt at a DokuWiki plugin, and although it works for fine for my purposes, I'm sure it could be written more cleanly. Please feel free to comment or point out my errors.[[tom_trenker@yahoo.com | Tom Trenker]]
* Would it be better to allow any formatting within the xterm by instead of matching the whole lot in DOKU_LEXER_UNMATCHED to use the rest of the state cases as normal and have getAllowedTypes return array('formatting') ? I'd like to have italics too for example. -- [[mib@post.com | Mike Battersby ]]
* I tried your suggestion. It seems to work well. See the above code. [[tom_trenker@yahoo.com | Tom Trenker]]
* I'd strongly suggest to generate //valid// XHTML code. Not only is the ''FONT'' tag deprecated for ages (and not allowed at all in XHTML, see [[http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-strict.dtd|XHTML1 DTD]]), but also all tag attributes have to be enclosed in quotes (either single or double quotes). [[support@mwat.de|Matthias Watermann]]
> I think replacing the //'; #
';
}
return true;
}
return false;
}
}
//Setup VIM: ex: et ts=4 enc=utf-8 :
?>
';
} else if ($data[1] == DOKU_LEXER_UNMATCHED){
$renderer->doc .= $renderer->_xmlEntities($data[0]);
} else if ($data[1] == DOKU_LEXER_EXIT){
$renderer->doc .= ''; # '
// with ////, and dropping the //// will bring the code into XHTML compliance. [[ronaldb64@gmail.com|Ronald Bruintjes]] * there seems to be a bug in that formatting markup tries to span %%%% blocks. E.g., if you have %%) is no longer recognised. The exit pattern won't be a recognizable pattern until either that mode is entered again or we exit the new mode. --- //[[chris@jalakai.co.uk|Christopher Smith]] 2006-01-05 12:09// * How i can change the background color of box ? //[[cellia@scmgroup.NO-SPAM.com|Alessandro Celli]] 2006-06-21 15:20// * You can modify style.css to achieve a number of effects. The following is copied from the file tag:then the whole lot will be merged into one xterm block. :( -- [[mib@post.com | Mike Battersby ]] * You're right, this is a serious bug. I tried a few changes with no success. I'm hoping that I might be able to fix the problem with a different addEntryPattern. Any suggestions would be appreciated. [[tom_trenker@yahoo.com | Tom Trenker]] * I think this is a wiki bug in general rather than with xterm. For example, if you put %%//%% into one list item and another %%//%% into a later list item, the two will be merged. It might be to do with the URL detection code. Perhaps you can lodge this as a wiki bug? -- [[mib@post.com | Mike Battersby ]] > No its not (really) a bug and its not related to URL detection. DokuWiki doesn't verify that your markup makes sense. Markup must be properly nested to work correctly in all circumstances. So the correct markup isthis has // two slashes some text hereanother two // slashes in later block Now nesting is correctly preserved. In technical terms, when you enter a new formatting mode (e.g. %%//%%) the exit pattern of the earlier mode (e.g. %%this has // two slashes// // some text here ////another two // slashes in later block /* code blocks by xterm tag */ div.dokuwiki pre.xterm { font-family:MiscFixed; white-space:pre; padding: 0.5em; border: 1px dashed __medium__; color: Black; background-color: __medium__; overflow: auto; }* xterm does not support the embedded HTML? i have try to use this: CHOOSE //[[cellia@scmgroup.NO-SPAM.com|Alessandro Celli]] 2006-06-22 12:08// * I updated the xterm plugin to work with DokuWiki-2006-03-09.tgz, and I also implemented the use of CSS which will hopefully ensure XHTML compliance. [[tom_trenker@yahoo.com | Tom Trenker]] 2006-08-27 * 20060913: I made a minor modification to syntax.php to disable typography substitution by removing 'substition' from the getAllowedTypes() function call.[[tom_trenker@yahoo.com | Tom Trenker]] ---- Hi thank you very much for this plugin. Here is a possible design for a real terminal look: /lib/tpl/YOUR_TEMPLATE/layout.css/* code blocks by xterm tag */ div.dokuwiki pre.xterm { font-family:"Lucida Console",Monospace,"DejaVu Sans Mono","Courier New",MiscFixed; font-size: 12px; white-space:pre; padding: 0.5em; border: 2px solid #000000; color: #FFFFFF; background-color:#3F3F3F; overflow: auto; }/lib/plugin/xterm/style.css.xterm { font-family:"Lucida Console",Monospace,"DejaVu Sans Mono","Courier New",MiscFixed; font-size: 12px; white-space:pre; padding: 0.5em; border: 2px solid #000000; color: #FFFFFF; background-color:#3F3F3F; overflow: auto; }Best regards, \\ Gürkan (have a look at our [[http://pardususer.de/dokuwiki/doku.php?id=playground:playground#konsolenausgabe|playground]] - there you'll see this design in action :-) )