Changeset 3348838
- Timestamp:
- 08/22/2025 11:11:58 PM (7 months ago)
- File:
-
- 1 edited
-
wp-latex/trunk/wp-latex.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-latex/trunk/wp-latex.php
r982453 r3348838 118 118 return $content; 119 119 120 return preg_replace_callback( '#(\s*)\$latex[= ](.*?[^\\\\])\$(\s*)#', array( &$this, 'inline_to_shortcode_callback' ), $content ); 120 $textarr = wp_html_split( $content ); 121 122 $regex = '% 123 (\s*) # 1: Leading whitespace 124 \$latex(?:=\s*|\s+) 125 ((?: 126 [^$]+ # Not a dollar 127 | 128 (?<=(?<!\\\\)\\\\)\$ # Dollar preceded by exactly one slash 129 )+) # 2: Content 130 (?<!\\\\)\$ # Dollar preceded by zero slashes 131 (\s*) # 3: Trailing whitespace 132 %ix'; 133 134 foreach ( $textarr as &$element ) { 135 if ( '' == $element || '<' === $element[0] ) { 136 continue; 137 } 138 139 if ( false === stripos( $element, '$latex' ) ) { 140 continue; 141 } 142 143 $element = preg_replace_callback( $regex, array( &$this, 'inline_to_shortcode_callback' ), $element ); 144 } 145 146 return implode( '', $textarr ); 121 147 } 122 148 … … 148 174 add_shortcode( 'latex', array( $this, 'shortcode' ) ); 149 175 150 $text = do_shortcode( $text );176 $text = do_shortcode( $text, true ); 151 177 152 178 $GLOBALS['shortcode_tags'] = $current_shortcodes;
Note: See TracChangeset
for help on using the changeset viewer.