Update erb code

This commit is contained in:
hahwul 2022-08-17 23:33:50 +09:00
parent b561a4a9b5
commit 682637da2e

View File

@ -79,35 +79,37 @@ browser_addons = head + "\n"
tool_addons = head + "\n" tool_addons = head + "\n"
Dir.entries("./weapons/").each do | name | Dir.entries("./weapons/").each do | name |
begin if name != '.' && name != '..'
data = YAML.load(File.open("./weapons/#{name}")) begin
name = data['name'] data = YAML.load(File.open("./weapons/#{name}"))
popularity = "x" name = data['name']
popularity = "x"
if data['url'].length > 0 if data['url'].length > 0
name = "[#{name}](#{data['url']})" name = "[#{name}](#{data['url']})"
end end
if data['url'].include? "github.com" if data['url'].include? "github.com"
split_result = data['url'].split "//github.com/" split_result = data['url'].split "//github.com/"
popularity = "![](https://img.shields.io/github/stars/#{split_result[1]})" popularity = "![](https://img.shields.io/github/stars/#{split_result[1]})"
end
badge = generate_badge(data['platform'])
line = "|#{data['types']}|#{name}|#{data['description']}|#{badge}|#{popularity}|"
case data['category']
when 'tool'
tools = tools + line + "\n"
when 'tool-addon'
tool_addons = tool_addons + line + "\n"
when 'browser-addon'
browser_addons = browser_addons + line + "\n"
when 'bookmarklet'
bookmarklets = bookmarklets + line + "\n"
else
puts name
end
rescue => e
puts e
end end
badge = generate_badge(data['platform'])
line = "|#{data['types']}|#{name}|#{data['description']}|#{badge}|#{popularity}|"
case data['category']
when 'tool'
tools = tools + line + "\n"
when 'tool-addon'
tool_addons = tool_addons + line + "\n"
when 'browser-addon'
browser_addons = browser_addons + line + "\n"
when 'bookmarklet'
bookmarklets = bookmarklets + line + "\n"
else
puts name
end
rescue => e
puts e
end end
end end