diff options
author | multiple creatures <dev@multiple-creature.party> | 2020-02-19 11:53:55 -0600 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2020-02-19 11:53:55 -0600 |
commit | 0141cf4eaf9974e96aaad535cc5c24dee88e4d83 (patch) | |
tree | 521ed5c8cb8115a5956ceaa2296035d3930fee5d | |
parent | 7acfafa0a11c5acc63356cc256fe0cf74f20a4e3 (diff) |
add `bangtags:off`, `bangtags:on`, `bangtags:skip`
-rw-r--r-- | app/lib/bangtags.rb | 19 |
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? |