Created
January 21, 2016 07:42
-
-
Save junnama/a705bd089bdd50157773 to your computer and use it in GitHub Desktop.
Remove MTIgnore tag and HTML comments.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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