plugin:htmlcomment
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:htmlcomment [2013-03-19 08:49] – [Changes] Display changes in the source repo danny0838 | plugin:htmlcomment [2023-01-09 08:22] (current) – 5.171.103.140 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== HTML Comment ====== | + | ====== HTML Comment |
---- plugin ---- | ---- plugin ---- | ||
- | description: | + | description: |
author | author | ||
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 | + | compatible : Rincewind, Angua, Adora Belle, Weatherwax, Binky, Ponder Stibbons, Greebo, Hogfather, Igor |
depends | depends | ||
- | conflicts | + | conflicts |
similar | similar | ||
tags : annotations, | tags : annotations, | ||
- | downloadurl: | + | downloadurl: |
+ | sourcerepo : https:// | ||
+ | bugtracker : https:// | ||
---- | ---- | ||
- | This is a very simple | + | This is a very simple plugin that allows HTML style comments to be used in the [[: |
<!-- 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 '' | + | Search and install the plugin using the [[plugin: |
- | + | ||
- | Download: [[http:// | + | |
===== Changes ===== | ===== Changes ===== | ||
Line 40: | Line 40: | ||
* Incorporated changes made by [[esther@kaffeehaus.ch|Esther Brunner]] (see [[# | * Incorporated changes made by [[esther@kaffeehaus.ch|Esther Brunner]] (see [[# | ||
* Defined constant '' | * Defined constant '' | ||
- | * 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 ===== | + | |
- | + | ||
- | <file php syntax.php> | + | |
- | <?php | + | |
- | /** | + | |
- | * HTML Comment Plugin: allows HTML comments to be retained in the output | + | |
- | * | + | |
- | * @license | + | |
- | * @author | + | |
- | */ | + | |
- | + | ||
- | if(!defined(' | + | |
- | if(!defined(' | + | |
- | require_once(DOKU_PLUGIN.' | + | |
- | + | ||
- | define(' | + | |
- | + | ||
- | /** | + | |
- | * All DokuWiki plugins to extend the parser/ | + | |
- | * need to inherit from this class | + | |
- | */ | + | |
- | class syntax_plugin_htmlcomment extends DokuWiki_Syntax_Plugin { | + | |
- | + | ||
- | /** | + | |
- | * return some info | + | |
- | */ | + | |
- | function getInfo(){ | + | |
- | return array( | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ); | + | |
- | } | + | |
- | + | ||
- | function getType() { | + | |
- | return ' | + | |
- | } | + | |
- | + | ||
- | function getSort() { | + | |
- | return 325; | + | |
- | } | + | |
- | + | ||
- | function connectTo($mode) { | + | |
- | $this-> | + | |
- | ' | + | |
- | } | + | |
- | + | ||
- | function handle($match, | + | |
- | if ($state == DOKU_LEXER_SPECIAL) { | + | |
- | // strip <!-- from start and --> from end | + | |
- | $match = substr($match, | + | |
- | return array($state, | + | |
- | } | + | |
- | return array(); | + | |
- | } | + | |
- | + | ||
- | function render($mode, | + | |
- | if ($mode == ' | + | |
- | list($state, | + | |
- | if ($state == DOKU_LEXER_SPECIAL) { | + | |
- | $renderer-> | + | |
- | if (HTMLCOMMENT_SAFE) { | + | |
- | $renderer-> | + | |
- | } else { | + | |
- | $renderer-> | + | |
- | } | + | |
- | $renderer-> | + | |
- | } | + | |
- | return true; | + | |
- | } | + | |
- | return false; | + | |
- | } | + | |
- | } | + | |
- | + | ||
- | ?> | + | |
- | </ | + | |
===== Discussion ===== | ===== Discussion ===== | ||
Line 138: | Line 57: | ||
> Hi! One short question: Commented text is displayed in search results. Is there a method to prevent this? --- // | > Hi! One short question: Commented text is displayed in search results. Is there a method to prevent this? --- // | ||
+ | |||
+ | 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. |
plugin/htmlcomment.1363679390.txt.gz · Last modified: 2013-03-19 08:49 by danny0838