1*be906b56SAndreas Gohr<?php 2*be906b56SAndreas Gohr 3*be906b56SAndreas Gohrnamespace dokuwiki\Parsing\ParserMode; 4*be906b56SAndreas Gohr 5*be906b56SAndreas Gohrclass Quotes extends AbstractMode 6*be906b56SAndreas Gohr{ 7*be906b56SAndreas Gohr 8*be906b56SAndreas Gohr /** @inheritdoc */ 9*be906b56SAndreas Gohr public function connectTo($mode) 10*be906b56SAndreas Gohr { 11*be906b56SAndreas Gohr global $conf; 12*be906b56SAndreas Gohr 13*be906b56SAndreas Gohr $ws = '\s/\#~:+=&%@\-\x28\x29\]\[{}><"\''; // whitespace 14*be906b56SAndreas Gohr $punc = ';,\.?!'; 15*be906b56SAndreas Gohr 16*be906b56SAndreas Gohr if ($conf['typography'] == 2) { 17*be906b56SAndreas Gohr $this->Lexer->addSpecialPattern( 18*be906b56SAndreas Gohr "(?<=^|[$ws])'(?=[^$ws$punc])", 19*be906b56SAndreas Gohr $mode, 20*be906b56SAndreas Gohr 'singlequoteopening' 21*be906b56SAndreas Gohr ); 22*be906b56SAndreas Gohr $this->Lexer->addSpecialPattern( 23*be906b56SAndreas Gohr "(?<=^|[^$ws]|[$punc])'(?=$|[$ws$punc])", 24*be906b56SAndreas Gohr $mode, 25*be906b56SAndreas Gohr 'singlequoteclosing' 26*be906b56SAndreas Gohr ); 27*be906b56SAndreas Gohr $this->Lexer->addSpecialPattern( 28*be906b56SAndreas Gohr "(?<=^|[^$ws$punc])'(?=$|[^$ws$punc])", 29*be906b56SAndreas Gohr $mode, 30*be906b56SAndreas Gohr 'apostrophe' 31*be906b56SAndreas Gohr ); 32*be906b56SAndreas Gohr } 33*be906b56SAndreas Gohr 34*be906b56SAndreas Gohr $this->Lexer->addSpecialPattern( 35*be906b56SAndreas Gohr "(?<=^|[$ws])\"(?=[^$ws$punc])", 36*be906b56SAndreas Gohr $mode, 37*be906b56SAndreas Gohr 'doublequoteopening' 38*be906b56SAndreas Gohr ); 39*be906b56SAndreas Gohr $this->Lexer->addSpecialPattern( 40*be906b56SAndreas Gohr "\"", 41*be906b56SAndreas Gohr $mode, 42*be906b56SAndreas Gohr 'doublequoteclosing' 43*be906b56SAndreas Gohr ); 44*be906b56SAndreas Gohr } 45*be906b56SAndreas Gohr 46*be906b56SAndreas Gohr /** @inheritdoc */ 47*be906b56SAndreas Gohr public function getSort() 48*be906b56SAndreas Gohr { 49*be906b56SAndreas Gohr return 280; 50*be906b56SAndreas Gohr } 51*be906b56SAndreas Gohr} 52