Skip to content

Instantly share code, notes, and snippets.

@junnama
Created January 21, 2016 07:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save junnama/a705bd089bdd50157773 to your computer and use it in GitHub Desktop.
Save junnama/a705bd089bdd50157773 to your computer and use it in GitHub Desktop.
Remove MTIgnore tag and HTML comments.
tags:
modifier:
remove_ignore: >
sub {
my ( $text, $arg ) = @_;
$text =~ s/<mt:{0,1}ignore>.*?<\/mt:{0,1}ignore>//gsi;
if ( $arg ne '1' ) {
my $comment = quotemeta( '<!--' );
my $comment_end = quotemeta( '-->' );
$text =~ s/$comment.*?$comment_end//sg;
if ( $arg eq '3' ) {
$text =~ s/^\s*\n//gm;
$text =~ s/\n.*/\n/sg;
}
}
$text;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment