Add field to docs.json denoting available aliases

- read JavaScript file defining slug/alias mapping
- parse aliases object as Ruby hash
- add alias key to JSON output with value or null
pull/2344/head
Dave Powers 3 months ago
parent df688154b6
commit 5ff242b4c3

@ -20,6 +20,15 @@ module Docs
if doc.options[:attribution].is_a?(String)
json[:attribution] = doc.options[:attribution].strip
end
# parse doc aliases from JS file as Ruby hash
entry_file = File.open("assets/javascripts/models/entry.js")
data = entry_file.read
aliases = eval data.split("ALIASES = ").last.split(";").first
# set alias value
json["alias"] = aliases[json["slug"].to_sym]
result << json
end
end

Loading…
Cancel
Save