Skip to content

Commit

Permalink
Merge branch 'MDL-48307-30' of git://github.com/marinaglancy/moodle i…
Browse files Browse the repository at this point in the history
…nto MOODLE_30_STABLE
  • Loading branch information
stronk7 committed Mar 21, 2016
2 parents 20d094c + a2c926a commit 546aae3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 7 additions & 5 deletions mod/wiki/parser/markups/html.php
Expand Up @@ -110,18 +110,20 @@ protected function get_repeated_sections_callback($match) {
* @return string
*/
protected function generate_header($text, $level) {
$text = trim($text);
$toctext = $text = trim($text);

$normlevel = $level - $this->minheaderlevel + 1;

if (!$this->pretty_print && $normlevel == 1) {
$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'));
$editlink = '[' . get_string('editsection', 'wiki') . ']';
$url = array('href' => "edit.php?pageid={$this->wiki_page_id}&section=" . urlencode($text),
'class' => 'wiki_edit_section');
$text .= ' ' . parser_utils::h('a', $this->protect($editlink), $url);
$toctext .= ' ' . parser_utils::h('a', $editlink, $url);
}

if ($normlevel <= $this->maxheaderdepth) {
$this->toc[] = array($normlevel, $text);
$this->toc[] = array($normlevel, $toctext);
$num = count($this->toc);
$text = parser_utils::h('a', "", array('name' => "toc-$num")) . $text;
}
Expand Down
12 changes: 7 additions & 5 deletions mod/wiki/parser/markups/wikimarkup.php
Expand Up @@ -178,16 +178,18 @@ protected function nowiki_tag_rule($match) {
*/

protected function generate_header($text, $level) {
$text = trim($text);
$toctext = $text = trim($text);

if (!$this->pretty_print && $level == 1) {
$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'));
$editlink = '[' . get_string('editsection', 'wiki') . ']';
$url = array('href' => "edit.php?pageid={$this->wiki_page_id}&section=" . urlencode($text),
'class' => 'wiki_edit_section');
$text .= ' ' . parser_utils::h('a', $this->protect($editlink), $url);
$toctext .= ' ' . parser_utils::h('a', $editlink, $url);
}

if ($level <= $this->maxheaderdepth) {
$this->toc[] = array($level, $text);
$this->toc[] = array($level, $toctext);
$num = count($this->toc);
$text = parser_utils::h('a', "", array('name' => "toc-$num")) . $text;
}
Expand Down

0 comments on commit 546aae3

Please sign in to comment.