From c471e6a6aee9997e62ce58c3e49dd8ecad28b92a Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 9 Jan 2010 13:21:16 +0100 Subject: fixed double encoding when embedding flash through image syntax --- inc/parser/xhtml.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 4d5333f7a..4ff5f18b8 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -1019,7 +1019,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $att['class'] = "media$align"; if($align == 'right') $att['align'] = 'right'; if($align == 'left') $att['align'] = 'left'; - $ret .= html_flashobject(ml($src,array('cache'=>$cache)),$width,$height, + $ret .= html_flashobject(ml($src,array('cache'=>$cache),true,'&'),$width,$height, array('quality' => 'high'), null, $att, -- cgit v1.2.3 From 67f9913d4a386fe65c9e72ca452b0fa91b010b12 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 15 Jan 2010 12:18:43 +0100 Subject: removed deprecated PHP4 construct Assigning the return value of new by reference is deprecated, PHP5's new automatically assigns by reference --- inc/parser/xhtml.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 4ff5f18b8..20acf4281 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -966,7 +966,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { }elseif($ext == 'jpg' || $ext == 'jpeg'){ //try to use the caption from IPTC/EXIF require_once(DOKU_INC.'inc/JpegMeta.php'); - $jpeg =& new JpegMeta(mediaFN($src)); + $jpeg =new JpegMeta(mediaFN($src)); if($jpeg !== false) $cap = $jpeg->getTitle(); if($cap){ $title = $this->_xmlEntities($cap); -- cgit v1.2.3 From 07c2b1c7ce9255456bf19c45cf9d34452cec2af1 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Thu, 19 Nov 2009 15:06:19 +0100 Subject: Add TABLE range marker for table editing darcs-hash:20091119140619-e4919-15efddc768526a6c1f6472f83ede17019144ffa3.gz --- inc/parser/xhtml.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 20acf4281..4e848ec1d 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -851,8 +851,9 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $this->doc .= ''.DOKU_LF; } - function table_close(){ + function table_close($begin, $end){ $this->doc .= '
'.DOKU_LF; + $this->doc .= ''; } function tablerow_open(){ -- cgit v1.2.3 From 90df9a4d69a2e467433b419b94fe799d11590539 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Thu, 4 Feb 2010 14:50:10 +0100 Subject: Rewrite section edit handling according to #1860 --- inc/parser/xhtml.php | 81 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 59 insertions(+), 22 deletions(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 4e848ec1d..ef62a3df9 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -29,6 +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 $headers = array(); var $footnotes = array(); @@ -39,6 +40,34 @@ class Doku_Renderer_xhtml extends Doku_Renderer { var $_counter = array(); // used as global counter, introduced for table classes var $_codeblock = 0; // counts the code and file blocks, used to provide download links + /** + * Register a new edit section range + * + * @param $type string The section type identifier + * @param $title string The section title + * @param $start int The byte position for the edit start + * @return string A marker class for the starting HTML element + * @author Adrian Lang + */ + protected function startSectionEdit($start, $type, $title) { + static $lastsecid = 0; + $this->sectionedits[] = array(++$lastsecid, $start, $type, $title); + return 'sectionedit' . $lastsecid; + } + + /** + * Finish an edit section range + * + * @param $pos int The byte position for the edit end + * @author Adrian Lang + */ + protected function finishSectionEdit($end) { + list($id, $start, $type, $title) = array_pop($this->sectionedits); + $this->doc .= ""; + } + function getFormat(){ return 'xhtml'; } @@ -51,6 +80,17 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } function document_end() { + // Finish open section edits. + while (count($this->sectionedits) > 0) { + if ($this->sectionedits[count($this->sectionedits) - 1][1] <= 1) { + // If there is only one section, do not write a section edit + // marker. + array_pop($this->sectionedits); + } else { + $this->finishSectionEdit(0); + } + } + if ( count ($this->footnotes) > 0 ) { $this->doc .= '
'.DOKU_LF; @@ -106,6 +146,8 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } function header($text, $level, $pos) { + global $conf; + if(!$text) return; //skip empty headlines $hid = $this->_headerToLink($text,true); @@ -122,30 +164,24 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } $this->lastlevel = $level; + if ($level <= $conf['maxseclevel'] && + count($this->sectionedits) > 0 && + $this->sectionedits[count($this->sectionedits) - 1][2] === 'section') { + $this->finishSectionEdit($pos); + } + // write the header - $this->doc .= DOKU_LF.''; + $this->doc .= DOKU_LF.'doc .= ' class="' . $this->startSectionEdit($pos, 'section', $text) . '"'; + } + $this->doc .= '>'; $this->doc .= $this->_xmlEntities($text); $this->doc .= "".DOKU_LF; } - /** - * Section edit marker is replaced by an edit button when - * the page is editable. Replacement done in 'inc/html.php#html_secedit' - * - * @author Andreas Gohr - * @author Ben Coburn - */ - function section_edit($start, $end, $level, $name) { - global $conf; - - if ($start!=-1 && $level<=$conf['maxseclevel']) { - $name = str_replace('"', '', $name); - $this->doc .= ''; - } - } - function section_open($level) { - $this->doc .= "
".DOKU_LF; + $this->doc .= "
".DOKU_LF; } function section_close() { @@ -845,15 +881,16 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } // $numrows not yet implemented - function table_open($maxcols = NULL, $numrows = NULL){ + function table_open($maxcols = NULL, $numrows = NULL, $pos){ + global $lang; // initialize the row counter used for classes $this->_counter['row_counter'] = 0; - $this->doc .= ''.DOKU_LF; + $this->doc .= '
'.DOKU_LF; } - function table_close($begin, $end){ + function table_close($pos){ $this->doc .= '
'.DOKU_LF; - $this->doc .= ''; + $this->finishSectionEdit($pos); } function tablerow_open(){ -- cgit v1.2.3 From 6c1f778cae7a02dec2e14017e539d541ce6e74fb Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Mon, 8 Feb 2010 10:11:11 +0100 Subject: Fix section editing killing next section --- inc/parser/xhtml.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index ef62a3df9..9de712303 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -167,7 +167,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { if ($level <= $conf['maxseclevel'] && count($this->sectionedits) > 0 && $this->sectionedits[count($this->sectionedits) - 1][2] === 'section') { - $this->finishSectionEdit($pos); + $this->finishSectionEdit($pos - 1); } // write the header -- cgit v1.2.3 From 40868f2faa85215dfea2fa0c82274a4806d042ab Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Mon, 8 Feb 2010 12:50:20 +0100 Subject: Hide secedit buttons without title --- inc/parser/xhtml.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 9de712303..3ac8ed35c 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -49,7 +49,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * @return string A marker class for the starting HTML element * @author Adrian Lang */ - protected function startSectionEdit($start, $type, $title) { + protected function startSectionEdit($start, $type, $title = null) { static $lastsecid = 0; $this->sectionedits[] = array(++$lastsecid, $start, $type, $title); return 'sectionedit' . $lastsecid; @@ -63,9 +63,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer { */ protected function finishSectionEdit($end) { list($id, $start, $type, $title) = array_pop($this->sectionedits); - $this->doc .= ""; + $this->doc .= "'; } function getFormat(){ @@ -885,7 +887,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { global $lang; // initialize the row counter used for classes $this->_counter['row_counter'] = 0; - $this->doc .= ''.DOKU_LF; + $this->doc .= '
'.DOKU_LF; } function table_close($pos){ -- cgit v1.2.3 From 00c13053ac33ff41de9796de647da301a8abcc17 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Mon, 15 Feb 2010 11:13:05 +0100 Subject: Validate section edit data --- inc/parser/xhtml.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 3ac8ed35c..b6cc49cba 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -63,6 +63,9 @@ class Doku_Renderer_xhtml extends Doku_Renderer { */ protected function finishSectionEdit($end) { list($id, $start, $type, $title) = array_pop($this->sectionedits); + if ($end <= $start) { + return; + } $this->doc .= "'; + $this->doc .= "[$start-" . (is_null($end) ? '' : $end) . '] -->'; } function getFormat(){ @@ -92,7 +93,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { // marker. array_pop($this->sectionedits); } else { - $this->finishSectionEdit(0); + $this->finishSectionEdit(); } } -- cgit v1.2.3 From 3f9e3215e07f71f721ddd919b9b06ad5d7cc6742 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Thu, 4 Mar 2010 11:01:52 +0100 Subject: Really allow plugins to use section editing --- inc/parser/xhtml.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 552a8332d..176411c75 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -49,7 +49,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * @return string A marker class for the starting HTML element * @author Adrian Lang */ - protected function startSectionEdit($start, $type, $title = null) { + public function startSectionEdit($start, $type, $title = null) { static $lastsecid = 0; $this->sectionedits[] = array(++$lastsecid, $start, $type, $title); return 'sectionedit' . $lastsecid; @@ -62,7 +62,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { the page * @author Adrian Lang */ - protected function finishSectionEdit($end = null) { + public function finishSectionEdit($end = null) { list($id, $start, $type, $title) = array_pop($this->sectionedits); if (!is_null($end) && $end <= $start) { return; -- cgit v1.2.3 From 44653a53fe7db9e1c14e4a1d1034cf63787139b3 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Thu, 17 Jun 2010 15:43:30 +0200 Subject: Allow URL params in internal links (FS#1967) --- inc/parser/xhtml.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 176411c75..0ee04e5a1 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -559,6 +559,18 @@ class Doku_Renderer_xhtml extends Doku_Renderer { function internallink($id, $name = NULL, $search=NULL,$returnonly=false,$linktype='content') { global $conf; global $ID; + + $params = array(); + + if (preg_match('/^([^?]*)\?([^?]+)$/', $id, $matches) !== false) { + $id = $matches[1]; + preg_match_all('/(?<=[&^])([^=]+)=([^=]*)(?:&|$)/', $matches[2], + $matches, PREG_SET_ORDER); + foreach($matches as &$param) { + $params[$param[1]] = $param[2]; + } + } + // default name is based on $id as given $default = $this->_simpleTitle($id); @@ -592,7 +604,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } $link['more'] = ''; $link['class'] = $class; - $link['url'] = wl($id); + $link['url'] = wl($id, $params); $link['name'] = $name; $link['title'] = $id; //add search string -- cgit v1.2.3 From f46093a10c862c090052025b72d9e5b604f4f599 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Thu, 17 Jun 2010 16:39:24 +0200 Subject: Make normal wikilinks work again --- inc/parser/xhtml.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 0ee04e5a1..f9a33fef0 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -562,7 +562,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $params = array(); - if (preg_match('/^([^?]*)\?([^?]+)$/', $id, $matches) !== false) { + if (preg_match('/^([^?]*)\?([^?]+)$/', $id, $matches)) { $id = $matches[1]; preg_match_all('/(?<=[&^])([^=]+)=([^=]*)(?:&|$)/', $matches[2], $matches, PREG_SET_ORDER); -- cgit v1.2.3 From 3d5e07d9f0f7f71f91cd97f4a7484f4da8a1841a Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Wed, 23 Jun 2010 10:08:28 +0200 Subject: Do not parse URL params in internal links, just pass them through --- inc/parser/xhtml.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index f9a33fef0..c8862eece 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -560,15 +560,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer { global $conf; global $ID; - $params = array(); - - if (preg_match('/^([^?]*)\?([^?]+)$/', $id, $matches)) { - $id = $matches[1]; - preg_match_all('/(?<=[&^])([^=]+)=([^=]*)(?:&|$)/', $matches[2], - $matches, PREG_SET_ORDER); - foreach($matches as &$param) { - $params[$param[1]] = $param[2]; - } + $params = ''; + $parts = explode('?', $id, 2); + if (count($parts) === 2) { + $id = $parts[0]; + $params = $parts[1]; } // default name is based on $id as given -- cgit v1.2.3 From d43aac1c8c239fb7f4ca8d0cb9bf03dc1d6cd958 Mon Sep 17 00:00:00 2001 From: Gina Haeussge Date: Sat, 26 Jun 2010 15:58:14 +0200 Subject: FS#1915: strip one leading and one trailing newline from code content if available --- inc/parser/xhtml.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index c8862eece..c5a8b8218 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -442,6 +442,13 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $this->doc .= ''.DOKU_LF.'
'; } + if ($text{0} == "\n") { + $text = substr($text, 1); + } + if (substr($text, -1) == "\n") { + $text = substr($text, 0, -1); + } + if ( is_null($language) ) { $this->doc .= '
'.$this->_xmlEntities($text).'
'.DOKU_LF; } else { -- cgit v1.2.3 From a8574918a3bd65683f0a2de4a3f26dd0ec2c410f Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Sun, 27 Jun 2010 12:41:23 +0100 Subject: added div around tables to make scrolling too wide ones in restrictive designs possible (FS#1980) --- inc/parser/xhtml.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index c5a8b8218..78f6d3f84 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -906,11 +906,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer { global $lang; // initialize the row counter used for classes $this->_counter['row_counter'] = 0; - $this->doc .= '
'.DOKU_LF; + $this->doc .= '
'.DOKU_LF; } function table_close($pos){ - $this->doc .= '
'.DOKU_LF; + $this->doc .= '
'.DOKU_LF; $this->finishSectionEdit($pos); } -- cgit v1.2.3 From 138cf4d45bdc87d14db5c07e22685c0482085c1f Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Thu, 1 Jul 2010 16:11:22 +0200 Subject: Fix table edit marker class element in XHTML --- inc/parser/xhtml.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 78f6d3f84..5a3d945d1 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -906,7 +906,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { global $lang; // initialize the row counter used for classes $this->_counter['row_counter'] = 0; - $this->doc .= '
'.DOKU_LF; + $this->doc .= '
'.DOKU_LF; } function table_close($pos){ -- cgit v1.2.3