The regular expression is /<h([1-6])>(.*?)<\/h[1-6]>/. This is extremely specific to heading tags that use a lower case "h" and have no attributes. Furthermore, the substitution callback has no way to deal with existing attributes even if the regex could deal with it.

There are two paths forward:

  • Improve this Regex and the substitution callback.
  • Use DOM manipulation.

Regex Improvement

Case insensitive, ungreedily match on anything within the first heading tag as long as there's at least one space after the number.

DOM Manipulation

Check out drupal_xml_parser_create() and format_xml_elements() as potential starting position.

Comments

Grayside’s picture

Status: Active » Fixed

http://drupalcode.org/sandbox/grayside/1876908.git/commit/8cb92e1

#1877306: Not friendly to mobile or keyboard-only navigation moved all the necessary HTML additions to new tags nested inside the header element itself. As a result, some tweaking to the regular expression is a light-weight and sufficient-for-now solution.

Grayside’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Add notes about next steps for fix.