Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-28616 wiki: use class variable for toc header depth

  • Loading branch information...
commit b4de35e6326aab5d04a7d070d807edf93fb8fa21 1 parent 2264828
@mackensen mackensen authored
View
2  mod/wiki/parser/markups/html.php
@@ -20,7 +20,7 @@ public function __construct() {
$this->tagrules = array('link' => $this->tagrules['link'], 'url' => $this->tagrules['url']);
// Headers are considered tags here.
- $this->tagrules['header'] = array('expression' => "/<\s*h([1-6])\s*>(.+?)<\/h[1-6]>/is"
+ $this->tagrules['header'] = array('expression' => "/<\s*h([1-$this->maxheaderdepth])\s*>(.+?)<\/h[1-$this->maxheaderdepth]>/is"
);
}
View
3  mod/wiki/parser/markups/wikimarkup.php
@@ -24,6 +24,7 @@
//header & ToC
protected $toc = array();
+ protected $maxheaderdepth = 3;
/**
* function wiki_parser_link_callback($link = "")
@@ -183,7 +184,7 @@ protected function generate_header($text, $level) {
$text .= parser_utils::h('a', '['.get_string('editsection', 'wiki').']', array('href' => "edit.php?pageid={$this->wiki_page_id}&section=" . urlencode($text), 'class' => 'wiki_edit_section'));
}
- if ($level < 4) {
+ if ($level <= $this->maxheaderdepth) {
$this->toc[] = array($level, $text);
$num = count($this->toc);
$text = parser_utils::h('a', "", array('name' => "toc-$num")) . $text;
Please sign in to comment.
Something went wrong with that request. Please try again.