summaryrefslogtreecommitdiff
path: root/platform/www/lib/plugins/include/syntax/sorttag.php
diff options
context:
space:
mode:
Diffstat (limited to 'platform/www/lib/plugins/include/syntax/sorttag.php')
-rw-r--r--platform/www/lib/plugins/include/syntax/sorttag.php60
1 files changed, 60 insertions, 0 deletions
diff --git a/platform/www/lib/plugins/include/syntax/sorttag.php b/platform/www/lib/plugins/include/syntax/sorttag.php
new file mode 100644
index 0000000..c7704ba
--- /dev/null
+++ b/platform/www/lib/plugins/include/syntax/sorttag.php
@@ -0,0 +1,60 @@
+<?php
+
+/**
+ * Include plugin sort order tag, idea and parts of the code copied from the indexmenu plugin.
+ *
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ * @author Samuele Tognini <samuele@netsons.org>
+ * @author Michael Hamann <michael@content-space.de>
+ *
+ */
+class syntax_plugin_include_sorttag extends DokuWiki_Syntax_Plugin {
+
+ /**
+ * What kind of syntax are we?
+ */
+ public function getType(){
+ return 'substition';
+ }
+
+ /**
+ * The paragraph type - block, we don't need paragraph tags
+ *
+ * @return string The paragraph type
+ */
+ public function getPType() {
+ return 'block';
+ }
+
+ /**
+ * Where to sort in?
+ */
+ public function getSort(){
+ return 139;
+ }
+
+ /**
+ * Connect pattern to lexer
+ */
+ public function connectTo($mode) {
+ $this->Lexer->addSpecialPattern('{{include_n>.+?}}',$mode,'plugin_include_sorttag');
+ }
+
+ /**
+ * Handle the match
+ */
+ public function handle($match, $state, $pos, Doku_Handler $handler){
+ $match = substr($match,12,-2);
+ return array($match);
+ }
+
+ /**
+ * Render output
+ */
+ public function render($mode, Doku_Renderer $renderer, $data) {
+ if ($mode === 'metadata') {
+ /** @var Doku_Renderer_metadata $renderer */
+ $renderer->meta['include_n'] = $data[0];
+ }
+ }
+}