DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:command

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:command [2012-06-30 18:25] – [Modification History] 95.152.216.241plugin:command [2023-12-10 01:27] (current) – [Command Plugin] nerun
Line 6: Line 6:
 email      : martyn.eggleton@gmail.com email      : martyn.eggleton@gmail.com
 type       : syntax type       : syntax
-lastupdate : 2012-06-30 +lastupdate : 2012-02-13 
-compatible : +compatible : !Hogfather, !Igor, !Jack Jackrum
 depends    :  depends    : 
 conflicts  conflicts 
 similar    :  similar    : 
-tags       : extension, command, plugintype +tags       : extension, command, !broken, !discontinued 
-downloadurl: http://github.com//dokuwiki-plugin-command/zipball/master +downloadurl: https://github.com/stretchyboy/dokuwiki-command/zipball/master 
-bugtracker : http://github.com//dokuwiki-plugin-command/issues +bugtracker : https://github.com/stretchyboy/dokuwiki-command/issues 
-sourcerepo : http://github.com//dokuwiki-plugin-command/+sourcerepo : https://github.com/stretchyboy/dokuwiki-command/
 donationurl:  donationurl: 
 ---- ----
  
 +:!: WARNING: This plugin hasn't been updated since 2012 and is not compatible with the current version of Dokuwiki.
  
 ===== Overview ===== ===== Overview =====
  
-The **Command Syntax Plugin** implements an extensible syntax.  It allows people to extend [[:DokuWiki]] [[:syntax]] by writing merely one or two PHP functions, without writing a DokuWiki [[plugins|plugin]], and without further cluttering the syntax space.+The **Command Syntax Plugin** implements an extensible syntax.  It allows people to extend [[:DokuWiki]] [[:wiki:syntax]] by writing merely one or two PHP functions, without writing a DokuWiki plugin, and without further cluttering the syntax space.
  
 An extension of the plugin is called a **command**.  Each command has a name and may take parameters.  It may also take arbitrary content, but this content is never parsed by [[:DokuWiki]]; the command is entirely responsible for interpreting any syntax embedded within the content, but it may interpret it any way it wants. An extension of the plugin is called a **command**.  Each command has a name and may take parameters.  It may also take arbitrary content, but this content is never parsed by [[:DokuWiki]]; the command is entirely responsible for interpreting any syntax embedded within the content, but it may interpret it any way it wants.
Line 47: Line 48:
 </code> </code>
  
-The [[plugin:Date/Time]] command (command name ''dt'') is the first Command Plugin extension and is included with this plugin. The [[plugin:Template]] command (command name ''template'') is an example of a more elaborate extension. The remaining commands are suggestive of other kinds of commands you might create. Those who create new commands should just add them to the [[plugins|plugin list]], where people expect to find syntax extensions.+The [[Date/Time]] command (command name ''dt'') is the first Command Plugin extension and is included with this plugin. The [[plugin:Template]] command (command name ''template'') is an example of a more elaborate extension. The remaining commands are suggestive of other kinds of commands you might create. Those who create new commands should just add them to the [[:plugins|plugin list]], where people expect to find syntax extensions.
  
 The Command Plugin also provides a way to add endless new features to the DokuWiki syntax without overcrowding the syntax space. This helps reduce both user confusion and conflicts among syntaxes. People familiar with the syntax for any one command will understand the general syntax of all the other commands. The Command Plugin also provides a way to add endless new features to the DokuWiki syntax without overcrowding the syntax space. This helps reduce both user confusion and conflicts among syntaxes. People familiar with the syntax for any one command will understand the general syntax of all the other commands.
Line 53: Line 54:
 ===== Modification History ===== ===== Modification History =====
  
-This is essentially the work of [[http://www.spiderjoe.com|Spider Joe]] with the code hosted on github now.+This is essentially the work of [[http://www.spiderjoe.com/|Spider Joe]] with the code hosted on github now.
  
   * 2005/8/25 --- Created. [[http://www.spiderjoe.com|Spider Joe]]   * 2005/8/25 --- Created. [[http://www.spiderjoe.com|Spider Joe]]
Line 60: Line 61:
   * 2005/8/29 --- Fixed failure to load extension for pre-cached data. [[http://www.spiderjoe.com|Spider Joe]]   * 2005/8/29 --- Fixed failure to load extension for pre-cached data. [[http://www.spiderjoe.com|Spider Joe]]
   * 2005/9/3 --- Fixed RSS feed by changing hsc() to htmlspecialchars(). [[http://www.spiderjoe.com|Spider Joe]]   * 2005/9/3 --- Fixed RSS feed by changing hsc() to htmlspecialchars(). [[http://www.spiderjoe.com|Spider Joe]]
-  * 2012/6/30 --- Moved hosting to github [[http://www.stretchyboy.co.uk|Martyn Eggleton]]+  * 2012/2/13 --- Moved hosting to github [[https://github.com/stretchyboy|Martyn Eggleton]]
  
 ===== Installation ===== ===== Installation =====
 +Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
  
-When you install the plugin you get only one demo command. This command is the [[plugin:Date/Time]] command introduced in the [[#overview]]. After installing the plugin you will be able to install other commands that people have implemented. To install the plugin, download the following zip file: +When you install the plugin you get only one demo command. This command is the [[Date/Time]] command introduced in the [[#overview]]. After installing the plugin you will be able to install other commands that people have implemented.
- +
-<del>**[[http://www.spiderjoe.com/source/dokuwiki/commandplugin.zip|Command Plugin Zip]]**</del> +
- +
-:!: **Unfortunately, the above link is broken. Here is an {{plugin:commandplugin.zip|alternative download of the command plugin}}.** :!: +
- +
-This zip file contains the following directories and files: +
- +
-<code> +
-  /command/ +
-  /command/syntax/ +
-  /command/syntax/inline.php +
-  /command/syntax/block.php +
-  /command/inc/ +
-  /command/inc/embedding.php +
-  /command/inc/extension.php +
-  /command/ext/ +
-  /command/ext/dt.php +
-</code>+
  
 To install other commands, follow the installation instructions given for the command. Every command consists of at least one file place in the extensions directory ''/lib/plugins/command/ext/'', a PHP file whose name is that of the command, given in lowercase letters. To install other commands, follow the installation instructions given for the command. Every command consists of at least one file place in the extensions directory ''/lib/plugins/command/ext/'', a PHP file whose name is that of the command, given in lowercase letters.
Line 90: Line 74:
 Every command occurs somewhere on the page.  When the command is executed, it is replaced with the result of the command.  Some commands produce only external affects and so are replaced with nothing -- they are simply removed.  Other commands produce text or HTML that is to appear in place of the command.  The replacement behavior of a command depends entirely on the implementation of that specific command. Every command occurs somewhere on the page.  When the command is executed, it is replaced with the result of the command.  Some commands produce only external affects and so are replaced with nothing -- they are simply removed.  Other commands produce text or HTML that is to appear in place of the command.  The replacement behavior of a command depends entirely on the implementation of that specific command.
  
-However, when you insert the command, you have to decide what is to happen around the command.  DokuWiki [[syntax]] allows you to create HTML paragraphs merely by inserting blank lines.  Paragraphs are automatically generated for you. When you use a command, you have to decide whether that command is to be embedded within a paragraph or not.  There are two general syntaxes for deciding this:+However, when you insert the command, you have to decide what is to happen around the command.  DokuWiki [[:wiki:syntax|syntax]] allows you to create HTML paragraphs merely by inserting blank lines.  Paragraphs are automatically generated for you. When you use a command, you have to decide whether that command is to be embedded within a paragraph or not.  There are two general syntaxes for deciding this:
  
 <code> <code>
Line 124: Line 108:
   - Command names are not case-sensitive, while parameter names are case-sensitive unless the particular command implements case-insensitivity.   - Command names are not case-sensitive, while parameter names are case-sensitive unless the particular command implements case-insensitivity.
   - Parameter values are strongly constrained to minimize parsing interference with other plugin syntaxes.  In particular, parameters are not a suitable means for conveying textual information to a command; text should appear as content.   - Parameter values are strongly constrained to minimize parsing interference with other plugin syntaxes.  In particular, parameters are not a suitable means for conveying textual information to a command; text should appear as content.
-  - [[DokuWiki]] does not parse the content of a command.  Any [[syntax|DokuWiki syntax]] or [[plugins|plugin syntax]] that you put in the content is handed directly to the command without translation.  However, the command may implement its own content syntax.+  - [[:DokuWiki]] does not parse the content of a command.  Any [[:wiki:syntax|DokuWiki syntax]] or [[:plugins|plugin syntax]] that you put in the content is handed directly to the command without translation.  However, the command may implement its own content syntax.
  
 If the BNF is too confusing, you can learn the syntax by looking at the examples in the [[#overview]].  Those examples are meant to demonstrate most of the syntax. If the BNF is too confusing, you can learn the syntax by looking at the examples in the [[#overview]].  Those examples are meant to demonstrate most of the syntax.
  
-The resulting syntax looks much like a hybrid between a URL query and a function call.  This is for consistency with other DokuWiki syntaxes that use URL queries to provide parameters, such as the [[syntax#images_and_other_files|image syntax]] and the [[plugin:gallery|gallery plugin]], and also to suggest the command-like nature of the syntax.+The resulting syntax looks much like a hybrid between a URL query and a function call.  This is for consistency with other DokuWiki syntaxes that use URL queries to provide parameters, such as the [[:wiki:syntax#images and other files|image syntax]] and the [[gallery|gallery plugin]], and also to suggest the command-like nature of the syntax.
  
-Command syntax is intentionally similar to the syntax of the [[plugin:Div/Span Shorthand]] plugin.  Div/Span shorthand is useful for creating renderings of parsed text, provided you can use CSS to do it.+Command syntax is intentionally similar to the syntax of the [[Div/Span Shorthand]] plugin. Div/Span shorthand is useful for creating renderings of parsed text, provided you can use CSS to do it.
  
 ===== Extensions ===== ===== Extensions =====
Line 148: Line 132:
 That's it, you're done. You don't need to worry about the syntax at all. All you have to do is implement behavior according to the indicated embedding mode (if it differs between the modes), examine the parameters and content as necessary, and perform the action and/or return replacement text. That's it, you're done. You don't need to worry about the syntax at all. All you have to do is implement behavior according to the indicated embedding mode (if it differs between the modes), examine the parameters and content as necessary, and perform the action and/or return replacement text.
  
-You may prefer to simply copy ''/command/ext/dt.php'' to your new ''<command>.php'' file and modify it until it does what you need. You will certainly want to look at the documentation and code for the [[plugin:Date/Time]] command to see an example extension.+You may prefer to simply copy ''/command/ext/dt.php'' to your new ''<command>.php'' file and modify it until it does what you need. You will certainly want to look at the documentation and code for the [[Date/Time]] command to see an example extension.
  
 The base class ''CommandPluginExtension'' is provided below for your convenience. Refer to it for more information about overriding its functions. The base class ''CommandPluginExtension'' is provided below for your convenience. Refer to it for more information about overriding its functions.
plugin/command.1341073535.txt.gz · Last modified: 2012-06-30 18:25 by 95.152.216.241

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