Permalink
Browse files

Wiki_Pages / bugfix - section headers with tags in them get zapped. f…

…ix regex to consume h2/h3 which was too greedy.
  • Loading branch information...
Rad Geek
Rad Geek committed Dec 26, 2016
1 parent 3ee5a7f commit 0bb3d7eaff2d992ba9b943f66b8414846ad4b430
Showing with 4 additions and 4 deletions.
  1. +4 −4 controllers/wiki_pages.php
@@ -64,10 +64,10 @@ function table_of_contents($content) {
return $content;
}
preg_match_all("|<h2.*>(.*)</h2>|", $content, $h2s, PREG_PATTERN_ORDER);
$content = preg_replace("|<h2.*>(.*)</h2>|", "<a name='$1'></a><h2>$1</h2>", $content);
$content = preg_replace("|<h3.*>(.*)</h3>|", "<a name='$1'></a><h3>$1</h3>", $content);
$h2s = $h2s[1];
preg_match_all("|<h2[^>]*>(.*)</h2>|", $content, $h2s, PREG_PATTERN_ORDER);
$content = preg_replace("|<h2[^>]*>(.*)</h2>|", "<a name='$1'></a><h2>$1</h2>", $content);
$content = preg_replace("|<h3[^>]*>(.*)</h3>|", "<a name='$1'></a><h3>$1</h3>", $content);
$h2s = array_map('strip_tags', $h2s[1]);
$content = str_replace("\n", "::newline::", $content);
preg_match_all("|</h2.*>(.*)<h2>|U", $content, $h3s_contents, PREG_PATTERN_ORDER);

0 comments on commit 0bb3d7e

Please sign in to comment.