Moodle
  1. Moodle
  2. MDL-28616

Table of contents in wiki module not displayed correctly with HTML editor + Links not working

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.4, 2.1.1, 2.4
    • Fix Version/s: 2.4, STABLE backlog
    • Component/s: Wiki (2.x)
    • Labels:
    • Environment:
      IIS 7.5; IE (8) & FF
    • Database:
      MySQL
    • Testing Instructions:
      Hide
      1. Logged as an admin / teacher go to a course where you can add activities
      2. Create a wiki activity with the default values
      3. Add a new page using HTML format including an H1 tag, an H2 tag and an H3 tag with different contents and save changes
      4. You will be redirected to the view page of the created page, the Table of contents SHOULD display all the H(1|2|3) tags

      Note that if you add a H4 tag it will not be displayed in the table of contents, it only displays up to H3

      Show
      Logged as an admin / teacher go to a course where you can add activities Create a wiki activity with the default values Add a new page using HTML format including an H1 tag, an H2 tag and an H3 tag with different contents and save changes You will be redirected to the view page of the created page, the Table of contents SHOULD display all the H(1|2|3) tags Note that if you add a H4 tag it will not be displayed in the table of contents, it only displays up to H3
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-28616-master
    • Rank:
      18290

      Description

      When using headings (h1, h2,...), the "table of contents" just shows the "h1-headings"... h2, h3,.. are ignored! This only appears using html-editor, with "creole" or "nwiki" format this is working fine. Also, the content table creates links to its headings, but these links are not working (neither with creole/nwiki nor html).

      Reproduction:
      (1) Add a wiki activity
      (2) Add a new page using html-format
      (3) Write some text using heading 1 and 2
      (4) Save

      Also see the screenshot enclosed.

      "Not jumping to headings" can also be reproduced by following the steps above. This time, just write some stuff between the headings, in order to get a scrollbar.

        Issue Links

          Activity

          Hide
          Michael de Raadt added a comment -

          Thanks for reporting this.

          I've put it on our backlog and we'll try to get to it as soon as we can.

          In the meantime adding more information, such as a workaround or even a code solution, will help us and other users.

          Show
          Michael de Raadt added a comment - Thanks for reporting this. I've put it on our backlog and we'll try to get to it as soon as we can. In the meantime adding more information, such as a workaround or even a code solution, will help us and other users.
          Hide
          Charles Fulton added a comment -

          The linking issue was resolved in MDL-25695, but the html parser still generates its headers in a completely different fashion.

          Show
          Charles Fulton added a comment - The linking issue was resolved in MDL-25695 , but the html parser still generates its headers in a completely different fashion.
          Hide
          David Monllaó added a comment -

          Hi Charles,

          Looks great, the only thing I've noticed is in the generate_header and process_toc methods of wiki_markup_parser, the TOC header levels are hardcoded (up to h3) so a h4 or more will not be reflected in any level. For the code I understand that was it intended to work that way, anyway, if it were a bug it should not be part of this issue since affects all kind of wiki formats.

          Show
          David Monllaó added a comment - Hi Charles, Looks great, the only thing I've noticed is in the generate_header and process_toc methods of wiki_markup_parser, the TOC header levels are hardcoded (up to h3) so a h4 or more will not be reflected in any level. For the code I understand that was it intended to work that way, anyway, if it were a bug it should not be part of this issue since affects all kind of wiki formats.
          Hide
          Charles Fulton added a comment -

          Hi David,

          Yes, I'd noticed that as well and I don't like it--too easy for that to break down the road (the depth there changes to four, and there's another hard-coded reference to three somewhere else). I think that code should be rewritten to be more flexible but that's for a separate issue. I've pushed up a second commit which sets a class variable for the header depth.

          Charles

          Show
          Charles Fulton added a comment - Hi David, Yes, I'd noticed that as well and I don't like it--too easy for that to break down the road (the depth there changes to four, and there's another hard-coded reference to three somewhere else). I think that code should be rewritten to be more flexible but that's for a separate issue. I've pushed up a second commit which sets a class variable for the header depth. Charles
          Hide
          David Monllaó added a comment -

          Hi Charles,

          The patch look good, I agree with you that further work (like process_toc() changes + dynamic maxheaderdepth) to take profit of this new attribute should be done in another issue, so feel free to create it. Pushing it for integration.

          Show
          David Monllaó added a comment - Hi Charles, The patch look good, I agree with you that further work (like process_toc() changes + dynamic maxheaderdepth) to take profit of this new attribute should be done in another issue, so feel free to create it. Pushing it for integration.
          Hide
          David Monllaó added a comment -

          Hi Charles, I've added testing instructions to the issue (is one of the requirements when peer reviewing issues but I forgot about that) Check if they are ok for you, the base are the reproduction steps of the issue definition. Thanks in advance

          Show
          David Monllaó added a comment - Hi Charles, I've added testing instructions to the issue (is one of the requirements when peer reviewing issues but I forgot about that) Check if they are ok for you, the base are the reproduction steps of the issue definition. Thanks in advance
          Hide
          Dan Poltawski added a comment -

          Integrated to master only. Thanks guys.

          Show
          Dan Poltawski added a comment - Integrated to master only. Thanks guys.
          Hide
          Frédéric Massart added a comment -

          Test passed. Thanks!

          Show
          Frédéric Massart added a comment - Test passed. Thanks!
          Hide
          Dan Poltawski added a comment -

          Congratulations, you've done it!

          Nf n erjneq sbe fhpprfshy vagrtengvba vagb guvf jrrxf eryrnfr, V pna abj qvfpybfr gb lbh gur rkvfgnapr bs shapgvba fge_ebg13(), gb tb va lbhe gbbyxvg nybat jvgu uggc://cuc.arg/znahny/ra/shapgvba.tmtrgff.cuc

          Cyrnfr qb abg nyybj guvf vasbezngvba gb cnff shegure.

          Show
          Dan Poltawski added a comment - Congratulations, you've done it! Nf n erjneq sbe fhpprfshy vagrtengvba vagb guvf jrrxf eryrnfr, V pna abj qvfpybfr gb lbh gur rkvfgnapr bs shapgvba fge_ebg13(), gb tb va lbhe gbbyxvg nybat jvgu uggc://cuc.arg/znahny/ra/shapgvba.tmtrgff.cuc Cyrnfr qb abg nyybj guvf vasbezngvba gb cnff shegure.

            People

            • Votes:
              3 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: