about summary refs log tree commit diff
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-07-20 22:42:23 -0500
committermultiple creatures <dev@multiple-creature.party>2019-07-20 22:42:23 -0500
commit70080ce6e647f41e71a9f260d1ea3b9b5cecdb6a (patch)
treeacaaed0d11f3e08a6d97f3087788ae45d26f324d
parentc4718cd2be0b1a9ecbfa3b4c4168dd4f6eade17e (diff)
add `tf:stripachors` & `tf:striplinks` bangtags
-rw-r--r--app/lib/bangtags.rb5
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