Changeset 10067
- Timestamp:
- 07/13/2020 09:44:22 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/formatting.php
r9770 r10067 39 39 add_filter( 'devhub-format-description', array( __CLASS__, 'autolink_references' ) ); 40 40 add_filter( 'devhub-format-description', array( __CLASS__, 'fix_param_hash_formatting' ), 9 ); 41 add_filter( 'devhub-format-description', array( __CLASS__, 'fix_param_description_parsedown_bug' ) );42 41 add_filter( 'devhub-format-description', array( __CLASS__, 'fix_param_description_html_as_code' ) ); 42 43 add_filter( 'devhub-format-hash-param-description', array( __CLASS__, 'autolink_references' ) ); 44 add_filter( 'devhub-format-hash-param-description', array( __CLASS__, 'fix_param_description_parsedown_bug' ) ); 43 45 44 46 add_filter( 'devhub-function-return-type', array( __CLASS__, 'autolink_references' ) ); … … 229 231 sanitize_title_with_dashes( html_entity_decode( $link ) ); 230 232 } 231 233 232 234 if ( $url ) { 233 235 $link = self::generate_link( $url, $link ); … … 265 267 return sprintf( '<a%s>%s</a>', $attributes, esc_html( $text ) ); 266 268 } 267 269 268 270 /** 269 271 * Fixes unintended markup generated by Markdown during parsing. … … 511 513 list( $wordtype, $type, $name, $description ) = explode( ' ', $part . ' ', 4 ); // extra spaces ensure we'll always have 4 items. 512 514 $description = trim( $description ); 513 $description = self::autolink_references( $description ); 515 516 $description = apply_filters( 'devhub-format-hash-param-description', $description ); 514 517 515 518 $skip_closing_li = false; … … 582 585 '/`(.+)<code>/' => '<code>$1</code>', 583 586 '/<\/code>(.+)`/' => ' <code>$1</code>', 584 '/<\/code>(.+)<code>/' => ' <code>$1</code>',585 587 ); 586 588 589 // Determine if code tags look inverted. 590 $first_start = strpos( $text, '<code>' ); 591 $first_end = strpos( $text, '</code>' ); 592 if ( false !== $first_start && false !== $first_end && $first_end < $first_start ) { 593 $fixes[ '~</code>(.+)<code>~U' ] = ' <code>$1</code>'; 594 } 595 587 596 $matched = true; 588 597 589 598 foreach ( $fixes as $regex => $replace ) { 590 if ( $matched && $matched = preg_match( $regex, $text, $match ) ) { 591 $text = preg_replace( $regex, $replace, $text ); 592 } 599 $text = preg_replace( $regex, $replace, $text ); 593 600 } 594 601
Note: See TracChangeset
for help on using the changeset viewer.