Skip to content

Commit

Permalink
Fixed that --watch bug generating errors with tags on the second run …
Browse files Browse the repository at this point in the history
…through.
  • Loading branch information
tecknojock authored and irisfofs committed Jul 17, 2017
1 parent 853a54c commit 665072d
Showing 1 changed file with 25 additions and 18 deletions.
43 changes: 25 additions & 18 deletions lib/jekyll/rp_logs/rp_log_converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,8 @@ def extract_settings(config)
def initialize(config)
# Should actually probably complain if things are undefined or missing
config["rp_convert"] = true unless config.key? "rp_convert"
config.merge! self.tag_config(config)
config["tag_implied_by"] = Hash.new()
config["tag_aliased_by"] = Hash.new()

config["tag_implications"].each_with_object({}) do |(key,values),out|
values.each{|value|
config["tag_implied_by"][value] ||= []
config["tag_implied_by"][value] << key
}
end

config["tag_aliases"].each_with_object({}) do |(key,values),out|
values.each{|value|
config["tag_aliased_by"][value] ||= []
config["tag_aliased_by"][value] << key
}
end

tag_info(config)

RpLogGenerator.extract_settings(config)
LogLine.extract_settings(config)
Expand All @@ -71,7 +56,7 @@ def tag_config(config)

def generate(site)
return unless site.config["rp_convert"]

tag_info(site.config)
# There doesn't seem to be a better way to add this to all pages than
# by modifying the configuration file, which is added onto the `site`
# liquid variable.
Expand Down Expand Up @@ -317,6 +302,28 @@ def tag_size!(tags)
end
tag_pair[1] = "tag_group_#{group}"
}
end

##
# Generate all the info from the tag file
def tag_info(config)
config.merge! self.tag_config(config)
config["tag_implied_by"] = Hash.new()
config["tag_aliased_by"] = Hash.new()

config["tag_implications"].each_with_object({}) do |(key,values),out|
values.each{|value|
config["tag_implied_by"][value] ||= []
config["tag_implied_by"][value] << key
}
end

config["tag_aliases"].each_with_object({}) do |(key,values),out|
values.each{|value|
config["tag_aliased_by"][value] ||= []
config["tag_aliased_by"][value] << key
}
end
end

end
Expand Down

0 comments on commit 665072d

Please sign in to comment.