module Jekyll::Antex::Dealiaser
Public Class Methods
build_aliaser(options)
click to toggle source
# File lib/jekyll/antex/dealiaser.rb, line 34 def self.build_aliaser(options) Jekyll::Antex::Stasher.new( options['aliases'].values.reject { |value| false == value }.map(&Alias.method(:new)) ) end
build_guarder(options)
click to toggle source
# File lib/jekyll/antex/dealiaser.rb, line 28 def self.build_guarder(options) Jekyll::Antex::Stasher.new( options['guards'].values.reject { |value| false == value }.map(&Guard.method(:new)) ) end
build_options(resource)
click to toggle source
# File lib/jekyll/antex/dealiaser.rb, line 20 def self.build_options(resource) Jekyll::Antex::Options.build( Jekyll::Antex::Options::DEFAULTS, resource.site.config['antex'] || {}, resource.data['antex'] || {} ) end
dealias_tag(match, matcher)
click to toggle source
# File lib/jekyll/antex/dealiaser.rb, line 40 def self.dealias_tag(match, matcher) markup = YAML.safe_load match[:markup] if match.names.include?('markup') markup = YAML.dump Options.build(matcher.options || {}, markup || {}) code = match['code'] "{% antex #{markup} %}#{code}{% endantex %}" end
run(resource)
click to toggle source
# File lib/jekyll/antex/dealiaser.rb, line 11 def self.run(resource) options = build_options(resource) guarder = build_guarder(options) aliaser = build_aliaser(options) content = aliaser.lift(guarder.lift(resource.content)) aliaser.bake(&method(:dealias_tag)) guarder.drop(aliaser.drop(content)) end