Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-52783

Double square brackets in wiki ToC titles when header as link

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 2.7.12, 2.8.10, 2.9.4, 3.0.2
    • Wiki (2.x)
    • 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")); }}

            Unassigned Unassigned
            lucaboesch Luca Bösch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.