summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandi <andi@splitbrain.org>2005-04-17 17:40:42 +0200
committerandi <andi@splitbrain.org>2005-04-17 17:40:42 +0200
commit6bbae53816f31e7ad2c6536866674c218c63f6a4 (patch)
tree59e1d2a025dab375d5724137915f1a17f34ed59c
parent15cfe3031ce6b583a235b74987e5e6700767fdf1 (diff)
downloadrpg-6bbae53816f31e7ad2c6536866674c218c63f6a4.tar.gz
rpg-6bbae53816f31e7ad2c6536866674c218c63f6a4.tar.bz2
fixed preview
darcs-hash:20050417154042-9977f-a599079671a126c53c508de5ac1ea5da734c933d.gz
-rw-r--r--inc/html.php21
-rw-r--r--inc/parserutils.php8
2 files changed, 17 insertions, 12 deletions
diff --git a/inc/html.php b/inc/html.php
index 8cac264b1..0e1364316 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -8,6 +8,8 @@
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+ require_once(DOKU_INC.'inc/parserutils.php');
+
/**
* Convenience function to quickly build a wikilink
*
@@ -84,9 +86,12 @@ function html_login(){
?>
</div>
<?
+/*
+ FIXME provide new hook
if(@file_exists('includes/login.txt')){
print io_cacheParse('includes/login.txt');
}
+*/
}
/**
@@ -257,26 +262,28 @@ function html_list_toc($item){
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
-function html_show($text=''){
+function html_show($txt=''){
global $ID;
global $REV;
global $HIGH;
//disable section editing for old revisions or in preview
if($text || $REV){
- global $parser;
- $parser['secedit'] = false;
+ $secedit = false;
+ }else{
+ $secedit = true;
}
-
- if ($text){
+
+ if ($txt){
//PreviewHeader
print p_locale_xhtml('preview');
print '<div class="preview">';
- print html_secedit(parse($text),false);
+ print html_secedit(p_render_xhtml(p_get_instructions($txt)),$secedit);
print '</div>';
+
}else{
if ($REV) print p_locale_xhtml('showrev');
$html = p_wiki_xhtml($ID,$REV,true);
- $html = html_secedit($html);
+ $html = html_secedit($html,$secedit);
print html_hilight($html,$HIGH);
}
}
diff --git a/inc/parserutils.php b/inc/parserutils.php
index efda5c85b..e2b4e9feb 100644
--- a/inc/parserutils.php
+++ b/inc/parserutils.php
@@ -30,7 +30,7 @@ function p_wiki_xhtml($id, $rev='', $excuse=true){
if($rev){
if(@file_exists($file)){
- $ret = p_render_xhtml(p_get_instructions($file)); //no caching on old revisions
+ $ret = p_render_xhtml(p_get_instructions(io_readfile($file))); //no caching on old revisions
}elseif($excuse){
$ret = p_locale_xhtml('norev');
}
@@ -131,7 +131,7 @@ function p_cached_instructions($file){
return unserialize(io_readfile($cache));
}elseif(@file_exists($file)){
// no cache - do some work
- $ins = p_get_instructions($file);
+ $ins = p_get_instructions(io_readfile($file));
io_savefile($cache,serialize($ins));
return $ins;
}
@@ -145,11 +145,9 @@ function p_cached_instructions($file){
* @author Harry Fuecks <hfuecks@gmail.com>
* @author Andreas Gohr <andi@splitbrain.org>
*/
-function p_get_instructions($file){
+function p_get_instructions($text){
global $conf;
- $text = io_readfile($file);
-
require_once DOKU_INC . 'inc/parser/parser.php';
// Create the parser