From 74c9c34a4574a44b4f807efb2f112d7d54612c35 Mon Sep 17 00:00:00 2001 From: David Marec Date: Fri, 3 Apr 2020 23:16:29 +0200 Subject: [PATCH] Media wiki Orphan plugin. Review syntax. make it work with dokuwiki "greebo" --- conf/default.php | 7 ++++++ conf/metadata.php | 6 ++++++ manager.dat | 2 ++ plugin.info.txt | 7 ++++++ syntax.php | 54 +++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 76 insertions(+) create mode 100644 conf/default.php create mode 100644 conf/metadata.php create mode 100644 manager.dat create mode 100644 plugin.info.txt create mode 100644 syntax.php diff --git a/conf/default.php b/conf/default.php new file mode 100644 index 0000000..52ed36d --- /dev/null +++ b/conf/default.php @@ -0,0 +1,7 @@ + array('NetBSD', 'OpenBSD', 'FreeBSD', 'DragonFlyBSD')); +//Setup VIM: ex: et ts=2 enc=utf-8 : diff --git a/manager.dat b/manager.dat new file mode 100644 index 0000000..a947c11 --- /dev/null +++ b/manager.dat @@ -0,0 +1,2 @@ +downloadurl=https://komkon2.de/manlink/manlink.tgz +installed=Wed, 08 May 2019 12:55:20 +0000 diff --git a/plugin.info.txt b/plugin.info.txt new file mode 100644 index 0000000..ca12af9 --- /dev/null +++ b/plugin.info.txt @@ -0,0 +1,7 @@ +base manlink +author Julian Fagir +email gnrp@KomKon2.de +date 2012-11-25 +name Manpage link plugin +desc Transforms manpage descriptions to manpage links +url http://www.komkon2.de/dokuwiki/doku.php?id=projects:manlink diff --git a/syntax.php b/syntax.php new file mode 100644 index 0000000..cee0a2a --- /dev/null +++ b/syntax.php @@ -0,0 +1,54 @@ +Lexer->addSpecialPattern( + '\!?[a-zA-Z0-9_.+\[\]-]*\([0-9]\)', + $mode, + 'plugin_manlink'); + } + + function handle($match, $state, $pos, Doku_Handler $handler){ + if ($state != DOKU_LEXER_SPECIAL) + return false; + + if (substr($match, 0, 1) == "!") { + $handler->_addCall('cdata', array(substr($match, 1)), $pos); + return true; + } + + $mantarget = $this->getconf('mantarget'); + $manpage = preg_replace('/^([a-zA-Z0-9_+\[\].-]*)\(([0-9])\)$/', '\1', $match); + $section = preg_replace('/^([a-zA-Z0-9_+\[\].-]*)\(([0-9])\)$/', '\2', $match); + + if ($mantarget == 'NetBSD') + $target = 'http://mdoc.su/n/'.$manpage.'.'.$section; + elseif ($mantarget == 'FreeBSD') + $target = 'http://mdoc.su/f/'.$manpage.'.'.$section; + elseif ($mantarget == 'OpenBSD') + $target = 'http://mdoc.su/o/'.$manpage.'.'.$section; + elseif ($mantarget == 'DragonFlyBSD') + $target = 'http://mdoc.su/d/'.$manpage.'.'.$section; + + $handler->_addCall('externallink', array($target, $match), $pos); + return true; + } + + function render($format, Doku_Renderer $renderer, $data) { + return true; + } +} + +?> -- 2.44.0