summaryrefslogtreecommitdiff
path: root/inc/parser
diff options
context:
space:
mode:
authorAdrian Lang <mail@adrianlang.de>2011-11-10 15:43:15 +0100
committerAdrian Lang <mail@adrianlang.de>2011-11-10 15:43:15 +0100
commit16a774a8a61756df2d8fb813bfbaed98b42e3e65 (patch)
tree3a48d311e74ccbf4017330cef8af00003b0ddb34 /inc/parser
parent662a7b3fcc22d8327026bc1ef161a096683f1580 (diff)
parenta5a71ecfcc1ed6bfca1995b39cd0abe4b8dd9eeb (diff)
downloadrpg-16a774a8a61756df2d8fb813bfbaed98b42e3e65.tar.gz
rpg-16a774a8a61756df2d8fb813bfbaed98b42e3e65.tar.bz2
Merge branch 'master' into stable
Conflicts: doku.php
Diffstat (limited to 'inc/parser')
-rw-r--r--inc/parser/handler.php24
-rw-r--r--inc/parser/xhtml.php6
2 files changed, 17 insertions, 13 deletions
diff --git a/inc/parser/handler.php b/inc/parser/handler.php
index 22a50d1b7..55b715ad9 100644
--- a/inc/parser/handler.php
+++ b/inc/parser/handler.php
@@ -1489,10 +1489,10 @@ class Doku_Handler_Block {
}
}
- function openParagraph($pos){
+ function openParagraph($pos){
if ($this->inParagraph) return;
$this->calls[] = array('p_open',array(), $pos);
- $this->inParagraph = true;
+ $this->inParagraph = true;
$this->skipEol = true;
}
@@ -1503,11 +1503,12 @@ class Doku_Handler_Block {
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
- function closeParagraph($pos){
+ function closeParagraph($pos){
if (!$this->inParagraph) return;
// look back if there was any content - we don't want empty paragraphs
$content = '';
- for($i=count($this->calls)-1; $i>=0; $i--){
+ $ccount = count($this->calls);
+ for($i=$ccount-1; $i>=0; $i--){
if($this->calls[$i][0] == 'p_open'){
break;
}elseif($this->calls[$i][0] == 'cdata'){
@@ -1520,18 +1521,19 @@ class Doku_Handler_Block {
if(trim($content)==''){
//remove the whole paragraph
- array_splice($this->calls,$i);
- }else{
- // remove ending linebreaks in the paragraph
- $i=count($this->calls)-1;
+ //array_splice($this->calls,$i); // <- this is much slower than the loop below
+ for($x=$ccount; $x>$i; $x--) array_pop($this->calls);
+ }else{
+ // remove ending linebreaks in the paragraph
+ $i=count($this->calls)-1;
if ($this->calls[$i][0] == 'cdata') $this->calls[$i][1][0] = rtrim($this->calls[$i][1][0],DOKU_PARSER_EOL);
$this->calls[] = array('p_close',array(), $pos);
}
- $this->inParagraph = false;
+ $this->inParagraph = false;
$this->skipEol = true;
}
-
+
function addCall($call) {
$key = count($this->calls);
if ($key and ($call[0] == 'cdata') and ($this->calls[$key-1][0] == 'cdata')) {
@@ -1553,7 +1555,7 @@ class Doku_Handler_Block {
* @author Andreas Gohr <andi@splitbrain.org>
*/
function process($calls) {
- // open first paragraph
+ // open first paragraph
$this->openParagraph(0);
foreach ( $calls as $key => $call ) {
$cname = $call[0];
diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
index 83359cd55..ea1756803 100644
--- a/inc/parser/xhtml.php
+++ b/inc/parser/xhtml.php
@@ -805,8 +805,10 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
if($hash) $link['url'] .= '#'.$hash;
//markup non existing files
- if (!$exists)
- $link['class'] .= ' wikilink2';
+ if (!$exists) {
+ $link['class'] .= ' wikilink2';
+ $link['url'] = media_managerURL(array('tab_details' => 'view', 'image' => $src, 'ns' => getNS($src)), '&');
+ }
//output formatted
if ($linking == 'nolink' || $noLink) $this->doc .= $link['name'];