aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJulian Fagir <gnrp@komkon2.de>2014-03-08 13:08:54 +0100
committerMichael Hamann <michael@content-space.de>2014-03-08 13:08:54 +0100
commit0d73e52b6be326303591a21c0c4d6ee9232d9b1b (patch)
tree5a068fcfce5a3e1539a38d0531534811cff60806
parent59ac7beaa56f2b43310b88bceca6c68a685f19e6 (diff)
downloaddokuwiki-em_fix.tar.gz
dokuwiki-em_fix.zip
Another attempt at fixing combinations of em and linksem_fix
-rw-r--r--inc/parser/parser.php93
1 files changed, 49 insertions, 44 deletions
diff --git a/inc/parser/parser.php b/inc/parser/parser.php
index 252bd9170..47d77a15a 100644
--- a/inc/parser/parser.php
+++ b/inc/parser/parser.php
@@ -357,53 +357,58 @@ class Doku_Parser_Mode_hr extends Doku_Parser_Mode {
*/
class Doku_Parser_Mode_formatting extends Doku_Parser_Mode {
var $type;
-
- var $formatting = array (
- 'strong' => array (
- 'entry'=>'\*\*(?=.*\*\*)',
- 'exit'=>'\*\*',
- 'sort'=>70
- ),
-
- 'emphasis'=> array (
- 'entry'=>'//(?=[^\x00]*[^:])', //hack for bugs #384 #763 #1468
- 'exit'=>'//',
- 'sort'=>80
- ),
-
- 'underline'=> array (
- 'entry'=>'__(?=.*__)',
- 'exit'=>'__',
- 'sort'=>90
- ),
-
- 'monospace'=> array (
- 'entry'=>'\x27\x27(?=.*\x27\x27)',
- 'exit'=>'\x27\x27',
- 'sort'=>100
- ),
-
- 'subscript'=> array (
- 'entry'=>'<sub>(?=.*</sub>)',
- 'exit'=>'</sub>',
- 'sort'=>110
- ),
-
- 'superscript'=> array (
- 'entry'=>'<sup>(?=.*</sup>)',
- 'exit'=>'</sup>',
- 'sort'=>120
- ),
-
- 'deleted'=> array (
- 'entry'=>'<del>(?=.*</del>)',
- 'exit'=>'</del>',
- 'sort'=>130
- ),
- );
+ var $formatting;
function Doku_Parser_Mode_formatting($type) {
global $PARSER_MODES;
+ $ltrs = '\w';
+ $gunk = '/\#~:.?+=&%@!\-\[\]';
+ $punc = '.:?\-;,';
+ $any = $ltrs.$gunk.$punc;
+
+ $this->formatting = array (
+ 'strong' => array (
+ 'entry'=>'\*\*(?=.*\*\*)',
+ 'exit'=>'\*\*',
+ 'sort'=>70
+ ),
+
+ 'emphasis'=> array (
+ 'entry'=>'//(?=.*(?:[^:]//|//[^'.$any.']))',
+ 'exit'=>'//',
+ 'sort'=>80
+ ),
+
+ 'underline'=> array (
+ 'entry'=>'__(?=.*__)',
+ 'exit'=>'__',
+ 'sort'=>90
+ ),
+
+ 'monospace'=> array (
+ 'entry'=>'\x27\x27(?=.*\x27\x27)',
+ 'exit'=>'\x27\x27',
+ 'sort'=>100
+ ),
+
+ 'subscript'=> array (
+ 'entry'=>'<sub>(?=.*</sub>)',
+ 'exit'=>'</sub>',
+ 'sort'=>110
+ ),
+
+ 'superscript'=> array (
+ 'entry'=>'<sup>(?=.*</sup>)',
+ 'exit'=>'</sup>',
+ 'sort'=>120
+ ),
+
+ 'deleted'=> array (
+ 'entry'=>'<del>(?=.*</del>)',
+ 'exit'=>'</del>',
+ 'sort'=>130
+ ),
+ );
if ( !array_key_exists($type, $this->formatting) ) {
trigger_error('Invalid formatting type '.$type, E_USER_WARNING);