diff --git a/_test/cases/inc/parser/parser_quotes.test.php b/_test/cases/inc/parser/parser_quotes.test.php index 90616424f043efb05a21af75affa11d717e08e79..9f191d6b081143c5635e0d2d51d610b8dae9e0e2 100644 --- a/_test/cases/inc/parser/parser_quotes.test.php +++ b/_test/cases/inc/parser/parser_quotes.test.php @@ -3,6 +3,12 @@ require_once 'parser.inc.php'; class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser { + function setup() { + parent::setup(); + global $conf; + $conf['typography'] = 2; + } + function TestOfDoku_Parser_Quotes() { $this->UnitTestCase('TestOfDoku_Parser_Quotes'); } @@ -255,7 +261,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser { array('cdata',array('s world')), array('singlequoteclosing',array()), array('doublequoteclosing',array()), - array('cdata',array('.'."\n")), + array('cdata',array(".\n")), array('p_close',array()), array('document_end',array()), ); diff --git a/inc/parser/parser.php b/inc/parser/parser.php index 747c60333721ec976458fc05c61554b2e703d9e8..709f063dae030c41ad0e94c9c6f6e6f725bc4db7 100644 --- a/inc/parser/parser.php +++ b/inc/parser/parser.php @@ -757,26 +757,26 @@ class Doku_Parser_Mode_quotes extends Doku_Parser_Mode { function connectTo($mode) { global $conf; - $ws = '[\s/\#~:+=&%@\-;,\x28\x29\]\[{}><"\']'; // whitespace - $nws = '[^\s/\#~:+=&%@\-;,\x28\x29\]\[{}><"\']'; // non whitespace + $ws = '\s/\#~:+=&%@\-\x28\x29\]\[{}><"\''; // whitespace + $punc = ';,\.?!'; if($conf['typography'] == 2){ $this->Lexer->addSpecialPattern( - "(?<=^|$ws)'(?=$nws)",$mode,'singlequoteopening' + "(?<=^|[$ws])'(?=[^$ws$punc])",$mode,'singlequoteopening' ); $this->Lexer->addSpecialPattern( - "(?<=^|$nws)'(?=$|$ws)",$mode,'singlequoteclosing' + "(?<=^|[^$ws]|[$punc])'(?=$|[$ws$punc])",$mode,'singlequoteclosing' ); $this->Lexer->addSpecialPattern( - "(?<=^|$nws)'(?=$|$nws)",$mode,'apostrophe' + "(?<=^|[^$ws$punc])'(?=$|[^$ws$punc])",$mode,'apostrophe' ); } $this->Lexer->addSpecialPattern( - "(?<=^|$ws)\"(?=$nws)",$mode,'doublequoteopening' + "(?<=^|[$ws])\"(?=[^$ws$punc])",$mode,'doublequoteopening' ); $this->Lexer->addSpecialPattern( - "(?<=^|$nws)\"",$mode,'doublequoteclosing' + "\"",$mode,'doublequoteclosing' );