Skip to content

Commit

Permalink
Add comments, fix spacing, appease linter
Browse files Browse the repository at this point in the history
  • Loading branch information
mcsf committed Jul 11, 2023
1 parent 38b8cb9 commit bb26cac
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/compat/wordpress-6.3/footnotes.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
<?php
/**
* Compatiblity filters for improved footnotes support.
*
* In core, this could be fixed directly in key functions.
*
* @package gutenberg
*/

/**
* Trims footnote anchors from content.
*
* @param string $content HTML content.
* @return string Filtered content.
*/
function gutenberg_trim_footnotes( $content ) {
if ( ! doing_filter( 'get_the_excerpt' ) ) {
return $content;
}

static $footnote_pattern = '_<sup data-fn="[^"]+" class="[^"]+">\s*<a href="[^"]+" id="[^"]+">\d+</a>\s*</sup>_';
static $footnote_pattern = '_<sup data-fn="[^"]+" class="[^"]+">\s*<a href="[^"]+" id="[^"]+">\d+</a>\s*</sup>_';
return preg_replace( $footnote_pattern, '', $content );
}

Expand Down

0 comments on commit bb26cac

Please sign in to comment.