jekyll-shields_io 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +11 -0
- data/.gitignore +213 -0
- data/.idea/.gitignore +8 -0
- data/.idea/codeStyles/codeStyleConfig.xml +5 -0
- data/.idea/inspectionProfiles/Project_Default.xml +8 -0
- data/.idea/jekyll-shields-io.iml +106 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.rspec +3 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +132 -0
- data/LICENSE.txt +21 -0
- data/README.md +131 -0
- data/Rakefile +9 -0
- data/jekyll-shields_io.gemspec +26 -0
- data/lib/jekyll-shields_io/version.rb +5 -0
- data/lib/jekyll-shields_io.rb +215 -0
- metadata +121 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f1cbdcd86f96276054df32441aa54069c49f7cb4a3a6726bc9590054cdec87dd
|
4
|
+
data.tar.gz: 04002f19e6937e6db93ec182e1103b277b37c1648ae752ca254dbd568117b7b2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 97fbf33a96dc445cd1e27f69008db09e05685ef31212aabb65d8b21fb2f73ae89474a3cd8e2cf033ed086aed3a2c2510d7ca41e5b93d109b82026e1893f42a6d
|
7
|
+
data.tar.gz: 4268bd92876e71d790e8966d7fd287af6a2ed4b364b693cc00534c4fcf9a203b5c740110d574b7198570810f39b8bc248538b41d3c3cc47036168e0909716312
|
data/.editorconfig
ADDED
data/.gitignore
ADDED
@@ -0,0 +1,213 @@
|
|
1
|
+
# Exclude RSpec failure tracker
|
2
|
+
.rspec_status
|
3
|
+
|
4
|
+
# Tests will mess with this directory
|
5
|
+
_cache/
|
6
|
+
|
7
|
+
# Created by https://www.toptal.com/developers/gitignore/api/ruby,rubymine,macos
|
8
|
+
# Edit at https://www.toptal.com/developers/gitignore?templates=ruby,rubymine,macos
|
9
|
+
|
10
|
+
### macOS ###
|
11
|
+
# General
|
12
|
+
.DS_Store
|
13
|
+
.AppleDouble
|
14
|
+
.LSOverride
|
15
|
+
|
16
|
+
# Icon must end with two \r
|
17
|
+
Icon
|
18
|
+
|
19
|
+
|
20
|
+
# Thumbnails
|
21
|
+
._*
|
22
|
+
|
23
|
+
# Files that might appear in the root of a volume
|
24
|
+
.DocumentRevisions-V100
|
25
|
+
.fseventsd
|
26
|
+
.Spotlight-V100
|
27
|
+
.TemporaryItems
|
28
|
+
.Trashes
|
29
|
+
.VolumeIcon.icns
|
30
|
+
.com.apple.timemachine.donotpresent
|
31
|
+
|
32
|
+
# Directories potentially created on remote AFP share
|
33
|
+
.AppleDB
|
34
|
+
.AppleDesktop
|
35
|
+
Network Trash Folder
|
36
|
+
Temporary Items
|
37
|
+
.apdisk
|
38
|
+
|
39
|
+
### macOS Patch ###
|
40
|
+
# iCloud generated files
|
41
|
+
*.icloud
|
42
|
+
|
43
|
+
### Ruby ###
|
44
|
+
*.gem
|
45
|
+
*.rbc
|
46
|
+
/.config
|
47
|
+
/coverage/
|
48
|
+
/InstalledFiles
|
49
|
+
/pkg/
|
50
|
+
/spec/reports/
|
51
|
+
/spec/examples.txt
|
52
|
+
/test/tmp/
|
53
|
+
/test/version_tmp/
|
54
|
+
/tmp/
|
55
|
+
|
56
|
+
# Used by dotenv library to load environment variables.
|
57
|
+
# .env
|
58
|
+
|
59
|
+
# Ignore Byebug command history file.
|
60
|
+
.byebug_history
|
61
|
+
|
62
|
+
## Specific to RubyMotion:
|
63
|
+
.dat*
|
64
|
+
.repl_history
|
65
|
+
build/
|
66
|
+
*.bridgesupport
|
67
|
+
build-iPhoneOS/
|
68
|
+
build-iPhoneSimulator/
|
69
|
+
|
70
|
+
## Specific to RubyMotion (use of CocoaPods):
|
71
|
+
#
|
72
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
73
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
74
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
75
|
+
# vendor/Pods/
|
76
|
+
|
77
|
+
## Documentation cache and generated files:
|
78
|
+
/.yardoc/
|
79
|
+
/_yardoc/
|
80
|
+
/doc/
|
81
|
+
/rdoc/
|
82
|
+
|
83
|
+
## Environment normalization:
|
84
|
+
/.bundle/
|
85
|
+
/vendor/bundle
|
86
|
+
/lib/bundler/man/
|
87
|
+
|
88
|
+
# for a library or gem, you might want to ignore these files since the code is
|
89
|
+
# intended to run in multiple environments; otherwise, check them in:
|
90
|
+
# Gemfile.lock
|
91
|
+
# .ruby-version
|
92
|
+
# .ruby-gemset
|
93
|
+
|
94
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
95
|
+
.rvmrc
|
96
|
+
|
97
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
98
|
+
# .rubocop-https?--*
|
99
|
+
|
100
|
+
### RubyMine ###
|
101
|
+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
102
|
+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
103
|
+
|
104
|
+
# User-specific stuff
|
105
|
+
.idea/**/workspace.xml
|
106
|
+
.idea/**/tasks.xml
|
107
|
+
.idea/**/usage.statistics.xml
|
108
|
+
.idea/**/dictionaries
|
109
|
+
.idea/**/shelf
|
110
|
+
|
111
|
+
# AWS User-specific
|
112
|
+
.idea/**/aws.xml
|
113
|
+
|
114
|
+
# Generated files
|
115
|
+
.idea/**/contentModel.xml
|
116
|
+
|
117
|
+
# Sensitive or high-churn files
|
118
|
+
.idea/**/dataSources/
|
119
|
+
.idea/**/dataSources.ids
|
120
|
+
.idea/**/dataSources.local.xml
|
121
|
+
.idea/**/sqlDataSources.xml
|
122
|
+
.idea/**/dynamic.xml
|
123
|
+
.idea/**/uiDesigner.xml
|
124
|
+
.idea/**/dbnavigator.xml
|
125
|
+
|
126
|
+
# Gradle
|
127
|
+
.idea/**/gradle.xml
|
128
|
+
.idea/**/libraries
|
129
|
+
|
130
|
+
# Gradle and Maven with auto-import
|
131
|
+
# When using Gradle or Maven with auto-import, you should exclude module files,
|
132
|
+
# since they will be recreated, and may cause churn. Uncomment if using
|
133
|
+
# auto-import.
|
134
|
+
# .idea/artifacts
|
135
|
+
# .idea/compiler.xml
|
136
|
+
# .idea/jarRepositories.xml
|
137
|
+
# .idea/modules.xml
|
138
|
+
# .idea/*.iml
|
139
|
+
# .idea/modules
|
140
|
+
# *.iml
|
141
|
+
# *.ipr
|
142
|
+
|
143
|
+
# CMake
|
144
|
+
cmake-build-*/
|
145
|
+
|
146
|
+
# Mongo Explorer plugin
|
147
|
+
.idea/**/mongoSettings.xml
|
148
|
+
|
149
|
+
# File-based project format
|
150
|
+
*.iws
|
151
|
+
|
152
|
+
# IntelliJ
|
153
|
+
out/
|
154
|
+
|
155
|
+
# mpeltonen/sbt-idea plugin
|
156
|
+
.idea_modules/
|
157
|
+
|
158
|
+
# JIRA plugin
|
159
|
+
atlassian-ide-plugin.xml
|
160
|
+
|
161
|
+
# Cursive Clojure plugin
|
162
|
+
.idea/replstate.xml
|
163
|
+
|
164
|
+
# SonarLint plugin
|
165
|
+
.idea/sonarlint/
|
166
|
+
|
167
|
+
# Crashlytics plugin (for Android Studio and IntelliJ)
|
168
|
+
com_crashlytics_export_strings.xml
|
169
|
+
crashlytics.properties
|
170
|
+
crashlytics-build.properties
|
171
|
+
fabric.properties
|
172
|
+
|
173
|
+
# Editor-based Rest Client
|
174
|
+
.idea/httpRequests
|
175
|
+
|
176
|
+
# Android studio 3.1+ serialized cache file
|
177
|
+
.idea/caches/build_file_checksums.ser
|
178
|
+
|
179
|
+
### RubyMine Patch ###
|
180
|
+
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
181
|
+
|
182
|
+
# *.iml
|
183
|
+
# modules.xml
|
184
|
+
# .idea/misc.xml
|
185
|
+
# *.ipr
|
186
|
+
|
187
|
+
# Sonarlint plugin
|
188
|
+
# https://plugins.jetbrains.com/plugin/7973-sonarlint
|
189
|
+
.idea/**/sonarlint/
|
190
|
+
|
191
|
+
# SonarQube Plugin
|
192
|
+
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
|
193
|
+
.idea/**/sonarIssues.xml
|
194
|
+
|
195
|
+
# Markdown Navigator plugin
|
196
|
+
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
|
197
|
+
.idea/**/markdown-navigator.xml
|
198
|
+
.idea/**/markdown-navigator-enh.xml
|
199
|
+
.idea/**/markdown-navigator/
|
200
|
+
|
201
|
+
# Cache file creation bug
|
202
|
+
# See https://youtrack.jetbrains.com/issue/JBR-2257
|
203
|
+
.idea/$CACHE_FILE$
|
204
|
+
|
205
|
+
# CodeStream plugin
|
206
|
+
# https://plugins.jetbrains.com/plugin/12206-codestream
|
207
|
+
.idea/codestream.xml
|
208
|
+
|
209
|
+
# Azure Toolkit for IntelliJ plugin
|
210
|
+
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
|
211
|
+
.idea/**/azureSettings.xml
|
212
|
+
|
213
|
+
# End of https://www.toptal.com/developers/gitignore/api/ruby,rubymine,macos
|
data/.idea/.gitignore
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<component name="InspectionProjectProfileManager">
|
2
|
+
<profile version="1.0">
|
3
|
+
<option name="myName" value="Project Default" />
|
4
|
+
<inspection_tool class="Rubocop" enabled="true" level="WARNING" enabled_by_default="true">
|
5
|
+
<option name="myUseStandardGemIfPossible" value="true" />
|
6
|
+
</inspection_tool>
|
7
|
+
</profile>
|
8
|
+
</component>
|
@@ -0,0 +1,106 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
4
|
+
<shared />
|
5
|
+
</component>
|
6
|
+
<component name="NewModuleRootManager">
|
7
|
+
<content url="file://$MODULE_DIR$">
|
8
|
+
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
|
9
|
+
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
10
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
11
|
+
<excludeFolder url="file://$MODULE_DIR$/.jekyll-cache/Jekyll" />
|
12
|
+
<excludeFolder url="file://$MODULE_DIR$/.bundle" />
|
13
|
+
</content>
|
14
|
+
<orderEntry type="jdk" jdkName="RVM: ruby-2.7.6" jdkType="RUBY_SDK" />
|
15
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.8.1, RVM: ruby-2.7.6) [gem]" level="application" />
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, RVM: ruby-2.7.6) [gem]" level="application" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.2.2, RVM: ruby-2.7.6) [gem]" level="application" />
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="colorator (v1.1.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.2.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="em-websocket (v0.5.3, RVM: ruby-2.7.6) [gem]" level="application" />
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="eventmachine (v1.2.7, RVM: ruby-2.7.6) [gem]" level="application" />
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="ffi (v1.15.5, RVM: ruby-2.7.6) [gem]" level="application" />
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="forwardable-extended (v2.6.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
26
|
+
<orderEntry type="library" scope="PROVIDED" name="google-protobuf (v3.21.12, RVM: ruby-2.7.6) [gem]" level="application" />
|
27
|
+
<orderEntry type="library" scope="PROVIDED" name="http_parser.rb (v0.8.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
28
|
+
<orderEntry type="library" scope="PROVIDED" name="httparty (v0.21.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
29
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.12.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
30
|
+
<orderEntry type="library" scope="PROVIDED" name="jekyll (v4.3.2, RVM: ruby-2.7.6) [gem]" level="application" />
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="jekyll-sass-converter (v3.0.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="jekyll-watch (v2.2.1, RVM: ruby-2.7.6) [gem]" level="application" />
|
33
|
+
<orderEntry type="library" scope="PROVIDED" name="json (v2.6.3, RVM: ruby-2.7.6) [gem]" level="application" />
|
34
|
+
<orderEntry type="library" scope="PROVIDED" name="kramdown (v2.4.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
35
|
+
<orderEntry type="library" scope="PROVIDED" name="kramdown-parser-gfm (v1.1.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
36
|
+
<orderEntry type="library" scope="PROVIDED" name="language_server-protocol (v3.17.0.3, RVM: ruby-2.7.6) [gem]" level="application" />
|
37
|
+
<orderEntry type="library" scope="PROVIDED" name="liquid (v4.0.4, RVM: ruby-2.7.6) [gem]" level="application" />
|
38
|
+
<orderEntry type="library" scope="PROVIDED" name="listen (v3.8.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
39
|
+
<orderEntry type="library" scope="PROVIDED" name="mercenary (v0.4.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
40
|
+
<orderEntry type="library" scope="PROVIDED" name="mini_mime (v1.1.2, RVM: ruby-2.7.6) [gem]" level="application" />
|
41
|
+
<orderEntry type="library" scope="PROVIDED" name="multi_xml (v0.6.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
42
|
+
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.14.2, RVM: ruby-2.7.6) [gem]" level="application" />
|
43
|
+
<orderEntry type="library" scope="PROVIDED" name="parallel (v1.22.1, RVM: ruby-2.7.6) [gem]" level="application" />
|
44
|
+
<orderEntry type="library" scope="PROVIDED" name="parser (v3.2.1.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
45
|
+
<orderEntry type="library" scope="PROVIDED" name="pathutil (v0.16.2, RVM: ruby-2.7.6) [gem]" level="application" />
|
46
|
+
<orderEntry type="library" scope="PROVIDED" name="public_suffix (v5.0.1, RVM: ruby-2.7.6) [gem]" level="application" />
|
47
|
+
<orderEntry type="library" scope="PROVIDED" name="racc (v1.6.2, RVM: ruby-2.7.6) [gem]" level="application" />
|
48
|
+
<orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, RVM: ruby-2.7.6) [gem]" level="application" />
|
49
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v13.0.1, RVM: ruby-2.7.6) [gem]" level="application" />
|
50
|
+
<orderEntry type="library" scope="PROVIDED" name="rb-fsevent (v0.11.2, RVM: ruby-2.7.6) [gem]" level="application" />
|
51
|
+
<orderEntry type="library" scope="PROVIDED" name="rb-inotify (v0.10.1, RVM: ruby-2.7.6) [gem]" level="application" />
|
52
|
+
<orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.7.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
53
|
+
<orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, RVM: ruby-2.7.6) [gem]" level="application" />
|
54
|
+
<orderEntry type="library" scope="PROVIDED" name="rouge (v4.1.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
55
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.12.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
56
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.12.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
57
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.12.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
58
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.12.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
59
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.12.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
60
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop (v1.44.1, RVM: ruby-2.7.6) [gem]" level="application" />
|
61
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.26.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
62
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop-performance (v1.15.2, RVM: ruby-2.7.6) [gem]" level="application" />
|
63
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
64
|
+
<orderEntry type="library" scope="PROVIDED" name="safe_yaml (v1.0.5, RVM: ruby-2.7.6) [gem]" level="application" />
|
65
|
+
<orderEntry type="library" scope="PROVIDED" name="sass-embedded (v1.58.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
66
|
+
<orderEntry type="library" scope="PROVIDED" name="standard (v1.24.3, RVM: ruby-2.7.6) [gem]" level="application" />
|
67
|
+
<orderEntry type="library" scope="PROVIDED" name="terminal-table (v3.0.2, RVM: ruby-2.7.6) [gem]" level="application" />
|
68
|
+
<orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.4.2, RVM: ruby-2.7.6) [gem]" level="application" />
|
69
|
+
<orderEntry type="library" scope="PROVIDED" name="webrick (v1.8.1, RVM: ruby-2.7.6) [gem]" level="application" />
|
70
|
+
</component>
|
71
|
+
<component name="RakeTasksCache">
|
72
|
+
<option name="myRootTask">
|
73
|
+
<RakeTaskImpl id="rake">
|
74
|
+
<subtasks>
|
75
|
+
<RakeTaskImpl description="Build jekyll-shields_io-0.1.0.gem into the pkg directory" fullCommand="build" id="build" />
|
76
|
+
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
77
|
+
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
78
|
+
<RakeTaskImpl description="Build and install jekyll-shields_io-0.1.0.gem into system gems" fullCommand="install" id="install" />
|
79
|
+
<RakeTaskImpl id="install">
|
80
|
+
<subtasks>
|
81
|
+
<RakeTaskImpl description="Build and install jekyll-shields_io-0.1.0.gem into system gems without network access" fullCommand="install:local" id="local" />
|
82
|
+
</subtasks>
|
83
|
+
</RakeTaskImpl>
|
84
|
+
<RakeTaskImpl description="Create tag v0.1.0 and build and push jekyll-shields_io-0.1.0.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
|
85
|
+
<RakeTaskImpl description="Run RSpec code examples" fullCommand="spec" id="spec" />
|
86
|
+
<RakeTaskImpl description="Lint with the Standard Ruby style guide" fullCommand="standard" id="standard" />
|
87
|
+
<RakeTaskImpl id="standard">
|
88
|
+
<subtasks>
|
89
|
+
<RakeTaskImpl description="Lint and automatically fix with the Standard Ruby style guide" fullCommand="standard:fix" id="fix" />
|
90
|
+
</subtasks>
|
91
|
+
</RakeTaskImpl>
|
92
|
+
<RakeTaskImpl description="" fullCommand="default" id="default" />
|
93
|
+
<RakeTaskImpl description="" fullCommand="release" id="release" />
|
94
|
+
<RakeTaskImpl id="release">
|
95
|
+
<subtasks>
|
96
|
+
<RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
|
97
|
+
<RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
|
98
|
+
<RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
|
99
|
+
</subtasks>
|
100
|
+
</RakeTaskImpl>
|
101
|
+
<RakeTaskImpl description="" fullCommand="test" id="test" />
|
102
|
+
</subtasks>
|
103
|
+
</RakeTaskImpl>
|
104
|
+
</option>
|
105
|
+
</component>
|
106
|
+
</module>
|
data/.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/jekyll-shields-io.iml" filepath="$PROJECT_DIR$/.idea/jekyll-shields-io.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
data/.idea/vcs.xml
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
jekyll-shields_io (0.1.0)
|
5
|
+
httparty (~> 0.17, < 1.0)
|
6
|
+
jekyll (>= 3.5, < 5.0)
|
7
|
+
nokogiri (~> 1.4, < 2.0)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
addressable (2.8.1)
|
13
|
+
public_suffix (>= 2.0.2, < 6.0)
|
14
|
+
ast (2.4.2)
|
15
|
+
colorator (1.1.0)
|
16
|
+
concurrent-ruby (1.2.0)
|
17
|
+
diff-lcs (1.5.0)
|
18
|
+
em-websocket (0.5.3)
|
19
|
+
eventmachine (>= 0.12.9)
|
20
|
+
http_parser.rb (~> 0)
|
21
|
+
eventmachine (1.2.7)
|
22
|
+
ffi (1.15.5)
|
23
|
+
forwardable-extended (2.6.0)
|
24
|
+
google-protobuf (3.21.12-x86_64-darwin)
|
25
|
+
http_parser.rb (0.8.0)
|
26
|
+
httparty (0.21.0)
|
27
|
+
mini_mime (>= 1.0.0)
|
28
|
+
multi_xml (>= 0.5.2)
|
29
|
+
i18n (1.12.0)
|
30
|
+
concurrent-ruby (~> 1.0)
|
31
|
+
jekyll (4.3.2)
|
32
|
+
addressable (~> 2.4)
|
33
|
+
colorator (~> 1.0)
|
34
|
+
em-websocket (~> 0.5)
|
35
|
+
i18n (~> 1.0)
|
36
|
+
jekyll-sass-converter (>= 2.0, < 4.0)
|
37
|
+
jekyll-watch (~> 2.0)
|
38
|
+
kramdown (~> 2.3, >= 2.3.1)
|
39
|
+
kramdown-parser-gfm (~> 1.0)
|
40
|
+
liquid (~> 4.0)
|
41
|
+
mercenary (>= 0.3.6, < 0.5)
|
42
|
+
pathutil (~> 0.9)
|
43
|
+
rouge (>= 3.0, < 5.0)
|
44
|
+
safe_yaml (~> 1.0)
|
45
|
+
terminal-table (>= 1.8, < 4.0)
|
46
|
+
webrick (~> 1.7)
|
47
|
+
jekyll-sass-converter (3.0.0)
|
48
|
+
sass-embedded (~> 1.54)
|
49
|
+
jekyll-watch (2.2.1)
|
50
|
+
listen (~> 3.0)
|
51
|
+
json (2.6.3)
|
52
|
+
kramdown (2.4.0)
|
53
|
+
rexml
|
54
|
+
kramdown-parser-gfm (1.1.0)
|
55
|
+
kramdown (~> 2.0)
|
56
|
+
language_server-protocol (3.17.0.3)
|
57
|
+
liquid (4.0.4)
|
58
|
+
listen (3.8.0)
|
59
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
60
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
61
|
+
mercenary (0.4.0)
|
62
|
+
mini_mime (1.1.2)
|
63
|
+
multi_xml (0.6.0)
|
64
|
+
nokogiri (1.14.2-x86_64-darwin)
|
65
|
+
racc (~> 1.4)
|
66
|
+
parallel (1.22.1)
|
67
|
+
parser (3.2.1.0)
|
68
|
+
ast (~> 2.4.1)
|
69
|
+
pathutil (0.16.2)
|
70
|
+
forwardable-extended (~> 2.6)
|
71
|
+
public_suffix (5.0.1)
|
72
|
+
racc (1.6.2)
|
73
|
+
rainbow (3.1.1)
|
74
|
+
rake (13.0.1)
|
75
|
+
rb-fsevent (0.11.2)
|
76
|
+
rb-inotify (0.10.1)
|
77
|
+
ffi (~> 1.0)
|
78
|
+
regexp_parser (2.7.0)
|
79
|
+
rexml (3.2.5)
|
80
|
+
rouge (4.1.0)
|
81
|
+
rspec (3.12.0)
|
82
|
+
rspec-core (~> 3.12.0)
|
83
|
+
rspec-expectations (~> 3.12.0)
|
84
|
+
rspec-mocks (~> 3.12.0)
|
85
|
+
rspec-core (3.12.0)
|
86
|
+
rspec-support (~> 3.12.0)
|
87
|
+
rspec-expectations (3.12.0)
|
88
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
89
|
+
rspec-support (~> 3.12.0)
|
90
|
+
rspec-mocks (3.12.0)
|
91
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
92
|
+
rspec-support (~> 3.12.0)
|
93
|
+
rspec-support (3.12.0)
|
94
|
+
rubocop (1.44.1)
|
95
|
+
json (~> 2.3)
|
96
|
+
parallel (~> 1.10)
|
97
|
+
parser (>= 3.2.0.0)
|
98
|
+
rainbow (>= 2.2.2, < 4.0)
|
99
|
+
regexp_parser (>= 1.8, < 3.0)
|
100
|
+
rexml (>= 3.2.5, < 4.0)
|
101
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
102
|
+
ruby-progressbar (~> 1.7)
|
103
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
104
|
+
rubocop-ast (1.26.0)
|
105
|
+
parser (>= 3.2.1.0)
|
106
|
+
rubocop-performance (1.15.2)
|
107
|
+
rubocop (>= 1.7.0, < 2.0)
|
108
|
+
rubocop-ast (>= 0.4.0)
|
109
|
+
ruby-progressbar (1.11.0)
|
110
|
+
safe_yaml (1.0.5)
|
111
|
+
sass-embedded (1.58.0-x86_64-darwin)
|
112
|
+
google-protobuf (~> 3.21)
|
113
|
+
standard (1.24.3)
|
114
|
+
language_server-protocol (~> 3.17.0.2)
|
115
|
+
rubocop (= 1.44.1)
|
116
|
+
rubocop-performance (= 1.15.2)
|
117
|
+
terminal-table (3.0.2)
|
118
|
+
unicode-display_width (>= 1.1.1, < 3)
|
119
|
+
unicode-display_width (2.4.2)
|
120
|
+
webrick (1.8.1)
|
121
|
+
|
122
|
+
PLATFORMS
|
123
|
+
x86_64-darwin-21
|
124
|
+
|
125
|
+
DEPENDENCIES
|
126
|
+
jekyll-shields_io!
|
127
|
+
rake
|
128
|
+
rspec
|
129
|
+
standard
|
130
|
+
|
131
|
+
BUNDLED WITH
|
132
|
+
2.2.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright 2023 C. Plug
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
# jekyll-shields_io
|
2
|
+
|
3
|
+
> **Adding shields (badges) to your Jekyll blog, made more readable**
|
4
|
+
|
5
|
+
This is a Jekyll plugin to generate a [Shields.io](https://shields.io) badge in your Jekyll blog
|
6
|
+
with a more readable way.
|
7
|
+
|
8
|
+
Shields.io takes the properties of the badges you want to make in forms of GET parameters like so:
|
9
|
+
|
10
|
+
https://img.shields.io/static/v1?label=Find%20me%20on&message=GitHub&color=181717&style=flat&logo=github
|
11
|
+
|
12
|
+
This URL would become this:
|
13
|
+
![A badge that says Find me on GitHub](https://img.shields.io/static/v1?label=Find%20me%20on&message=GitHub&color=181717&style=flat&logo=github)
|
14
|
+
|
15
|
+
This plugin exists because this URL was too long for me to debug.
|
16
|
+
|
17
|
+
Instead, this plugin accepts parameters structured as a JSON:
|
18
|
+
|
19
|
+
```liquid
|
20
|
+
<!-- If used in Liquid / HTML file, this will do -->
|
21
|
+
{% shields_io {
|
22
|
+
"label": "Find me on",
|
23
|
+
"message": "GitHub",
|
24
|
+
"color": "181717",
|
25
|
+
"style": "flat",
|
26
|
+
"logo": "github",
|
27
|
+
}
|
28
|
+
%}
|
29
|
+
<!-- When using in Markdown, you need to use `{%- tag -%}` syntax otherwise the tag will be escaped -->
|
30
|
+
{%- shields_io {
|
31
|
+
"label": "Find me on",
|
32
|
+
"message": "GitHub",
|
33
|
+
"color": "181717",
|
34
|
+
"style": "flat",
|
35
|
+
"logo": "github",
|
36
|
+
}
|
37
|
+
-%}
|
38
|
+
```
|
39
|
+
|
40
|
+
## Installation
|
41
|
+
|
42
|
+
```
|
43
|
+
gem "jekyll-shields_io", git: "https://github.com/clpsplug/jekyll-shields_io", branch: "base"
|
44
|
+
```
|
45
|
+
|
46
|
+
RubyGems TBA
|
47
|
+
|
48
|
+
## Features
|
49
|
+
|
50
|
+
### Easy to debug shield parameters
|
51
|
+
|
52
|
+
You can specify the parameters passed to Shields.io using JSON,
|
53
|
+
which prevents accidental and hard-to-spot mistakes.
|
54
|
+
|
55
|
+
### Automatic caching
|
56
|
+
|
57
|
+
The shields are only fetched at the first time it is rendered during site builds.
|
58
|
+
|
59
|
+
This plugin creates a `_cache` directory in the blog's source directory
|
60
|
+
(which is the project root by default, can be configured with `source` config value)
|
61
|
+
and stores fetched shields, and then deploys them into the blog's `asset/img/shields` folder
|
62
|
+
to prevent unnecessary external HTML requests.
|
63
|
+
|
64
|
+
Deployment is done build-time, so it does not mess with your blog source
|
65
|
+
(other than creating `_cache` dir).
|
66
|
+
|
67
|
+
### Extra parameters for your convenience
|
68
|
+
|
69
|
+
#### Make it a link
|
70
|
+
|
71
|
+
With the extended parameter `href`, you can instantly turn the shield
|
72
|
+
into a clickable link.
|
73
|
+
|
74
|
+
```liquid
|
75
|
+
{% shields_io {
|
76
|
+
"label": "Find me on",
|
77
|
+
"message": "GitHub",
|
78
|
+
"color": "181717",
|
79
|
+
"style": "flat",
|
80
|
+
"logo": "github",
|
81
|
+
"href": "https://github.com/clpsplug/jekyll-shields_io"
|
82
|
+
}
|
83
|
+
%}
|
84
|
+
```
|
85
|
+
|
86
|
+
#### Alternative Texts
|
87
|
+
|
88
|
+
Supplying the image with an alternative text is almost mandatory these days;
|
89
|
+
this plugin has an extended parameter `alt` for that purpose.
|
90
|
+
|
91
|
+
```liquid
|
92
|
+
{% shields_io {
|
93
|
+
"label": "Find me on",
|
94
|
+
"message": "GitHub",
|
95
|
+
"color": "181717",
|
96
|
+
"style": "flat",
|
97
|
+
"logo": "github",
|
98
|
+
"alt": "Write your alternative text here"
|
99
|
+
}
|
100
|
+
%}
|
101
|
+
```
|
102
|
+
|
103
|
+
## Supported parameters
|
104
|
+
|
105
|
+
| key | content | required? |
|
106
|
+
|:--------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------|
|
107
|
+
| message | The right-side text of the shield. | YES |
|
108
|
+
| alt | The alternative text for the image. This _should_ be specified for accessibility reasons and when the service fails for any reason. | NO, but strongly recommended |
|
109
|
+
| label | The left-side text of the shield. If left, it will be "static" | NO |
|
110
|
+
| color | The color of the right side (some styles may ignore this value.) This can be color name (see [Shields.io](https://shields.io/) for supported names) or hex color code. Hex color codes _must not_ contain `#`. If left, 'inactive' is used. | NO |
|
111
|
+
| style | The shield style, see [Shields.io](https://shields.io) for valid values. If left, 'plastic' is used. | NO |
|
112
|
+
| logo | Service name or Simple Icons icon name; display on the left of the leftside text. | NO |
|
113
|
+
| href | A URL. Specifying this key will turn the shield into a clickable link | NO |
|
114
|
+
|
115
|
+
## NOTE: i18n plugin compatibility
|
116
|
+
|
117
|
+
This plugin tries to detect i18n plugin [Polyglot](https://github.com/untra/polyglot) when deploying shields to the assets folder;
|
118
|
+
this is done so that we don't accidentally deploy the shields for each language version of your site
|
119
|
+
(because usually you would have one `asset` folder that all the language versions would access.)
|
120
|
+
|
121
|
+
If you use other i18n plugins, the plugin may fail to spot that such i18n plugin is generating non-main language version of the site
|
122
|
+
and incorrectly deploy cached shields to those versions.
|
123
|
+
If you happen to see this behavior, please report it or send me a PR so that we can make this plugin compatible with that one!
|
124
|
+
|
125
|
+
## Contributing
|
126
|
+
|
127
|
+
Bug reports & pull requests are welcome on [GitHub repo](https://github.com/clpsplug/jekyll-shields_io).
|
128
|
+
|
129
|
+
## License
|
130
|
+
|
131
|
+
[MIT License](https://opensource.org/licenses/MIT)
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
require "jekyll-shields_io/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "jekyll-shields_io"
|
8
|
+
s.version = Jekyll::ShieldsIO::VERSION
|
9
|
+
s.summary = "Adds ability to put shields.io badges in your Jekyll blog"
|
10
|
+
s.description = <<~EOD
|
11
|
+
This Jekyll plugin allows you to add a shields.io badge in your blog
|
12
|
+
without forming very long URLs - instead, the properties are set via JSON.
|
13
|
+
EOD
|
14
|
+
s.authors = ["C. Plug"]
|
15
|
+
s.email = "hsp.tosh.5200113@gmail.com"
|
16
|
+
s.homepage = "https://github.com/clpsplug/jekyll-shields_io"
|
17
|
+
s.license = "MIT"
|
18
|
+
|
19
|
+
s.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
end
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
s.add_dependency "jekyll", ">= 3.5", "< 5.0"
|
24
|
+
s.add_dependency "nokogiri", "~> 1.4", "< 2.0"
|
25
|
+
s.add_dependency "httparty", "~> 0.17", "< 1.0"
|
26
|
+
end
|
@@ -0,0 +1,215 @@
|
|
1
|
+
require "digest"
|
2
|
+
require "fileutils"
|
3
|
+
require "json"
|
4
|
+
require "nokogiri"
|
5
|
+
require "httparty"
|
6
|
+
|
7
|
+
module Jekyll
|
8
|
+
module ShieldsIO
|
9
|
+
# Factory for generating Shields.IO's shield
|
10
|
+
class ShieldFactory
|
11
|
+
# @param [Liquid::Context] context
|
12
|
+
def initialize(context)
|
13
|
+
# @type [Jekyll::Site]
|
14
|
+
@site = context.registers[:site]
|
15
|
+
# @type [String]
|
16
|
+
@source_dir = File.absolute_path context.registers[:site].config["source"], Dir.pwd
|
17
|
+
end
|
18
|
+
|
19
|
+
# @param [Hash] config
|
20
|
+
def get_shield(config)
|
21
|
+
href = config[:href]
|
22
|
+
alt = config[:alt]
|
23
|
+
cls = config[:class]
|
24
|
+
query = hash_to_query(config, [:href, :alt, :class])
|
25
|
+
|
26
|
+
unless File.exist? cache_dir
|
27
|
+
FileUtils.mkdir_p cache_dir
|
28
|
+
log "Cache directory #{cache_dir} was made for Shields.IO tags."
|
29
|
+
end
|
30
|
+
|
31
|
+
cache_file = "#{Digest::MD5.hexdigest query}.svg"
|
32
|
+
cache_path = File.join cache_dir, cache_file
|
33
|
+
|
34
|
+
# Consult the cache first
|
35
|
+
if File.exist? cache_path
|
36
|
+
log "Cache hit for query: #{query} => #{cache_path}"
|
37
|
+
# Good news: Shields.IO outputs SVG, which is just XML, and it makes our job very easy!
|
38
|
+
image_xml = Nokogiri::XML(File.read(cache_path))
|
39
|
+
else
|
40
|
+
log "Cache missed for query: #{query}"
|
41
|
+
# If the cache does not exist, we need to get the file.
|
42
|
+
response = HTTParty.get "https://img.shields.io/static/v1?#{query}"
|
43
|
+
unless response.code == 200
|
44
|
+
warn "Shields.io refused our request with Response Code #{response.code}."
|
45
|
+
return nil
|
46
|
+
end
|
47
|
+
img = response.body
|
48
|
+
File.write cache_path, img
|
49
|
+
image_xml = Nokogiri::XML(img)
|
50
|
+
log "Cached shield for #{query} => #{cache_path}"
|
51
|
+
end
|
52
|
+
width = image_xml.root["width"].to_i
|
53
|
+
height = image_xml.root["height"].to_i
|
54
|
+
Shield.new(width, height, cache_path, href, alt, cls)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Queue given Shield for this Jekyll site's static files
|
58
|
+
#
|
59
|
+
# shield - Shield to queue for this Jekyll site's Jekyll::StaticFile.
|
60
|
+
def queue_shield(shield)
|
61
|
+
unless File.exist? shield.path
|
62
|
+
warn "Cached shield image file was not found, maybe we failed to fetch it?"
|
63
|
+
return
|
64
|
+
end
|
65
|
+
if @site.static_files.select { |f|
|
66
|
+
f.is_a? StaticShieldFile
|
67
|
+
}.select { |s| s.name == shield.basename }.any?
|
68
|
+
log "#{shield.basename} already queued for static files"
|
69
|
+
return
|
70
|
+
end
|
71
|
+
# Polyglot compatibility
|
72
|
+
if @site.respond_to?(:active_lang)
|
73
|
+
log "Detected Polyglot"
|
74
|
+
unless @site.active_lang == @site.default_lang
|
75
|
+
log "Skipping copy because of non-default lang site is being built (active lang = #{@site.active_lang})"
|
76
|
+
return
|
77
|
+
end
|
78
|
+
end
|
79
|
+
@site.static_files << StaticShieldFile.new(@site, @site.source, File.join("_cache", "shields_io"), shield.basename, target_dir(true))
|
80
|
+
log "Cached shield queued for copying"
|
81
|
+
end
|
82
|
+
|
83
|
+
def target_dir(for_local = false)
|
84
|
+
if for_local
|
85
|
+
File.join "assets", "img", "shields"
|
86
|
+
end
|
87
|
+
"assets/img/shields"
|
88
|
+
end
|
89
|
+
|
90
|
+
private
|
91
|
+
|
92
|
+
def cache_dir
|
93
|
+
File.join(@source_dir, "_cache", "shields_io")
|
94
|
+
end
|
95
|
+
|
96
|
+
def hash_to_query(config, ignored_symbols)
|
97
|
+
c = config.clone
|
98
|
+
# Keys must be taken out from the clone because Jekyll seems to cache exact same calls to tags?
|
99
|
+
ignored_symbols.each { |s| c.delete(s) }
|
100
|
+
c.to_a.map { |k, v|
|
101
|
+
"#{k}=#{v}"
|
102
|
+
}.join "&"
|
103
|
+
end
|
104
|
+
|
105
|
+
def log(mes)
|
106
|
+
unless @site.config["verbose"] != true
|
107
|
+
warn mes
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
# Object to represent the Shields.IO shield (plus some extra stuff)
|
113
|
+
class Shield
|
114
|
+
# To be used for img tag.
|
115
|
+
# @return [Integer]
|
116
|
+
attr_reader :width
|
117
|
+
# To be used for img tag.
|
118
|
+
# @return [Integer]
|
119
|
+
attr_reader :height
|
120
|
+
# If not nil, make the shield image a link.
|
121
|
+
# @return [String]
|
122
|
+
attr_reader :href
|
123
|
+
# Alternative string for this shield, should the browser fails to load the image
|
124
|
+
# @return [String]
|
125
|
+
attr_reader :alt
|
126
|
+
# HTML class for this shield image.
|
127
|
+
# @return [String]
|
128
|
+
attr_reader :cls
|
129
|
+
# Path to the cache file. *Not* to be used for HTML - use :basename instead.
|
130
|
+
# @return [String]
|
131
|
+
attr_reader :path
|
132
|
+
# Basename of the shield.
|
133
|
+
# Specifying "assets/img/shields/" + :basename to src attribute should display this shield.
|
134
|
+
# @return [String]
|
135
|
+
attr_reader :basename
|
136
|
+
|
137
|
+
def initialize(width, height, path, href, alt, cls)
|
138
|
+
@width = width
|
139
|
+
@height = height
|
140
|
+
@path = path
|
141
|
+
@basename = File.basename path
|
142
|
+
@href = href
|
143
|
+
@alt = alt
|
144
|
+
@cls = cls
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
# Jekyll representation for the cached shield SVG files.
|
149
|
+
class StaticShieldFile < Jekyll::StaticFile
|
150
|
+
attr_reader :name
|
151
|
+
|
152
|
+
# Initialize a new CachedShield.
|
153
|
+
# site - The Site.
|
154
|
+
# base - The String path to the <source>.
|
155
|
+
# dir - The String path between <source> and the file.
|
156
|
+
# name - The String filename of the file.
|
157
|
+
# dest - The String destination path override.
|
158
|
+
def initialize(site, base, dir, name, dest)
|
159
|
+
super site, base, dir, name
|
160
|
+
@name = name
|
161
|
+
@dest = dest
|
162
|
+
end
|
163
|
+
|
164
|
+
def destination(dest)
|
165
|
+
File.join dest, @dest, @name
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
class ShieldError < StandardError
|
170
|
+
def initialize(msg = "Failed to fetch the shield.")
|
171
|
+
super
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
# Jekyll Liquid Tag for Shields.io
|
176
|
+
#
|
177
|
+
# Usage: {% shields_io <query param + special param as json> %}
|
178
|
+
class ShieldsIOTag < Liquid::Tag
|
179
|
+
def initialize(tag_name, input, parse_context)
|
180
|
+
super
|
181
|
+
# @type [Hash]
|
182
|
+
@payload = JSON.parse(input.strip, {symbolize_names: true})
|
183
|
+
end
|
184
|
+
|
185
|
+
def render(context)
|
186
|
+
fct = ShieldFactory.new context
|
187
|
+
shield = fct.get_shield @payload
|
188
|
+
if shield.nil?
|
189
|
+
raise ShieldError.new
|
190
|
+
end
|
191
|
+
fct.queue_shield shield
|
192
|
+
|
193
|
+
shield_tag = <<HTML
|
194
|
+
<img src="/#{fct.target_dir}/#{shield.basename}" width="#{shield.width}" height="#{shield.height}"
|
195
|
+
HTML
|
196
|
+
shield_tag += if !shield.alt.nil?
|
197
|
+
" alt=\"#{shield.alt}\" class=\"#{shield.cls}\"/>"
|
198
|
+
else
|
199
|
+
" class=\"#{shield.cls}\"/>"
|
200
|
+
end
|
201
|
+
if !shield.href.nil?
|
202
|
+
<<~HTML
|
203
|
+
<a href="#{shield.href}" class="#{shield.cls}">
|
204
|
+
#{shield_tag}
|
205
|
+
</a>
|
206
|
+
HTML
|
207
|
+
else
|
208
|
+
shield_tag
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
Liquid::Template.register_tag("shields_io", Jekyll::ShieldsIO::ShieldsIOTag)
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-shields_io
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- C. Plug
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-02-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jekyll
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.5'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.5'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: nokogiri
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.4'
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '2.0'
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.4'
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '2.0'
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: httparty
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0.17'
|
60
|
+
- - "<"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0.17'
|
70
|
+
- - "<"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '1.0'
|
73
|
+
description: |
|
74
|
+
This Jekyll plugin allows you to add a shields.io badge in your blog
|
75
|
+
without forming very long URLs - instead, the properties are set via JSON.
|
76
|
+
email: hsp.tosh.5200113@gmail.com
|
77
|
+
executables: []
|
78
|
+
extensions: []
|
79
|
+
extra_rdoc_files: []
|
80
|
+
files:
|
81
|
+
- ".editorconfig"
|
82
|
+
- ".gitignore"
|
83
|
+
- ".idea/.gitignore"
|
84
|
+
- ".idea/codeStyles/codeStyleConfig.xml"
|
85
|
+
- ".idea/inspectionProfiles/Project_Default.xml"
|
86
|
+
- ".idea/jekyll-shields-io.iml"
|
87
|
+
- ".idea/modules.xml"
|
88
|
+
- ".idea/vcs.xml"
|
89
|
+
- ".rspec"
|
90
|
+
- Gemfile
|
91
|
+
- Gemfile.lock
|
92
|
+
- LICENSE.txt
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- jekyll-shields_io.gemspec
|
96
|
+
- lib/jekyll-shields_io.rb
|
97
|
+
- lib/jekyll-shields_io/version.rb
|
98
|
+
homepage: https://github.com/clpsplug/jekyll-shields_io
|
99
|
+
licenses:
|
100
|
+
- MIT
|
101
|
+
metadata: {}
|
102
|
+
post_install_message:
|
103
|
+
rdoc_options: []
|
104
|
+
require_paths:
|
105
|
+
- lib
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
requirements: []
|
117
|
+
rubygems_version: 3.1.6
|
118
|
+
signing_key:
|
119
|
+
specification_version: 4
|
120
|
+
summary: Adds ability to put shields.io badges in your Jekyll blog
|
121
|
+
test_files: []
|