DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:xterm

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:xterm [2009-10-06 10:59] – tag cleanup layneeplugin:xterm [2022-07-30 00:18] (current) Klap-in
Line 1: Line 1:
-====== xterm plugin ======+====== xterm Plugin ======
  
 ---- plugin ---- ---- plugin ----
-description: documenting xterminal output without forcing linefeeds+description: Documenting x-terminal output without forcing linefeeds
 author     : Tom Trenker author     : Tom Trenker
 email      : tom_trenker@yahoo.com email      : tom_trenker@yahoo.com
 type       : syntax type       : syntax
 lastupdate : 2006-08-26 lastupdate : 2006-08-26
-compatible :+compatible : Hogfather
 depends    : depends    :
 conflicts  : conflicts  :
 similar    : cli, code similar    : cli, code
-tags       : code, shell, highlight, syntax+tags       : formatting, code 
 +  
 +downloadurl:  
 +bugtracker :  
 +sourcerepo :  
 +donationurl:  
 +  
 +screenshot_img : 
 ---- ----
- 
  
 ===== Description ===== ===== 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.+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. DokuWiki formatting options (bold, italic, etc...) can be applied to the text.
Line 32: Line 38:
  
 ===== CascadingStyleSheet ===== ===== 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'': 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'':
  
-<code css>+<code css style.css>
 .xterm { .xterm {
     font-family:MiscFixed;     font-family:MiscFixed;
Line 40: Line 47:
 } }
 </code> </code>
- 
  
 ===== Plugin ===== ===== Plugin =====
 +
 Put the following PHP file in /lib/plugins/xterm/syntax.php Put the following PHP file in /lib/plugins/xterm/syntax.php
  
-<code php>+<code php syntax.php>
 <?php <?php
 /** /**
Line 113: Line 120:
      */      */
     function connectTo($mode) {     function connectTo($mode) {
-        $this->Lexer->addEntryPattern('\x3Cxterm\x3E(?=.*\x3C/xterm\x3E)',$mode,'plugin_xterm');+        $this->Lexer->addEntryPattern('<xterm>(?=.*</xterm>)',$mode,'plugin_xterm');
 /*      $this->Lexer->addEntryPattern('(?i)<xterm(?: .+?)?>(?=.+</xterm>)',$mode,'plugin_xterm'); */ /*      $this->Lexer->addEntryPattern('(?i)<xterm(?: .+?)?>(?=.+</xterm>)',$mode,'plugin_xterm'); */
     }     }
    
     function postConnect() {     function postConnect() {
-        $this->Lexer->addExitPattern('\x3C/xterm\x3E', 'plugin_xterm'); +        $this->Lexer->addExitPattern('</xterm>', 'plugin_xterm'); 
 /*      $this->Lexer->addExitPattern('(?i)</xterm>','plugin_xterm'); */         /*      $this->Lexer->addExitPattern('(?i)</xterm>','plugin_xterm'); */        
     }     }
Line 163: Line 170:
  
 ?> ?>
-  
 </code> </code>
  
 ===== Discussion ===== ===== 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]]   * 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]]
  
Line 249: Line 256:
 Best regards, \\ 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 :-) ) 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 :-) )
 +
 +----
 +===== Compatibility =====
 +
 +To get compatibility with 2020-07-29 "Hogfather" you need to change only the declarations of the functions ''handle'' and ''render'' -> My wiki runs at least error free ;-)
 +
 +<code diff>
 +--- lib/plugins/xterm/syntax.php.save   2020-08-21 16:12:48.530697306 +0200
 ++++ lib/plugins/xterm/syntax.php        2020-11-23 14:49:54.937881868 +0100
 +@@ -78,7 +78,8 @@
 +     /**
 +      * Handle the match
 +      */
 +-    function handle($match, $state, $pos, &$handler){
 ++    /* function handle($match, $state, $pos, &$handler){ */
 ++    function handle($match, $state, $pos, Doku_Handler $handler){
 +         switch ($state) {
 +           case DOKU_LEXER_ENTER :
 +             break;
 +@@ -97,7 +98,8 @@
 +     /**
 +      * Create output
 +      */
 +-    function render($mode, &$renderer, $data) {
 ++    /* function render($mode, &$renderer, $data) { */
 ++    function render($mode, Doku_Renderer $renderer, $data) {
 +         if($mode == 'xhtml'){
 +             if ($data[1] == DOKU_LEXER_ENTER){
 +                 $renderer->doc .= '<pre class="xterm">';       #     <pre><font size=+0>';
 +</code>
 + --- [[user>kirbach|kirbach]] //2020-11-23 15:05//
plugin/xterm.1254819593.txt.gz · Last modified: 2009-10-06 10:59 by laynee

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki