DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:instructions

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:instructions [2019-10-29 13:28] – [Examples/Usage] juergen_aus_zuendorfplugin:instructions [2022-04-20 17:29] (current) – [Wiki-Syntax] juergen-aus-zuendorf
Line 2: Line 2:
  
 ---- plugin ---- ---- plugin ----
-description: Provides highly customizable, standardised instruction+description: Provides highly customizable, standardized instructions
 author     : Juergen_aus_Zuendorf  author     : Juergen_aus_Zuendorf 
 email      : H-J-Schuemmer@Web.de email      : H-J-Schuemmer@Web.de
 type       : syntax type       : syntax
-lastupdate : 2019-10-19 +lastupdate : 2022-04-20 
-compatible : Frusterick Manners, Greebo+compatible : Hogfather, Greebo, Frusterick Manners
 depends    :  depends    : 
 conflicts  conflicts 
-similar    : textinsert+similar    : textinsert, wrap
 tags       : formatting, macro, replace tags       : formatting, macro, replace
  
 downloadurl: https://github.com/Juergen-aus-Koeln/dokuwiki-plugin-instructions/archive/master.zip downloadurl: https://github.com/Juergen-aus-Koeln/dokuwiki-plugin-instructions/archive/master.zip
 bugtracker : https://github.com/Juergen-aus-Koeln/dokuwiki-plugin-instructions/issues bugtracker : https://github.com/Juergen-aus-Koeln/dokuwiki-plugin-instructions/issues
-sourcerepo : # eg. http://github.com/juergen_aus_zuendorf/dokuwiki-plugin-instructions/+sourcerepo : https://github.com/Juergen-aus-Koeln/dokuwiki-plugin-instructions/
 donationurl:  donationurl: 
  
Line 29: Line 29:
 ===== Examples/Usage ===== ===== Examples/Usage =====
  
-In combination with a special template, this code generates a simple hint+In combination with a special template, this code generates a print preview button
-  {{INSTR<cms_hint>|-Hint|-this is a hint}}+  ~~INSTR~~cms_preview~~|-mynamespace:mypage_for_preview~~END~~
  
-{{https://raw.githubusercontent.com/Juergen-aus-Koeln/dokuwiki-plugin-instructions/master/plugin_instructions_02.png}}+{{https://raw.githubusercontent.com/Juergen-aus-Koeln/dokuwiki-plugin-instructions/master/plugin_instructions_05.png}}
  
  
Line 38: Line 38:
  
 <code> <code>
-{{INSTR<cms_warning>+~~INSTR~~warning~~
 |- Warning |- Warning
 |- Title of the warning |- Title of the warning
Line 46: Line 46:
 |+ • and perhaps this |+ • and perhaps this
 |+ • and some more things |+ • and some more things
-}}+~~END~~
 </code> </code>
  
-... the result with a certain template could be like this:+... the result with a certain template could be like this simple hint:
  
 {{https://raw.githubusercontent.com/Juergen-aus-Koeln/dokuwiki-plugin-instructions/master/plugin_instructions_03.png}} {{https://raw.githubusercontent.com/Juergen-aus-Koeln/dokuwiki-plugin-instructions/master/plugin_instructions_03.png}}
Line 57: Line 57:
 ==== Wiki-Syntax ==== ==== Wiki-Syntax ====
  
-First the syntax within the wiki page:+First the syntax within the wiki page: ((There is an alternative, old syntax:\\ 
 +''%%{{INSTR<[template]>|-[parameter 1]|-[parameter n]}}%%''\\  
 +But this might be deleted in future releases because there are problems using this syntax in combination with the ckgedit plugin.))\\
  
 <code> <code>
-{{INSTR<[template]>+~~INSTR~~[template]~~
 |- [parameter 1] |- [parameter 1]
 |- [parameter 2a] |- [parameter 2a]
 |+ [parameter 2b] |+ [parameter 2b]
 |- [parameter n] |- [parameter n]
-}}+~~END~~
 </code> </code>
  
 //or the same in one line:// //or the same in one line://
  
-<code> +  ~~INSTR~~[template]~~|-[parameter 1]|- ... |-[parameter n]~~END~~ 
-{{INSTR<[template]>|-[parameter 1]|-[parameter 2a]|+[parameter 2b]|-[parameter n]}} +
-</code>+
  
 a) The leading syntax tag is ''INSTR''. a) The leading syntax tag is ''INSTR''.
Line 80: Line 81:
 c) The listed parameters can be normal text. Each parameter is defined in one line that is prefixed by ''|-''. c) The listed parameters can be normal text. Each parameter is defined in one line that is prefixed by ''|-''.
  
-In addition there are some special markups: +In addition there are some special markups (does only work for whole words)
-  * Marking text with wiki syntax as **bold**, //italic// und __underline__ is accepted.+  * Marking text with wiki syntax as **bold**, //italic// or ''code'' is accepted. ((Underline is often used in "normal" text so the wiki syntax would unexpectedly change this if supported by this plugin.))
   * Two spaces are interpreted as indentation or gap.    * Two spaces are interpreted as indentation or gap. 
   * Wiki-Links are understood with this syntax: ''%%[[namespace:page#section|description]]%%'' (description is necessary).   * Wiki-Links are understood with this syntax: ''%%[[namespace:page#section|description]]%%'' (description is necessary).
-  * If you want to have a line break within one parameter you can achieve this by inserting a new line prefixed by ''|+''. +  * If you want to have a line break within one parameteryou can achieve this by inserting a new line prefixed by ''|+''.
  
 +If the template (see below) supports more parameter as from the requesting page shall be passed, the supernumerary parameters will remain empty in the output.
 ==== Template ==== ==== Template ====
  
-To work correctly you have to define a template. This is built as html-text and defines the look of the instruction. +To work correctlyyou have to define a template. This is built as HTML-text and defines the look of the instruction. If necessary, the HTML-text may contain JavaScript code.
  
 a) The first line in the template file has to be the code "%%<html>%%", followed by an optional short description (not more than one line). a) The first line in the template file has to be the code "%%<html>%%", followed by an optional short description (not more than one line).
  
-b) After this the file contains all parameters that should be processed within the wiki page. When a parameter shall be inserted in the html content just insert a new line and write "param-1" (or "param-2" and so on). +b) After thisthe file contains all parameters that should be processed within the wiki page. When a parameter shall be inserted in the HTML contentjust insert a new line and write "param-1" (or "param-2" and so on). 
  
-c) At the end of the html file you have to append a line with the code "</%%html%%>". With the tags <%%html%%> and </%%html%%> at the beginning and the end you can test the content in a normal wiki testing page.+c) At the end of the HTML fileyou have to append a line with the code "</%%html%%>". With the tags <%%html%%> and </%%html%%> at the beginning and the endyou can test the content in a normal wiki testing page.
  
-The template has to be placed in a subfolder to ".../lib/plugins/instructions/tpl". The subfolder name will be the name of the template. The html file name in that folder is "html.txt". Besides this you can provide images in this folder which can be adressed by your html code with "lib/plugins/instructions/tpl/your_template/image_file"+The template has to be placed in a subfolder to ".../lib/plugins/instructions/tpl". The subfolder name will be the name of the template. The HTML file name in that folder is "html.txt". Besides this you can provide images in this folder which can be addressed by your HTML code with "lib/plugins/instructions/tpl/your_template/image_file"
  
-Here is an example with 5 parameters:+//Note://\\ 
 +If a parameter is passed empty, a subsequent line feed defined in the template (marked with "<br>") will be suppressed. 
 +==== Placeholders ====
  
 +In addition you can use some placeholders in the wiki page:
 +| ''@PAGE@''          | page name                                       |
 +| ''@ID@''            | ID of the page                                  |
 +| ''@NS@''            | namespace of the page                           |
 +| ''@CURNS@''         | current sub-namespace                           |
 +| ''@NSMAIN@''        | namespace of main page when using in a sidebar  |
 +| ''%%@URL_DOKU@%%''  | base URL of the wiki installation               |
 +| ''%%@URL_PAGE@%%''  | complete URL of the current page                |
 +
 +//Example://
 <code> <code>
 +~~INSTR~~my_template~~
 +|- @ID@
 +|- @PAGE@
 +|- @NS@
 +|- @CURNS@
 +|- @URL_DOKU@
 +|- @URL_PAGE@
 +~~END~~
 +</code>
 +
 +
 +==== Examples ====
 +
 +=== Example "Warning" ===
 +
 +Here is an example with 5 parameters (screenshot see above):
 +
 +//Code://
 +<code>
 +~~INSTR~~warning~~
 +|- Warning
 +|- Title of the warning
 +|- Description of the warning
 +|- Therefore:
 +|- • make this
 +|+ • and perhaps this
 +|+ • and some more things
 +~~END~~
 +</code>
 +
 +//Template://
 +<code html>
 <html> WARNING <html> WARNING
-<table style="width:100%;"> <tbody> <tr> <td style="width:130px; text-align:center; padding:0px; border-left:none; border-bottom:none; border-top:none;"> <img src="lib/plugins/instructions/tpl/cms_warning/symbol.png" alt="" width="35"> </td> <td style="background-color:#E6E6FA; font-size:16pt; text-transform:uppercase; color:black; vertical-align:middle; padding:0px 5px;"> +<table style="width:100%;"> <tbody> <tr> <td style="width:130px; text-align:center; padding:0px; border-left:none; border-bottom:none; border-top:none;"> <img src="lib/plugins/instructions/tpl/warning/symbol.png" alt="" width="35"> </td> <td style="background-color:#E6E6FA; font-size:16pt; text-transform:uppercase; color:black; vertical-align:middle; padding:0px 5px;"> 
 <strong> <strong>
 param-1 param-1
Line 123: Line 168:
 </code> </code>
  
-This code is placed here: "lib/plugins/instructions/tpl/cms_warning/html.txt", and in addition there is an image in the same folder: "lib/plugins/instructions/tpl/cms_warning/symbol.png".+This code is placed here: "lib/plugins/instructions/tpl/warning/html.txt", and in addition there is an image in the same folder: "lib/plugins/instructions/tpl/warning/symbol.png". 
 + 
 + 
 +=== Example "Immediate print" === 
 + 
 +The next example shows a code without parameters to print out a page in the moment it is opened: 
 + 
 +//Syntax:// 
 +<code> 
 +{{INSTR<immediate_print>}} 
 +</code> 
 + 
 +//Template:// 
 +<code html> 
 +<html> immediate_print 
 +<script type="text/javascript"> 
 +<!-- 
 +window.onload = function() { 
 +  window.print() 
 +
 +--> 
 +</script> 
 +</html> 
 +</code>
  
  
Line 131: Line 199:
 === Change Log === === Change Log ===
  
-  * **2019-10-19** +  * **2022-04-20**: Better support for empty parameters 
-    * Initial release+  * **2022-03-25**: New parameter @NSMAIN@ 
 +  * **2020-01-16**: Support for plugin CKGEdit with a new syntax 
 +  * **2019-11-15**: Syntax for placeholders added 
 +  * **2019-10-19**Initial release
  
  
plugin/instructions.1572352089.txt.gz · Last modified: 2019-10-29 13:28 by juergen_aus_zuendorf

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