From 2c13bbba2b1c0b7cd702de12a222a1a9b36fd552 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20B=C3=B6sch?= Date: Mon, 18 Jan 2016 08:31:49 +0100 Subject: [PATCH] MDL-37739 mod_wiki: Wiki ToC header href remove square double brackets. When H1, H2 and H3 links in wiki act themselves as hyperlinks, they were displayed in double brackets. This patch removes [[ and ]] out of the table of content displayed header hyperlinks. --- mod/wiki/parser/markups/wikimarkup.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mod/wiki/parser/markups/wikimarkup.php b/mod/wiki/parser/markups/wikimarkup.php index 4f5135d294d..3e1efc0fd42 100644 --- a/mod/wiki/parser/markups/wikimarkup.php +++ b/mod/wiki/parser/markups/wikimarkup.php @@ -237,7 +237,9 @@ abstract class wiki_markup_parser extends generic_parser { $number .= ".$currentsection[2]"; } } - $toc .= parser_utils::h('p', $number . ". " . parser_utils::h('a', $header[1], array('href' => "#toc-$i")), array('class' => 'wiki-toc-section-' . $header[0] . " wiki-toc-section")); + $toc .= parser_utils::h('p', $number . ". " . + parser_utils::h('a', str_replace(array('[[', ']]'), '', $header[1]), array('href' => "#toc-$i")), + array('class' => 'wiki-toc-section-' . $header[0] . " wiki-toc-section")); $i++; }