Fixed slide structure: properly close slides and handle section divs for H3+ content
This commit is contained in:
+33
-5
@@ -18,6 +18,7 @@ class renderer_plugin_s5 extends Doku_Renderer_xhtml {
|
||||
var $slideopen = false;
|
||||
var $base='';
|
||||
var $tpl='';
|
||||
var $sectionlevel = 0; // Track section nesting
|
||||
|
||||
/**
|
||||
* the format we produce
|
||||
@@ -111,6 +112,7 @@ class renderer_plugin_s5 extends Doku_Renderer_xhtml {
|
||||
$this->doc = preg_replace('#<p>\s*</p>#','',$this->doc);
|
||||
|
||||
if($this->slideopen){
|
||||
$this->doc .= '</div>'.DOKU_LF; //close slidecontent
|
||||
$this->doc .= '</div>'.DOKU_LF; //close previous slide
|
||||
}
|
||||
$this->doc .= '</div>
|
||||
@@ -128,7 +130,13 @@ class renderer_plugin_s5 extends Doku_Renderer_xhtml {
|
||||
if($level == 1){
|
||||
if(!$this->slideopen){
|
||||
$this->s5_init($text); // this is the first slide
|
||||
$level = 2;
|
||||
$this->doc .= '<div class="slide">'.DOKU_LF;
|
||||
$this->doc .= '<h1>';
|
||||
$this->doc .= $this->_xmlEntities($text);
|
||||
$this->doc .= '</h1>'.DOKU_LF;
|
||||
$this->doc .= '<div class="slidecontent">'.DOKU_LF;
|
||||
$this->slideopen = true;
|
||||
return;
|
||||
}else{
|
||||
return;
|
||||
}
|
||||
@@ -136,11 +144,18 @@ class renderer_plugin_s5 extends Doku_Renderer_xhtml {
|
||||
|
||||
if($level == 2){
|
||||
if($this->slideopen){
|
||||
$this->doc .= '</div>'.DOKU_LF; //close slidecontent from previous slide
|
||||
$this->doc .= '</div>'.DOKU_LF; //close previous slide
|
||||
}
|
||||
$this->doc .= '<div class="slide">'.DOKU_LF;
|
||||
$this->doc .= '<h1>';
|
||||
$this->doc .= $this->_xmlEntities($text);
|
||||
$this->doc .= '</h1>'.DOKU_LF;
|
||||
$this->doc .= '<div class="slidecontent">'.DOKU_LF;
|
||||
$this->slideopen = true;
|
||||
return; // H2 is done, don't output h1 again below
|
||||
}
|
||||
// For H3+, just output the header normally
|
||||
$this->doc .= '<h'.($level-1).'>';
|
||||
$this->doc .= $this->_xmlEntities($text);
|
||||
$this->doc .= '</h'.($level-1).'>'.DOKU_LF;
|
||||
@@ -150,12 +165,25 @@ class renderer_plugin_s5 extends Doku_Renderer_xhtml {
|
||||
* Top-Level Sections are slides
|
||||
*/
|
||||
function section_open($level) {
|
||||
if($level < 3){
|
||||
$this->doc .= '<div class="slidecontent">'.DOKU_LF;
|
||||
}else{
|
||||
// Store the current level for section_close()
|
||||
$this->sectionlevel = $level;
|
||||
|
||||
// For H3+ (level 3+), open a regular div for content structure
|
||||
if($level >= 3){
|
||||
$this->doc .= '<div>'.DOKU_LF;
|
||||
}
|
||||
// we don't use it
|
||||
// For H1 and H2: slide and slidecontent divs are managed by header()
|
||||
}
|
||||
|
||||
/**
|
||||
* Close sections
|
||||
*/
|
||||
function section_close() {
|
||||
// Only close divs for H3+ (level >= 3)
|
||||
// H1 and H2 slides are closed by the next header() or document_end()
|
||||
if($this->sectionlevel >= 3){
|
||||
$this->doc .= '</div>'.DOKU_LF;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user