From 7764a90a026393e86091d5f01533f67f7930ded6 Mon Sep 17 00:00:00 2001 From: andi <andi@splitbrain.org> Date: Tue, 26 Apr 2005 20:56:30 +0200 Subject: [PATCH] footnotes fixed #277 #278 darcs-hash:20050426185630-9977f-908f1a39cd91cbe0cf5109db0e421a9806c47c41.gz --- inc/parser/xhtml.php | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 39708db17..d79069bd6 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -31,8 +31,6 @@ class Doku_Renderer_xhtml extends Doku_Renderer { var $footnotes = array(); - var $footnoteIdStack = array(); - var $acronyms = array(); var $smileys = array(); var $badwords = array(); @@ -41,6 +39,9 @@ class Doku_Renderer_xhtml extends Doku_Renderer { var $lastsec = 0; + var $store = ''; + + function document_start() { } @@ -195,19 +196,33 @@ class Doku_Renderer_xhtml extends Doku_Renderer { function footnote_open() { $id = $this->_newFootnoteId(); $this->doc .= '<a href="#fn'.$id.'" name="fnt'.$id.'" class="fn_top">'.$id.')</a>'; - $this->footnoteIdStack[] = $id; - ob_start(); + + // move current content to store and record footnote + $this->store = $this->doc; + $this->doc = ''; + + $this->doc .= '<div class="fn">'; + $this->doc .= '<a href="#fnt'.$id.'" name="fn'.$id.'" class="fn_bot">'; + $this->doc .= $id.')</a> '.DOKU_LF; } function footnote_close() { - $contents = ob_get_contents(); - ob_end_clean(); - $id = array_pop($this->footnoteIdStack); + # $contents = ob_get_contents(); + # ob_end_clean(); + # $id = array_pop($this->footnoteIdStack); - $contents = '<div class="fn"><a href="#fnt'. - $id.'" name="fn'.$id.'" class="fn_bot">'. - $id.')</a> ' .DOKU_LF .$contents. "\n" . '</div>' . DOKU_LF; - $this->footnotes[$id] = $contents; + # $contents = '<div class="fn"><a href="#fnt'. + # $id.'" name="fn'.$id.'" class="fn_bot">'. + # $id.')</a> ' .DOKU_LF .$contents. "\n" . '</div>' . DOKU_LF; + # $this->footnotes[$id] = $contents; + + + $this->doc .= '</div>' . DOKU_LF; + + // put recorded footnote into the stack and restore old content + $this->footnotes[count($this->footnotes)] = $this->doc; + $this->doc = $this->store; + $this->store = ''; } function listu_open() { -- GitLab