diff options
-rw-r--r-- | conf/dokuwiki.php | 2 | ||||
-rw-r--r-- | inc/parser/parser.php | 26 | ||||
-rw-r--r-- | lib/plugins/config/lang/en/lang.php | 5 | ||||
-rw-r--r-- | lib/plugins/config/settings/config.metadata.php | 2 |
4 files changed, 21 insertions, 14 deletions
diff --git a/conf/dokuwiki.php b/conf/dokuwiki.php index d0ad4f4f7..71a61f733 100644 --- a/conf/dokuwiki.php +++ b/conf/dokuwiki.php @@ -30,7 +30,7 @@ $conf['fullpath'] = 0; //show full path of the document or re $conf['recent'] = 20; //how many entries to show in recent $conf['breadcrumbs'] = 10; //how many recent visited pages to show $conf['youarehere'] = 0; //show "You are here" navigation? 0|1 -$conf['typography'] = 1; //convert quotes, dashes and stuff to typographic equivalents? 0|1 +$conf['typography'] = 1; //smartquote conversion 0=off, 1=doublequotes, 2=all quotes $conf['htmlok'] = 0; //may raw HTML be embedded? This may break layout and XHTML validity 0|1 $conf['phpok'] = 0; //may PHP code be embedded? Never do this on the internet! 0|1 $conf['dformat'] = 'Y/m/d H:i'; //dateformat accepted by PHPs date() function diff --git a/inc/parser/parser.php b/inc/parser/parser.php index ee6a8beae..747c60333 100644 --- a/inc/parser/parser.php +++ b/inc/parser/parser.php @@ -702,9 +702,6 @@ class Doku_Parser_Mode_wordblock extends Doku_Parser_Mode { } //------------------------------------------------------------------- -/** -* @TODO Quotes and 640x480 are not supported - just straight replacements here -*/ class Doku_Parser_Mode_entity extends Doku_Parser_Mode { // A list var $entities = array(); @@ -758,18 +755,23 @@ class Doku_Parser_Mode_multiplyentity extends Doku_Parser_Mode { 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 - $this->Lexer->addSpecialPattern( - "(?<=^|$ws)'(?=$nws)",$mode,'singlequoteopening' - ); - $this->Lexer->addSpecialPattern( - "(?<=^|$nws)'(?=$|$ws)",$mode,'singlequoteclosing' - ); - $this->Lexer->addSpecialPattern( - "(?<=^|$nws)'(?=$|$nws)",$mode,'apostrophe' - ); + if($conf['typography'] == 2){ + $this->Lexer->addSpecialPattern( + "(?<=^|$ws)'(?=$nws)",$mode,'singlequoteopening' + ); + $this->Lexer->addSpecialPattern( + "(?<=^|$nws)'(?=$|$ws)",$mode,'singlequoteclosing' + ); + $this->Lexer->addSpecialPattern( + "(?<=^|$nws)'(?=$|$nws)",$mode,'apostrophe' + ); + } + $this->Lexer->addSpecialPattern( "(?<=^|$ws)\"(?=$nws)",$mode,'doublequoteopening' ); diff --git a/lib/plugins/config/lang/en/lang.php b/lib/plugins/config/lang/en/lang.php index ad03c95d1..932a00b05 100644 --- a/lib/plugins/config/lang/en/lang.php +++ b/lib/plugins/config/lang/en/lang.php @@ -154,6 +154,11 @@ $lang['ftp____user'] = 'FTP user name for safemode hack'; $lang['ftp____pass'] = 'FTP password for safemode hack'; $lang['ftp____root'] = 'FTP root directory for safemode hack'; +/* typography options */ +$lang['typography_o_0'] = 'none'; +$lang['typography_o_1'] = 'Double quotes only'; +$lang['typography_o_2'] = 'All quotes (might not always work)'; + /* userewrite options */ $lang['userewrite_o_0'] = 'none'; $lang['userewrite_o_1'] = '.htaccess'; diff --git a/lib/plugins/config/settings/config.metadata.php b/lib/plugins/config/settings/config.metadata.php index 7aecf43ef..9c3d16e1c 100644 --- a/lib/plugins/config/settings/config.metadata.php +++ b/lib/plugins/config/settings/config.metadata.php @@ -92,7 +92,7 @@ $meta['recent'] = array('numeric'); $meta['breadcrumbs'] = array('numeric'); $meta['youarehere'] = array('onoff'); $meta['fullpath'] = array('onoff'); -$meta['typography'] = array('onoff'); +$meta['typography'] = array('multichoice','_choices' => array(0,1,2)); $meta['dformat'] = array('string'); $meta['signature'] = array('string'); $meta['toptoclevel'] = array('multichoice','_choices' => array(1,2,3,4,5)); // 5 toc levels |