Add badge

pull/43/head
hahwul 2022-08-17 23:05:58 +09:00
parent 8693b155c7
commit b0781b1b3e
7 changed files with 22 additions and 4 deletions

BIN
images/apple.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 886 B

BIN
images/chrome.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
images/firefox.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
images/linux.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
images/safari.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
images/windows.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 998 B

View File

@ -1,8 +1,26 @@
require 'erb'
require 'yaml'
def generate_badge
def generate_badge array
badge = ""
array.each { |t|
case t
when 'linux'
badge = badge + "![](./images/linux.png)"
when 'windows'
badge = badge + "![](./images/windows.png)"
when 'macos'
badge = badge + "![](./images/apple.png)"
when 'firefox'
badge = badge + "![](./images/firefox.png)"
when 'safari'
badge = badge + "![](./images/safari.png)"
when 'chrome'
badge = badge + "![](./images/chrome.png)"
end
}
return badge
end
template = %q{
@ -70,9 +88,9 @@ Dir.entries("./weapons/").each do | name |
split_result = data['url'].split "//github.com/"
popularity = "![](https://img.shields.io/github/stars/#{split_result[1]})"
end
badge = generate_badge
badge = generate_badge(data['platform'])
line = "|#{data['types']}|#{name}|#{data['description']}|#{badge}|#{popularity}|"
case data['category']
case data['category']
when 'tool'
tools = tools + line + "\n"
when 'tool-addon'