-
Improvement
-
Resolution: Duplicate
-
Minor
-
None
-
2.7.12, 2.8.10, 2.9.4, 3.0.2
-
None
-
MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE
If a Wiki title (h1, h2 or h3) is marked as link as well, in the table of content, it gets displayed with [[double square brackets]].
To reproduce.
Create a wiki.
Insert a page. E.g. "Foo"
In source code editor view, insert a title, having it work as a link as well. E.g. <h1>[[Bar]]</h1>
Create the page "Bar", so the link does indeed link.
Now, in the table of content, the "Bar" entry is displayed with double square brackets (and enumeration).
Probably one would expect the table of content to display all titles in the site equally, not distinguishing whether they link or they do not link.
Possible remedy:
Filter double square brackets out where the table of content links are generated.
That's in mod/wiki/parser/markups/wikimarkup.php
process_toc() function
Change
{{
$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"));}}
To
{{
$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")); }}
- duplicates
-
MDL-37739 Malformed links in table of contents when headings are also links to pages
- Closed