summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandi <andi@splitbrain.org>2005-04-24 15:29:22 +0200
committerandi <andi@splitbrain.org>2005-04-24 15:29:22 +0200
commit506ae684bcf1ce877f4b74e255056d17161e4cc0 (patch)
treed0db80e9ffe246fc871b8d642d4b88c8a7eee427
parentc27ff579c062b3489dae397eb8654e4628d3b2cc (diff)
downloadrpg-506ae684bcf1ce877f4b74e255056d17161e4cc0.tar.gz
rpg-506ae684bcf1ce877f4b74e255056d17161e4cc0.tar.bz2
finally valid XHTML again
darcs-hash:20050424132922-9977f-5e9acbeae431ca1c605169829e580bf094a09ef9.gz
-rw-r--r--inc/geshi/java.php4
-rw-r--r--inc/html.php5
-rw-r--r--inc/parser/handler.php42
-rw-r--r--inc/parser/parser.php5
-rw-r--r--inc/parser/xhtml.php6
-rw-r--r--inc/parserutils.php4
-rw-r--r--tpl/default/main.php4
-rw-r--r--tpl/default/media.php3
8 files changed, 54 insertions, 19 deletions
diff --git a/inc/geshi/java.php b/inc/geshi/java.php
index 045f14afd..7a8ea2f92 100644
--- a/inc/geshi/java.php
+++ b/inc/geshi/java.php
@@ -1382,7 +1382,7 @@ $language_data = array (
'URLS' => array(
1 => '',
2 => '',
- 3 => 'http://www.google.com/search?q=allinurl%3A{FNAME}+java.sun.com&bntl=1',
+ 3 => 'http://www.google.com/search?q=allinurl%3A{FNAME}+java.sun.com&amp;bntl=1',
4 => ''
),
'OOLANG' => true,
@@ -1399,4 +1399,4 @@ $language_data = array (
)
);
-?> \ No newline at end of file
+?>
diff --git a/inc/html.php b/inc/html.php
index 8f717f8c4..efcc7e15a 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -125,14 +125,14 @@ function html_secedit_button($section,$p){
global $ID;
global $lang;
$secedit = '';
- if($p) $secedit .= "</p>\n";
+# if($p) $secedit .= "</p>\n";
$secedit .= '<div class="secedit">';
$secedit .= html_btn('secedit',$ID,'',
array('do' => 'edit',
'lines' => "$section"),
'post');
$secedit .= '</div>';
- if($p) $secedit .= "\n<p>";
+# if($p) $secedit .= "\n<p>";
return $secedit;
}
@@ -153,7 +153,6 @@ function html_secedit($text,$show=true){
}else{
$text = preg_replace('#<!-- SECTION \[(\d*-\d*)\] -->#e','',$text);
}
- $text = preg_replace('@<p>\s*</p>@', '', $text);
return $text;
}
diff --git a/inc/parser/handler.php b/inc/parser/handler.php
index 23c830abf..17429e69a 100644
--- a/inc/parser/handler.php
+++ b/inc/parser/handler.php
@@ -1185,7 +1185,29 @@ class Doku_Handler_Block {
var $stackClose = array(
'footnote_close','section_close',
);
-
+
+ function closeParagraph($pos){
+ // look back if there was any content - we don't want empty paragraphs
+ $content = '';
+ for($i=count($this->calls)-1; $i>=0; $i--){
+ if($this->calls[$i][0] == 'p_open'){
+ break;
+ }elseif($this->calls[$i][0] == 'cdata'){
+ $content .= $this->calls[$i][1][0];
+ }else{
+ $content = 'found markup';
+ break;
+ }
+ }
+
+ if(trim($content)==''){
+ //remove the whole paragraph
+ array_splice($this->calls,$i);
+ }else{
+ $this->calls[] = array('p_close',array(), $pos);
+ }
+ }
+
function process($calls) {
foreach ( $calls as $key => $call ) {
@@ -1212,7 +1234,8 @@ class Doku_Handler_Block {
if ( in_array($call[0],$this->stackClose ) ) {
if ( $this->inParagraph ) {
- $this->calls[] = array('p_close',array(), $call[2]);
+ //$this->calls[] = array('p_close',array(), $call[2]);
+ $this->closeParagraph($call[2]);
}
$this->calls[] = $call;
$this->removeFromStack();
@@ -1238,7 +1261,8 @@ class Doku_Handler_Block {
if ( isset($calls[$key+1]) && $calls[$key+1][0] == 'eol' ) {
if ( $this->inParagraph ) {
- $this->calls[] = array('p_close',array(), $call[2]);
+ //$this->calls[] = array('p_close',array(), $call[2]);
+ $this->closeParagraph($call[2]);
}
$this->calls[] = array('p_open',array(), $call[2]);
@@ -1260,7 +1284,8 @@ class Doku_Handler_Block {
$storeCall = TRUE;
if ( $this->inParagraph && in_array($call[0], $this->blockOpen) ) {
- $this->calls[] = array('p_close',array(), $call[2]);
+ //$this->calls[] = array('p_close',array(), $call[2]);
+ $this->closeParagraph($call[2]);
$this->inParagraph = FALSE;
$this->calls[] = $call;
$storeCall = FALSE;
@@ -1268,7 +1293,8 @@ class Doku_Handler_Block {
if ( in_array($call[0], $this->blockClose) ) {
if ( $this->inParagraph ) {
- $this->calls[] = array('p_close',array(), $call[2]);
+ //$this->calls[] = array('p_close',array(), $call[2]);
+ $this->closeParagraph($call[2]);
$this->inParagraph = FALSE;
}
if ( $storeCall ) {
@@ -1320,10 +1346,12 @@ class Doku_Handler_Block {
// Ditch the last call
array_pop($this->calls);
} else if ( !in_array($call[0], $this->blockClose) ) {
- $this->calls[] = array('p_close',array(), $call[2]);
+ //$this->calls[] = array('p_close',array(), $call[2]);
+ $this->closeParagraph($call[2]);
} else {
$last_call = array_pop($this->calls);
- $this->calls[] = array('p_close',array(), $call[2]);
+ //$this->calls[] = array('p_close',array(), $call[2]);
+ $this->closeParagraph($call[2]);
$this->calls[] = $last_call;
}
}
diff --git a/inc/parser/parser.php b/inc/parser/parser.php
index 23f2c13d7..d66ed5cca 100644
--- a/inc/parser/parser.php
+++ b/inc/parser/parser.php
@@ -165,10 +165,11 @@ class Doku_Parser_Mode_Footnote extends Doku_Parser_Mode {
class Doku_Parser_Mode_Header extends Doku_Parser_Mode {
function preConnect() {
+ //we're not picky about the closing ones, two are enough
// Header 1 is special case - match 6 or more
$this->Lexer->addSpecialPattern(
- '[ \t]*={6,}[^\n]+={6,}[ \t]*\n',
+ '[ \t]*={6,}[^\n]+={2,}[ \t]*\n',
'base',
'header'
);
@@ -176,7 +177,7 @@ class Doku_Parser_Mode_Header extends Doku_Parser_Mode {
// For the rest, match exactly
for ( $i = 5; $i > 1; $i--) {
$this->Lexer->addSpecialPattern(
- '[ \t]*={'.$i.'}[^\n]+={'.$i.'}[ \t]*\n',
+ '[ \t]*={'.$i.'}[^\n]+={2,}[ \t]*\n',
'base',
'header'
);
diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
index 70a8c7830..37cd36cf3 100644
--- a/inc/parser/xhtml.php
+++ b/inc/parser/xhtml.php
@@ -750,8 +750,12 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
$ret .= ' class="media'.$align.'"';
- if (!is_null($title))
+ if (!is_null($title)) {
$ret .= ' title="'.$this->_xmlEntities($title).'"';
+ $ret .= ' alt="'.$this->_xmlEntities($title).'"';
+ }else{
+ $ret .= ' alt=""';
+ }
if ( !is_null($width) )
$ret .= ' width="'.$this->_xmlEntities($width).'"';
diff --git a/inc/parserutils.php b/inc/parserutils.php
index fd66c3f1e..a2d750099 100644
--- a/inc/parserutils.php
+++ b/inc/parserutils.php
@@ -213,7 +213,9 @@ function p_get_instructions($text){
$Parser->addMode('eol',new Doku_Parser_Mode_Eol());
// Do the parsing
- return $Parser->parse($text);
+ $parsed = $Parser->parse($text);
+# dbg($parsed);
+ return $parsed;
}
/**
diff --git a/tpl/default/main.php b/tpl/default/main.php
index 13274154d..35fd97713 100644
--- a/tpl/default/main.php
+++ b/tpl/default/main.php
@@ -1,5 +1,5 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
- "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?
/**
* DokuWiki Default Template
diff --git a/tpl/default/media.php b/tpl/default/media.php
index 6509bdb5a..ccd140cd7 100644
--- a/tpl/default/media.php
+++ b/tpl/default/media.php
@@ -1,4 +1,5 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?
/**
* DokuWiki Default Template