Skip to content

Instantly share code, notes, and snippets.

@junnama
Created Jan 21, 2016
Embed
What would you like to do?
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