summaryrefslogtreecommitdiff
path: root/platform/www/lib/plugins/include/syntax/locallink.php
diff options
context:
space:
mode:
Diffstat (limited to 'platform/www/lib/plugins/include/syntax/locallink.php')
-rw-r--r--platform/www/lib/plugins/include/syntax/locallink.php45
1 files changed, 45 insertions, 0 deletions
diff --git a/platform/www/lib/plugins/include/syntax/locallink.php b/platform/www/lib/plugins/include/syntax/locallink.php
new file mode 100644
index 0000000..2a6a612
--- /dev/null
+++ b/platform/www/lib/plugins/include/syntax/locallink.php
@@ -0,0 +1,45 @@
+<?php
+/**
+ * Include plugin (locallink component)
+ *
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ * @author Michael Hamann <michael@content-space.de>
+ */
+
+class syntax_plugin_include_locallink extends DokuWiki_Syntax_Plugin {
+
+ function getType() {
+ return 'formatting';
+ }
+
+ function getSort() {
+ return 50;
+ }
+
+ function handle($match, $state, $pos, Doku_Handler $handler) {
+ // this is a syntax plugin that doesn't offer any syntax, so there's nothing to handle by the parser
+ }
+
+ /**
+ * Displays a local link to an included page
+ *
+ * @author Michael Hamann <michael@content-space.de>
+ */
+ function render($mode, Doku_Renderer $renderer, $data) {
+ global $ID;
+ if ($mode == 'xhtml') {
+ /** @var Doku_Renderer_xhtml $renderer */
+ list($hash, $name, $id) = $data;
+ // construct title in the same way it would be done for internal links
+ $default = $renderer->_simpleTitle($id);
+ $name = $renderer->_getLinkTitle($name, $default, $isImage, $id);
+ $title = $ID.' ↵';
+ $renderer->doc .= '<a href="#'.$hash.'" title="'.$title.'" class="wikilink1">';
+ $renderer->doc .= $name;
+ $renderer->doc .= '</a>';
+ return true;
+ }
+ return false;
+ }
+}
+// vim:ts=4:sw=4:et: