close

Plugin Directory

Changeset 370945


Ignore:
Timestamp:
04/09/2011 04:34:57 PM (15 years ago)
Author:
beatpanda
Message:

fixed TOC regex

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wordpress-wiki/trunk/controllers/wiki_pages.php

    r370944 r370945  
    6565        }
    6666   
    67         preg_match_all("|<h2>(.*)</h2>|", $content, $h2s, PREG_PATTERN_ORDER);
    68         $content = preg_replace("|<h2>(.*)</h2>|", "<a name='$1'></a><h2>$1</h2>", $content);
    69         $content = preg_replace("|<h3>(.*)</h3>|", "<a name='$1'></a><h3>$1</h3>", $content);
     67        preg_match_all("|<h2.*>(.*)</h2>|", $content, $h2s, PREG_PATTERN_ORDER);
     68        $content = preg_replace("|<h2.*>(.*)</h2>|", "<a name='$1'></a><h2>$1</h2>", $content);
     69        $content = preg_replace("|<h3.*>(.*)</h3>|", "<a name='$1'></a><h3>$1</h3>", $content);
    7070        $h2s = $h2s[1];
    7171        $content = str_replace("\n", "::newline::", $content);
    72         preg_match_all("|</h2>(.*)<h2>|U", $content, $h3s_contents, PREG_PATTERN_ORDER);
     72        preg_match_all("|</h2.*>(.*)<h2>|U", $content, $h3s_contents, PREG_PATTERN_ORDER);
    7373       
    7474        //The following lines are really ugly for finding <h3> after the last </h2> please tidy it up if u know a better solution, and please let us know about it.
     
    8282        }
    8383        array_push($h3s_contents[1], $last_h2_pos);
     84<<<<<<< HEAD
    8485        foreach ($h3s_contents[1] as $key => $h3s_content) {
    8586            preg_match_all("|<h3>(.*)</h3>|U", $h3s_content, $h3s[$key], PREG_PATTERN_ORDER);
    8687        }
     88=======
     89            foreach ($h3s_contents[1] as $key => $h3s_content) {
     90                preg_match_all("|<h3.*>(.*)</h3>|U", $h3s_content, $h3s[$key], PREG_PATTERN_ORDER);
     91            }
     92>>>>>>> fixed TOC regex
    8793        $table = "<ol class='content_list'>";
    8894        foreach($h2s as $key => $h2) {
Note: See TracChangeset for help on using the changeset viewer.