mirror of
https://github.com/moodle/moodle.git
synced 2025-01-31 12:45:04 +01:00
MDL-28616 wiki: use class variable for toc header depth
This commit is contained in:
parent
2264828fd0
commit
b4de35e632
@ -20,7 +20,7 @@ class html_parser extends nwiki_parser {
|
||||
$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"
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ abstract class wiki_markup_parser extends generic_parser {
|
||||
|
||||
//header & ToC
|
||||
protected $toc = array();
|
||||
protected $maxheaderdepth = 3;
|
||||
|
||||
/**
|
||||
* function wiki_parser_link_callback($link = "")
|
||||
@ -183,7 +184,7 @@ abstract class wiki_markup_parser extends generic_parser {
|
||||
$text .= parser_utils::h('a', '['.get_string('editsection', 'wiki').']', array('href' => "edit.php?pageid={$this->wiki_page_id}§ion=" . 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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user