-
Bug
-
Resolution: Won't Fix
-
Minor
-
None
-
2.2.2
-
MOODLE_22_STABLE
If you create a wiki using the html format (others not tested) then create a new section header using h1 tags. If you also include an additional tag inside of that html tag - such as a span tag - clicking the corresponding "[edit]" link will give an 'invalid section' error. I believe this has to do with the additional html tags being removed before being handed off to the html parser. The simple fix seems to be to expand the regex in the html parser to allow it to match on tags inside of the h1 tags as well.
Example code to cause the problem
<h1><span style="color:red">My awesome wiki page</span></h1>
|
A not so elegant switch of the regex on line 54 of mod/wiki/parser/markups/html.php from
preg_match("/(.*?)({$h1[0]}\s*\Q$header\E\s*{$h1[1]}.*?)((?:\n{$h1[0]}.*)|$)/is", $text, $match);
|
to
preg_match("/(.*?)({$h1[0]}[\S\s]*\Q$header\E[\S\s]*{$h1[1]}.*?)((?:\n{$h1[0]}.*)|$)/is", $text, $match);
|
fixes the issue, but might also cause additional false matches.
- is blocked by
-
MDL-74249 Wiki html parser does not recognize h1 section headers if they contain attributes (follow-up MDL-32317)
-
- Open
-