summaryrefslogtreecommitdiff
path: root/platform/www/lib/plugins/markdowku/syntax/codespans3.php
diff options
context:
space:
mode:
authorYaco <franco@reevo.org>2022-03-08 13:08:34 +0000
committerYaco <franco@reevo.org>2022-03-08 13:08:34 +0000
commitc985c40d3f3fc6a2be3be3186df3bf2f32189475 (patch)
treecee11f5e5a7e351ee0fec36d58d72cbee4f7e49b /platform/www/lib/plugins/markdowku/syntax/codespans3.php
first commit after acervus codebase
Diffstat (limited to 'platform/www/lib/plugins/markdowku/syntax/codespans3.php')
-rw-r--r--platform/www/lib/plugins/markdowku/syntax/codespans3.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/platform/www/lib/plugins/markdowku/syntax/codespans3.php b/platform/www/lib/plugins/markdowku/syntax/codespans3.php
new file mode 100644
index 0000000..b6b342b
--- /dev/null
+++ b/platform/www/lib/plugins/markdowku/syntax/codespans3.php
@@ -0,0 +1,34 @@
+<?php
+/*
+ * Codespans enclosed within three backticks: ```...```
+ */
+
+if(!defined('DOKU_INC')) die();
+if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
+require_once(DOKU_PLUGIN.'syntax.php');
+
+class syntax_plugin_markdowku_codespans3 extends DokuWiki_Syntax_Plugin {
+
+ function getType() { return 'formatting'; }
+ function getPType() { return 'normal'; }
+ function getSort() { return 97; }
+
+ function connectTo($mode) {
+ $this->Lexer->addSpecialPattern(
+ '(?<!`)```(?!`).+?(?<!`)```(?!`)',
+ $mode,
+ 'plugin_markdowku_codespans3');
+ }
+
+ function handle($match, $state, $pos, Doku_Handler $handler) {
+ return array($match);
+ }
+
+ function render($mode, Doku_Renderer $renderer, $data) {
+ $renderer->monospace_open();
+ $renderer->cdata(substr($data[0], 3, -3));
+ $renderer->monospace_close();
+ return true;
+ }
+}
+//Setup VIM: ex: et ts=4 enc=utf-8 :