From 0141cf4eaf9974e96aaad535cc5c24dee88e4d83 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Wed, 19 Feb 2020 11:53:55 -0600 Subject: add `bangtags:off`, `bangtags:on`, `bangtags:skip` --- app/lib/bangtags.rb | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'app') 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? -- cgit