diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-07-20 22:42:23 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-07-20 22:42:23 -0500 |
commit | 70080ce6e647f41e71a9f260d1ea3b9b5cecdb6a (patch) | |
tree | acaaed0d11f3e08a6d97f3087788ae45d26f324d | |
parent | c4718cd2be0b1a9ecbfa3b4c4168dd4f6eade17e (diff) |
add `tf:stripachors` & `tf:striplinks` bangtags
-rw-r--r-- | app/lib/bangtags.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/lib/bangtags.rb b/app/lib/bangtags.rb index f40ccede3..def4432d2 100644 --- a/app/lib/bangtags.rb +++ b/app/lib/bangtags.rb @@ -594,6 +594,11 @@ class Bangtags tf_cmd[1..-1].in_groups_of(2) do |args| chunk.gsub!(*args) if args.all? end + when 'stripanchors' + chunk.gsub!(/<a .*?<\/a>/mi, '') + when 'striplinks' + chunk.gsub!(/\S+:\/\/[\w\-]+\.\S+/, '') + chunk = ActionController::Base.helpers.strip_links(chunk) when 'head', 'take' n = tf_cmd[1].to_i n = 1 unless n > 0 |