DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:htmlcomment

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:htmlcomment [2011-06-18 16:46] – corrected link achplugin:htmlcomment [2023-01-09 08:22] (current) 5.171.103.140
Line 1: Line 1:
-====== HTML Comment ======+====== HTML Comment Plugin ======
  
 ---- plugin ---- ---- plugin ----
-description: Enables HTML comments.+description: Enables HTML comments
 author     : Christopher Arndt author     : Christopher Arndt
 email      : chris@chrisarndt.de email      : chris@chrisarndt.de
 type       : syntax type       : syntax
-lastupdate : 2005-10-08 +lastupdate : 2013-03-19 
-compatible : Release rc2011-05-08 "Rincewind RC2"+compatible : Rincewind, Angua, Adora Belle, Weatherwax, Binky, Ponder Stibbons, Greebo, Hogfather, Igor
 depends    :  depends    : 
-conflicts +conflicts ckgedit
 similar    : comment, commentsrc similar    : comment, commentsrc
 tags       : annotations, hide tags       : annotations, hide
  
-downloadurl: http://chrisarndt.de/en/software/dokuwiki/htmlcomment-plugin.zip+downloadurl: https://github.com/danny0838/dokuwiki-plugin-htmlcomment/archive/master.zip 
 +sourcerepo : https://github.com/danny0838/dokuwiki-plugin-htmlcomment/ 
 +bugtracker : https://github.com/danny0838/dokuwiki-plugin-htmlcomment/issues
 ---- ----
  
-This is a very simple [[plugins|plugin]] that allows HTML style comments to be used in the [[:wikitext]]. They will show up unchanged in the XHTML output. They will not be rendered by the browser, but can be viewed with "View source code" command. The syntax is exactly like in HTML:+This is a very simple plugin that allows HTML style comments to be used in the [[:wikitext]]. They will show up unchanged in the XHTML output. They will not be rendered by the browser, but can be viewed with "View source code" command. The syntax is exactly like in HTML:
  
   <!-- This is a HTML comment -->   <!-- This is a HTML comment -->
Line 28: Line 30:
 ===== Installation ===== ===== Installation =====
  
-Either save the PHP code [[#code|below]] to the file ''lib/plugins/htmlcomment/syntax.php'' or use the [[plugin:plugin]] manager with the following URL: +Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
- +
-Download: [[http://chrisarndt.de/en/software/dokuwiki/htmlcomment-plugin.zip|htmlcomment-plugin.zip]]+
  
 ===== Changes ===== ===== Changes =====
 +
 +{{rss>https://github.com/danny0838/dw-htmlcomment/commits/master.atom date}}
  
 New in version 1.1: New in version 1.1:
Line 38: Line 40:
   * Incorporated changes made by [[esther@kaffeehaus.ch|Esther Brunner]] (see [[#Discussion]]).   * Incorporated changes made by [[esther@kaffeehaus.ch|Esther Brunner]] (see [[#Discussion]]).
   * Defined constant ''HTMLCOMMENT_SAFE'' to allow to switch back to old behaviour.   * Defined constant ''HTMLCOMMENT_SAFE'' to allow to switch back to old behaviour.
-  * Removed version number from plugin archive, since the [[plugin:plugin]] manager can't handle versioned archives. +  * Removed version number from plugin archive, since the [[plugin:extension]] manager can't handle versioned archives.
- +
-===== Code ===== +
- +
-<code php> +
-<?php +
-/** +
- * HTML Comment Plugin: allows HTML comments to be retained in the output +
- * +
- * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html) +
- * @author     Christopher Arndt <chris@chrisarndt.de> +
- */ +
- +
-if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); +
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); +
-require_once(DOKU_PLUGIN.'syntax.php'); +
- +
-define('HTMLCOMMENT_SAFE', true); +
- +
-/** +
- * All DokuWiki plugins to extend the parser/rendering mechanism +
- * need to inherit from this class +
- */ +
-class syntax_plugin_htmlcomment extends DokuWiki_Syntax_Plugin { +
- +
-    /** +
-     * return some info +
-     */ +
-    function getInfo(){ +
-        return array( +
-            'author' => 'Christopher Arndt', +
-            'email'  => 'chris@chrisarndt.de', +
-            'date'   => '2005-10-08', +
-            'name'   => 'HTML Comment Plugin', +
-            'desc'   => 'allows HTML comments to be retained in the output', +
-            'url'    => 'http://www.dokuwiki.org/plugin:htmlcomment', +
-        ); +
-    } +
- +
-    function getType() { +
-        return 'substition'; +
-    } +
- +
-    function getSort() { +
-        return 325; +
-    } +
- +
-    function connectTo($mode) { +
-        $this->Lexer->addSpecialPattern("<\!--.*?-->", $mode, +
-          'plugin_htmlcomment'); +
-    } +
- +
-    function handle($match, $state, $pos, &$handler) { +
-        if ($state == DOKU_LEXER_SPECIAL) { +
-             // strip <!-- from start and --> from end +
-            $match = substr($match,4,-3); +
-            return array($state, $match); +
-        } +
-        return array(); +
-    } +
- +
-    function render($mode, &$renderer, $data) { +
-        if ($mode == 'xhtml') { +
-            list($state, $match) = $data; +
-            if ($state == DOKU_LEXER_SPECIAL) { +
-                $renderer->doc .= '<!--'; +
-                if (HTMLCOMMENT_SAFE) { +
-                    $renderer->doc .= $renderer->_xmlEntities($match); +
-                } else { +
-                    $renderer->doc .= $match; +
-                } +
-                $renderer->doc .= '-->'; +
-            } +
-            return true; +
-        } +
-        return false; +
-    } +
-+
- +
-?> +
-</code> +
  
 ===== Discussion ===== ===== Discussion =====
Line 136: Line 57:
  
 > Hi! One short question: Commented text is displayed in search results. Is there a method to prevent this? --- //[[orinoco]] 2011-03-09 9:20// > Hi! One short question: Commented text is displayed in search results. Is there a method to prevent this? --- //[[orinoco]] 2011-03-09 9:20//
 +
 +It should be no problem to embed the unescaped code into the html comment, so I removed the escape feature. The code is slight changed and is replaced into a git repo. Already informed the original author.  --- [[user>danny0838|danny0838]] //2013/03/19 08:54//
plugin/htmlcomment.1308408374.txt.gz · Last modified: 2011-06-18 16:46 by ach

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