diff options
author | Andreas Gohr <andi@splitbrain.org> | 2007-05-13 10:40:24 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2007-05-13 10:40:24 +0200 |
commit | 57d757d195f73c836bb15fc1cd1d01fa0dcc75b1 (patch) | |
tree | 352ac377c2f568e7e9e1229d81733a95011d753c /inc/parser | |
parent | d613051ae9b5db0528293dbe6d918df6dbd7dc4e (diff) | |
download | rpg-57d757d195f73c836bb15fc1cd1d01fa0dcc75b1.tar.gz rpg-57d757d195f73c836bb15fc1cd1d01fa0dcc75b1.tar.bz2 |
distinction between apostrophes and single quotes FS#1127
This patch adds another parser mode for apostrophes. Now single quote closing
markers are handled different from apostrophes for better local typograpy
support.
Needs testing and languages updates.
darcs-hash:20070513084024-7ad00-d20fe093a093c265d357b178e199c1596b484996.gz
Diffstat (limited to 'inc/parser')
-rw-r--r-- | inc/parser/handler.php | 5 | ||||
-rw-r--r-- | inc/parser/metadata.php | 5 | ||||
-rw-r--r-- | inc/parser/parser.php | 14 | ||||
-rw-r--r-- | inc/parser/renderer.php | 2 | ||||
-rw-r--r-- | inc/parser/xhtml.php | 5 |
5 files changed, 27 insertions, 4 deletions
diff --git a/inc/parser/handler.php b/inc/parser/handler.php index d8e6c79ea..0a021987f 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -407,6 +407,11 @@ class Doku_Handler { return true; } + function apostrophe($match, $state, $pos) { + $this->_addCall('apostrophe',array(), $pos); + return true; + } + function doublequoteopening($match, $state, $pos) { $this->_addCall('doublequoteopening',array(), $pos); return true; diff --git a/inc/parser/metadata.php b/inc/parser/metadata.php index 85e6eefed..846bbff23 100644 --- a/inc/parser/metadata.php +++ b/inc/parser/metadata.php @@ -255,6 +255,11 @@ class Doku_Renderer_metadata extends Doku_Renderer { if ($this->capture) $this->doc .= $lang['singlequoteclosing']; } + function apostrophe() { + global $lang; + $this->doc .= $lang['apostrophe']; + } + function doublequoteopening(){ global $lang; if ($this->capture) $this->doc .= $lang['doublequoteopening']; diff --git a/inc/parser/parser.php b/inc/parser/parser.php index 0d88580d2..577e1137c 100644 --- a/inc/parser/parser.php +++ b/inc/parser/parser.php @@ -758,19 +758,25 @@ class Doku_Parser_Mode_multiplyentity extends Doku_Parser_Mode { class Doku_Parser_Mode_quotes extends Doku_Parser_Mode { function connectTo($mode) { + $ws = '[\s/\#~:\.?+=&%@!\-;,\x28\x29\]\[{}><"\']'; // whitespace + $nws = '[^\s/\#~:\.?+=&%@!\-;,\x28\x29\]\[{}><"\']'; // non whitespace $this->Lexer->addSpecialPattern( - '(?<=^|\s)\'(?=\S)',$mode,'singlequoteopening' + "(?<=^|$ws)'(?=$nws)",$mode,'singlequoteopening' ); $this->Lexer->addSpecialPattern( - '(?<=^|\S)\'',$mode,'singlequoteclosing' + "(?<=^|$nws)'(?=$|$ws)",$mode,'singlequoteclosing' ); $this->Lexer->addSpecialPattern( - '(?<=^|\s)"(?=\S)',$mode,'doublequoteopening' + "(?<=^|$nws)'(?=$|$nws)",$mode,'apostrophe' ); $this->Lexer->addSpecialPattern( - '(?<=^|\S)"',$mode,'doublequoteclosing' + "(?<=^|$ws)\"(?=$nws)",$mode,'doublequoteopening' ); + $this->Lexer->addSpecialPattern( + "(?<=^|$nws)\"",$mode,'doublequoteclosing' + ); + } diff --git a/inc/parser/renderer.php b/inc/parser/renderer.php index 1b6340445..808261ddf 100644 --- a/inc/parser/renderer.php +++ b/inc/parser/renderer.php @@ -177,6 +177,8 @@ class Doku_Renderer extends DokuWiki_Plugin { function singlequoteclosing() {} + function apostrophe() {} + function doublequoteopening() {} function doublequoteclosing() {} diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index fad6f6120..438410651 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -455,6 +455,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $this->doc .= $lang['singlequoteclosing']; } + function apostrophe() { + global $lang; + $this->doc .= $lang['singlequoteclosing']; + } + function doublequoteopening() { global $lang; $this->doc .= $lang['doublequoteopening']; |