Changeset 4562 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme/class-parser.php
- Timestamp:
- 12/21/2016 01:13:58 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme/class-parser.php
r4486 r4562 551 551 } 552 552 553 /* 554 * The heading style being matched in the block. Can be 'heading' or 'bold'. 555 * Standard Markdown headings (## .. and == ... ==) are matched if they exist. 556 * Full line bolding is otherwise used as the heading style. 557 * This will match sections based on which ever style is encountered in a block of text first. 558 */ 559 $heading_style = false; // 'heading' or 'bold' 560 553 561 while ( ( $line = array_shift( $lines ) ) !== null ) { 554 562 $trimmed = trim( $line ); … … 558 566 } 559 567 560 // Normal headings (##.. == ... ==) are matched if they exist, Bold is only used if it starts and ends the line. 561 if ( $trimmed[0] == '#' || $trimmed[0] == '=' || ( substr( $trimmed, 0, 2 ) == '**' && substr( $trimmed, -2 ) == '**' ) ) { 568 $is_heading = false; 569 if ( 570 ( ! $heading_style || 'heading' == $heading_style ) && 571 ( $trimmed[0] == '#' || $trimmed[0] == '=' ) 572 ) { 573 $heading_style = 'heading'; 574 $is_heading = true; 575 } elseif ( 576 ( ! $heading_style || 'bold' == $heading_style ) && 577 ( substr( $trimmed, 0, 2 ) == '**' && substr( $trimmed, -2 ) == '**' ) 578 ) { 579 $heading_style = 'bold'; 580 $is_heading = true; 581 } 582 583 if ( $is_heading ) { 562 584 if ( $value ) { 563 585 $return[ $key ] = trim( $value );
Note: See TracChangeset
for help on using the changeset viewer.