DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:replace

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
Last revisionBoth sides next revision
plugin:replace [2010-11-30 09:59] – [Feature suggestions] 216.232.164.87plugin:replace [2018-05-20 17:13] Aleksandr
Line 1: Line 1:
-====== replace plugin ======+====== replace Plugin ======
  
 ---- plugin ---- ---- plugin ----
Line 5: Line 5:
 author     : James Dempster (letssurf) author     : James Dempster (letssurf)
 email      : letssurf@gmail.com email      : letssurf@gmail.com
-type       : Syntax Substition+type       : syntax
 lastupdate : 2009-04-13 lastupdate : 2009-04-13
 compatible : 2009-02-14 compatible : 2009-02-14
 +similar    : easyvar, kixovar, fields, macros, textinsert
 tags       : search, replace tags       : search, replace
  
-downloadurl: http://dwp-forge.googlecode.com/files/replace-2009-04-13.zip+downloadurl: https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/dwp-forge/replace-2009-04-13.zip 
 +bugtracker :  
 +sourcerepo :  
 +donationurl:  
 + 
 +screenshot_img: 
 ---- ----
  
Line 16: Line 22:
  
 Comments welcome. Comments welcome.
- 
  
 ===== Download and Installation ===== ===== Download and Installation =====
Line 22: Line 27:
 Download and install the plugin using the [[:plugin:plugin|Plugin Manager]] using the following URL. Refer to [[:plugins]] on how to install plugins manually. Download and install the plugin using the [[:plugin:plugin|Plugin Manager]] using the following URL. Refer to [[:plugins]] on how to install plugins manually.
  
-  * [[http://dwp-forge.googlecode.com/files/replace-2009-04-13.zip|replace-2009-04-13]] +  * [[https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/dwp-forge/replace-2009-04-13.zip|replace-2009-04-13.zip]]
  
 ===== Version History ===== ===== Version History =====
Line 34: Line 38:
  
   * First release.   * First release.
- 
  
 ===== Source Code ===== ===== Source Code =====
Line 71: Line 74:
             'name'   => 'Replacer',             'name'   => 'Replacer',
             'desc'   => 'Replaces words thought DokuWiki automatically from replace.conf with the snippet defined.',             'desc'   => 'Replaces words thought DokuWiki automatically from replace.conf with the snippet defined.',
-            'url'    => 'http://www.dokuwiki.org/wiki:plugins',+            'url'    => 'http://www.dokuwiki.org/plugin:replace',
         );         );
     }     }
Line 116: Line 119:
 ?> ?>
 </code> </code>
 +
 ===== Comments ===== ===== Comments =====
 +
 Thank you very much for this plugin. For me it has been extremely helpful. (For beginners: Copy the PHP code into dokuwiki/lib/plugins/replace/syntax.php and create the file dokuwiki/conf/replace.conf with the substitutions. Use the %% markup to substitute plain text) Thank you very much for this plugin. For me it has been extremely helpful. (For beginners: Copy the PHP code into dokuwiki/lib/plugins/replace/syntax.php and create the file dokuwiki/conf/replace.conf with the substitutions. Use the %% markup to substitute plain text)
  
 +==== Integration with confmanager-plugin ====
 +
 +To modify replace.conf via admin-menu install [[confmanager|confmanager-plugin]] and modify following lines:
 +
 +admn.php (line 9): add "replace"
 +<code php>
 +    var $cnffiles = array('acronyms','entities','interwiki','mime','smileys','replace'); // add conf-files here; must be filename
 +</code>
 +
 +lang.php (for german)
 +<code css>
 +$lang['cnf_replace'  = 'Replace';
 +$lang['head_replace'  = 'Replace';
 +$lang['text_replace'  = 'Hier sind die Einstellungen f&uuml;r die Replace-Plugin-Ersetzung. F&uuml;r genauere Informationen besuchen sie <a class="interwiki iw_doku" href="http://www.dokuwiki.org/plugin:replace">Replace-Plugin</a>';
 +</code>
  
 ==== Feature suggestions ==== ==== Feature suggestions ====
 +
 +  * Please add **mutiple words** support - I would like to hack it but I don't get it *arg* -- //Christian 2009/12/10 13:05//
 +  * Any way to do the replace within a source line? I would like to do the substitution for copy-pasting into multiple conf files. I guess I'm looking to also include the 'protected' + 'substition' modes.
  
  
-  * Please add **mutiple words** support - I would like to hack it but I don't get it *arg* -- //[[xxx.de|Christian]] 2009/12/10 13:05// 
-  * Any way to do the replace within a source line? I would like to do the substitution for copy-pasting into multiple conf files. I guess I'm looking to also include the 'protected' + 'substition' modes. Which may be the reason for the bugs below. 
-\\ 
-\\ 
 ==== Replacement text is not shown ==== ==== Replacement text is not shown ====
  
Line 160: Line 179:
  
 Fixed in version 2009-04-13. No extensive testing, I was just looking for a similar feature for another plugin and got curious if it's possible to make this one to work. Seems so. --- //[[spambox03@mail.ru|Mykola Ostrovskyy]] 2009/04/13 19:41// Fixed in version 2009-04-13. No extensive testing, I was just looking for a similar feature for another plugin and got curious if it's possible to make this one to work. Seems so. --- //[[spambox03@mail.ru|Mykola Ostrovskyy]] 2009/04/13 19:41//
 +
 +----
 +
 +Working 2011-01-23. replace.conf needs double % before and after replacement text. (sry example replace.conf breaks page formatting).
 +original
 +<file>
 + start brc  Brc bRc  brC end \\  
 + start haccp ifs ifs6 brc5 end
 +</file>
 +replaced
 +<file>
 +start BRC BRC bRc brC end
 +start HACCP IFS IFS6 BRC5 end
 +</file>
  
 ==== Plugin (2009-04-13) fails at line 74 ====  ==== Plugin (2009-04-13) fails at line 74 ==== 
Line 200: Line 233:
 </code> --- //[[holger@doessing.net|Holger Doessing]] 2009/05/11 16:50// </code> --- //[[holger@doessing.net|Holger Doessing]] 2009/05/11 16:50//
  
 +
 +==== Bugfix for special chars (2012/23/01) ====
 +
 +<code php>
 +<?php
 +
 +function preConnect() {
 +    if(!count($this->replace)) return;
 +    $replacers = array_map('preg_quote', array_keys($this->replace));
 +    // removed '\b' at beginning and end. Had problems to replace "@cloud." with "~~TAGCLOUD~~"
 +    $this->pattern = join('|', $replacers);
 +}
 +
 +</code>
 +[[robert.jaeckel@verwaltung.uni-halle.de|Robert Jäckel]]
plugin/replace.txt · Last modified: 2018-06-05 22:56 by Klap-in

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