about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/lib/bangtags.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/app/lib/bangtags.rb b/app/lib/bangtags.rb
index 201f93c5b..ae9e938c7 100644
--- a/app/lib/bangtags.rb
+++ b/app/lib/bangtags.rb
@@ -106,7 +106,12 @@ class Bangtags
         chunk.sub!(/(\\:)?+:+?!#\Z/, '\1')
         chunk.sub!(/{(.*)}\Z/, '\1')
 
-        if @vore_stack.last != '_comment'
+        if @vars['_bangtags:off']
+          if chunk.in?('#!bangtags:on', '#!bangtags:enable')
+            @vars.delete('_bangtags:off')
+            next
+          end
+        elsif @vore_stack.last != '_comment'
           cmd = chunk[2..-1].strip
           next if cmd.blank?
 
@@ -140,6 +145,18 @@ class Bangtags
 
         case cmd[0].downcase
 
+        when 'bangtags'
+          chunk = nil
+          next if cmd[1].nil?
+
+          case cmd[1].downcase
+          when 'off', 'disable'
+            @vars['_bangtags:off'] = true
+            next
+          when 'break', 'skip'
+            break
+          end
+
         when 'var'
           chunk = nil
           next if cmd[1].nil?