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

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.4, 2.9.4, 3.0.2, 3.1
    • 2.9.5, 3.0.3
    • Wiki (2.x)

    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

              lucaboesch Luca Bösch
              pennedav David Penner
              Adrian Greeve Adrian Greeve
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Andrew Lyons Andrew Lyons
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                14/Mar/16