summaryrefslogtreecommitdiff
path: root/platform/www/lib/plugins/markdowku/syntax/escapespecialchars.php
diff options
context:
space:
mode:
Diffstat (limited to 'platform/www/lib/plugins/markdowku/syntax/escapespecialchars.php')
-rw-r--r--platform/www/lib/plugins/markdowku/syntax/escapespecialchars.php94
1 files changed, 94 insertions, 0 deletions
diff --git a/platform/www/lib/plugins/markdowku/syntax/escapespecialchars.php b/platform/www/lib/plugins/markdowku/syntax/escapespecialchars.php
new file mode 100644
index 0000000..b27b7c0
--- /dev/null
+++ b/platform/www/lib/plugins/markdowku/syntax/escapespecialchars.php
@@ -0,0 +1,94 @@
+<?php
+/*
+ * Unescape escaped backslash. \\\\ -> \
+ * This is in a separate class as it needs a higher priority than the other
+ * escapes.
+ */
+
+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_escapespecialchars extends DokuWiki_Syntax_Plugin {
+
+ function getType() { return 'substition'; }
+ function getPType() { return 'normal'; }
+ function getSort() { return 61; }
+
+ function connectTo($mode) {
+ $this->Lexer->addSpecialPattern(
+ '(?<!\\\\)\\\\`',
+ $mode,
+ 'plugin_markdowku_escapespecialchars');
+ $this->Lexer->addSpecialPattern(
+ '(?<!\\\\)\\\\\*',
+ $mode,
+ 'plugin_markdowku_escapespecialchars');
+ $this->Lexer->addSpecialPattern(
+ '(?<!\\\\)\\\\_',
+ $mode,
+ 'plugin_markdowku_escapespecialchars');
+ $this->Lexer->addSpecialPattern(
+ '(?<!\\\\)\\\\\{',
+ $mode,
+ 'plugin_markdowku_escapespecialchars');
+ $this->Lexer->addSpecialPattern(
+ '(?<!\\\\)\\\\\}',
+ $mode,
+ 'plugin_markdowku_escapespecialchars');
+ $this->Lexer->addSpecialPattern(
+ '(?<!\\\\)\\\\\[',
+ $mode,
+ 'plugin_markdowku_escapespecialchars');
+ $this->Lexer->addSpecialPattern(
+ '(?<!\\\\)\\\\\]',
+ $mode,
+ 'plugin_markdowku_escapespecialchars');
+ $this->Lexer->addSpecialPattern(
+ '(?<!\\\\)\\\\\(',
+ $mode,
+ 'plugin_markdowku_escapespecialchars');
+ $this->Lexer->addSpecialPattern(
+ '(?<!\\\\)\\\\\)',
+ $mode,
+ 'plugin_markdowku_escapespecialchars');
+ $this->Lexer->addSpecialPattern(
+ '(?<!\\\\)\\\\>',
+ $mode,
+ 'plugin_markdowku_escapespecialchars');
+ $this->Lexer->addSpecialPattern(
+ '(?<!\\\\)\\\\\#',
+ $mode,
+ 'plugin_markdowku_escapespecialchars');
+ $this->Lexer->addSpecialPattern(
+ '(?<!\\\\)\\\\\+',
+ $mode,
+ 'plugin_markdowku_escapespecialchars');
+ $this->Lexer->addSpecialPattern(
+ '(?<!\\\\)\\\\\-',
+ $mode,
+ 'plugin_markdowku_escapespecialchars');
+ $this->Lexer->addSpecialPattern(
+ '(?<!\\\\)\\\\\-',
+ $mode,
+ 'plugin_markdowku_escapespecialchars');
+ $this->Lexer->addSpecialPattern(
+ '(?<!\\\\)\\\\\.',
+ $mode,
+ 'plugin_markdowku_escapespecialchars');
+ $this->Lexer->addSpecialPattern(
+ '(?<!\\\\)\\\\!',
+ $mode,
+ 'plugin_markdowku_escapespecialchars');
+ }
+
+ function handle($match, $state, $pos, Doku_Handler $handler) {
+ return array($state, $match);
+ }
+
+ function render($mode, Doku_Renderer $renderer, $data) {
+ $renderer->doc .= substr($data[1], -1);
+ return true;
+ }
+}
+//Setup VIM: ex: et ts=4 enc=utf-8 :