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

Malformed links in table of contents when headings are also links to pages

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4, 2.9.4, 3.0.2, 3.1
    • Fix Version/s: 2.9.5, 3.0.3
    • Component/s: Wiki (2.x)
    • Labels:

      Description

      Create a wiki page with the following content:

      <h1>[[Heading 1]]</h1>
      <h2>[[Heading A]]</h2>
      <h2>[[Heading B]]</h2>
      <h2>Heading D</h2>
      

      Save and return to the page.

      Notice the table of contents the item for "Heading 1" appears as something like "%!0%!" and so on with others. "Heading D" appears correctly, however.

      I've tried tracking this down myself in order to supply a patch but haven't been successful. It appears to have to do with how the toc content is generated after the parser has worked through the page content. By the time execution gets to wiki_markup_parser::generate_header() the $text parameter contains something like:

      <a href="%!1%!">%!0%!</a>
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  14/Mar/16