diff options
author | Guy Brand <gb@unistra.fr> | 2012-09-10 17:04:45 +0200 |
---|---|---|
committer | Guy Brand <gb@unistra.fr> | 2012-09-10 17:04:45 +0200 |
commit | 0f8ac4e8c5872a6b68b350f96a9ecde0291edefa (patch) | |
tree | ad7938bb4143d5e5a38fd7a8d131e4171aec657d /inc/parser | |
parent | 58ec8fa9128e4581749955de87530f432e387588 (diff) | |
parent | b31fcef02fd24b3e746c9618e77152c7b84c2f2a (diff) | |
download | rpg-0f8ac4e8c5872a6b68b350f96a9ecde0291edefa.tar.gz rpg-0f8ac4e8c5872a6b68b350f96a9ecde0291edefa.tar.bz2 |
Merge branch 'master' into stable
Diffstat (limited to 'inc/parser')
-rw-r--r-- | inc/parser/code.php | 5 | ||||
-rw-r--r-- | inc/parser/metadata.php | 8 | ||||
-rw-r--r-- | inc/parser/parser.php | 14 | ||||
-rw-r--r-- | inc/parser/renderer.php | 4 | ||||
-rw-r--r-- | inc/parser/xhtml.php | 35 |
5 files changed, 37 insertions, 29 deletions
diff --git a/inc/parser/code.php b/inc/parser/code.php index 4d94dcf4e..21fb0dc3c 100644 --- a/inc/parser/code.php +++ b/inc/parser/code.php @@ -16,11 +16,12 @@ class Doku_Renderer_code extends Doku_Renderer { * When the correct block was found it exits the script. */ function code($text, $language = NULL, $filename='' ) { + global $INPUT; if(!$language) $language = 'txt'; if(!$filename) $filename = 'snippet.'.$language; - $filename = basename($filename); + $filename = utf8_basename($filename); - if($this->_codeblock == $_REQUEST['codeblock']){ + if($this->_codeblock == $INPUT->str('codeblock')){ header("Content-Type: text/plain; charset=utf-8"); header("Content-Disposition: attachment; filename=$filename"); header("X-Robots-Tag: noindex"); diff --git a/inc/parser/metadata.php b/inc/parser/metadata.php index 136c37531..8bfdc3b9c 100644 --- a/inc/parser/metadata.php +++ b/inc/parser/metadata.php @@ -455,16 +455,16 @@ class Doku_Renderer_metadata extends Doku_Renderer { global $conf; $isImage = false; - if (is_null($title)){ + if (is_array($title)){ + if($title['title']) return '['.$title['title'].']'; + } else if (is_null($title) || trim($title)==''){ if (useHeading('content') && $id){ $heading = p_get_first_heading($id,METADATA_DONT_RENDER); if ($heading) return $heading; } return $default; - } else if (is_string($title)){ + } else { return $title; - } else if (is_array($title)){ - if($title['title']) return '['.$title['title'].']'; } } diff --git a/inc/parser/parser.php b/inc/parser/parser.php index 68d4e4569..915899f53 100644 --- a/inc/parser/parser.php +++ b/inc/parser/parser.php @@ -52,6 +52,9 @@ class Doku_Parser { var $Handler; + /** + * @var Doku_Lexer $Lexer + */ var $Lexer; var $modes = array(); @@ -59,11 +62,11 @@ class Doku_Parser { var $connected = false; function addBaseMode(& $BaseMode) { - $this->modes['base'] = & $BaseMode; + $this->modes['base'] =& $BaseMode; if ( !$this->Lexer ) { $this->Lexer = new Doku_Lexer($this->Handler,'base', true); } - $this->modes['base']->Lexer = & $this->Lexer; + $this->modes['base']->Lexer =& $this->Lexer; } /** @@ -75,7 +78,7 @@ class Doku_Parser { $this->addBaseMode(new Doku_Parser_Mode_base()); } $Mode->Lexer = & $this->Lexer; - $this->modes[$name] = & $Mode; + $this->modes[$name] =& $Mode; } function connectModes() { @@ -134,6 +137,9 @@ class Doku_Parser { */ class Doku_Parser_Mode { + /** + * @var Doku_Lexer $Lexer + */ var $Lexer; var $allowedModes = array(); @@ -929,7 +935,7 @@ class Doku_Parser_Mode_windowssharelink extends Doku_Parser_Mode { var $pattern; function preConnect() { - $this->pattern = "\\\\\\\\\w+?(?:\\\\[\w$]+)+"; + $this->pattern = "\\\\\\\\\w+?(?:\\\\[\w-$]+)+"; } function connectTo($mode) { diff --git a/inc/parser/renderer.php b/inc/parser/renderer.php index 7002fd0cb..0923e6896 100644 --- a/inc/parser/renderer.php +++ b/inc/parser/renderer.php @@ -20,6 +20,8 @@ class Doku_Renderer extends DokuWiki_Plugin { 'toc' => true, // render the TOC? ); + var $doc = ''; + // keep some config options var $acronyms = array(); var $smileys = array(); @@ -75,7 +77,7 @@ class Doku_Renderer extends DokuWiki_Plugin { foreach ( $instructions as $instruction ) { // execute the callback against ourself if (method_exists($this,$instruction[0])) { - call_user_func_array(array($this, $instruction[0]),$instruction[1]); + call_user_func_array(array($this, $instruction[0]), $instruction[1] ? $instruction[1] : array()); } } } diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index bfa22d066..b4e78a530 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -29,7 +29,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { var $doc = ''; // will contain the whole document var $toc = array(); // will contain the Table of Contents - private $sectionedits = array(); // A stack of section edit data + var $sectionedits = array(); // A stack of section edit data var $headers = array(); var $footnotes = array(); @@ -109,7 +109,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { // open the footnote and set the anchor and backlink $this->doc .= '<div class="fn">'; - $this->doc .= '<sup><a href="#fnt__'.$id.'" id="fn__'.$id.'" name="fn__'.$id.'" class="fn_bot">'; + $this->doc .= '<sup><a href="#fnt__'.$id.'" id="fn__'.$id.'" class="fn_bot">'; $this->doc .= $id.')</a></sup> '.DOKU_LF; // get any other footnotes that use the same markup @@ -118,7 +118,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { if (count($alt)) { foreach ($alt as $ref) { // set anchor and backlink for the other footnotes - $this->doc .= ', <sup><a href="#fnt__'.($ref+1).'" id="fn__'.($ref+1).'" name="fn__'.($ref+1).'" class="fn_bot">'; + $this->doc .= ', <sup><a href="#fnt__'.($ref+1).'" id="fn__'.($ref+1).'" class="fn_bot">'; $this->doc .= ($ref+1).')</a></sup> '.DOKU_LF; } } @@ -181,9 +181,9 @@ class Doku_Renderer_xhtml extends Doku_Renderer { if ($level <= $conf['maxseclevel']) { $this->doc .= ' class="' . $this->startSectionEdit($pos, 'section', $text) . '"'; } - $this->doc .= '><a name="'.$hid.'" id="'.$hid.'">'; + $this->doc .= ' id="'.$hid.'">'; $this->doc .= $this->_xmlEntities($text); - $this->doc .= "</a></h$level>".DOKU_LF; + $this->doc .= "</h$level>".DOKU_LF; } function section_open($level) { @@ -316,7 +316,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } // output the footnote reference and link - $this->doc .= '<sup><a href="#fn__'.$id.'" name="fnt__'.$id.'" id="fnt__'.$id.'" class="fn_top">'.$id.')</a></sup>'; + $this->doc .= '<sup><a href="#fn__'.$id.'" id="fnt__'.$id.'" class="fn_top">'.$id.')</a></sup>'; } function listu_open() { @@ -358,6 +358,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { /** * Execute PHP code if allowed * + * @param string $text PHP code that is either executed or printed * @param string $wrapper html element to wrap result if $conf['phpok'] is okff * * @author Andreas Gohr <andi@splitbrain.org> @@ -382,6 +383,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { /** * Insert HTML if allowed * + * @param string $text html text * @param string $wrapper html element to wrap result if $conf['htmlok'] is okff * * @author Andreas Gohr <andi@splitbrain.org> @@ -471,8 +473,8 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $title = $this->_xmlEntities($this->acronyms[$acronym]); - $this->doc .= '<acronym title="'.$title - .'">'.$this->_xmlEntities($acronym).'</acronym>'; + $this->doc .= '<abbr title="'.$title + .'">'.$this->_xmlEntities($acronym).'</abbr>'; } else { $this->doc .= $this->_xmlEntities($acronym); @@ -483,7 +485,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { if ( array_key_exists($smiley, $this->smileys) ) { $title = $this->_xmlEntities($this->smileys[$smiley]); $this->doc .= '<img src="'.DOKU_BASE.'lib/images/smileys/'.$this->smileys[$smiley]. - '" class="middle" alt="'. + '" class="icon" alt="'. $this->_xmlEntities($smiley).'" />'; } else { $this->doc .= $this->_xmlEntities($smiley); @@ -549,7 +551,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { global $ID; $name = $this->_getLinkTitle($name, $hash, $isImage); $hash = $this->_headerToLink($hash); - $title = $ID.' ↵'; + $title = $ID.' ↵'; $this->doc .= '<a href="#'.$hash.'" title="'.$title.'" class="wikilink1">'; $this->doc .= $name; $this->doc .= '</a>'; @@ -566,6 +568,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { function internallink($id, $name = NULL, $search=NULL,$returnonly=false,$linktype='content') { global $conf; global $ID; + global $INFO; $params = ''; $parts = explode('?', $id, 2); @@ -610,7 +613,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $link['pre'] = ''; $link['suf'] = ''; // highlight link to current page - if ($id == $ID) { + if ($id == $INFO['id']) { $link['pre'] = '<span class="curid">'; $link['suf'] = '</span>'; } @@ -1066,7 +1069,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { // return the title of the picture if (!$title) { // just show the sourcename - $title = $this->_xmlEntities(basename(noNS($src))); + $title = $this->_xmlEntities(utf8_basename(noNS($src))); } return $title; } @@ -1074,10 +1077,6 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $ret .= '<img src="'.ml($src,array('w'=>$width,'h'=>$height,'cache'=>$cache)).'"'; $ret .= ' class="media'.$align.'"'; - // make left/right alignment for no-CSS view work (feeds) - if($align == 'right') $ret .= ' align="right"'; - if($align == 'left') $ret .= ' align="left"'; - if ($title) { $ret .= ' title="' . $title . '"'; $ret .= ' alt="' . $title .'"'; @@ -1099,7 +1098,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { // return the title of the flash if (!$title) { // just show the sourcename - $title = basename(noNS($src)); + $title = utf8_basename(noNS($src)); } return $this->_xmlEntities($title); } @@ -1118,7 +1117,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $ret .= $this->_xmlEntities($title); }else{ // just show the sourcename - $ret .= $this->_xmlEntities(basename(noNS($src))); + $ret .= $this->_xmlEntities(utf8_basename(noNS($src))); } return $ret; |