elixir-toolkit-theme-plugins 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5431866052192d991faafb26e51d098141d161b58138d7ac87aa1107d79766ba
4
+ data.tar.gz: 735ca9af6a810b9e2d040097546c0d3fbffc2aec1611e0af7af1137c4fb0d664
5
+ SHA512:
6
+ metadata.gz: 484d25bb4f6579f4edbd1b633f20bf77a51d34959bb26b109270ab3fa1cd591183e9dd25c93fd837758920ffd64fb911f1884d3e7ac03ecdef07909c3da1fd48
7
+ data.tar.gz: b1dd4b53bb2bbc763a771da90c1ef599f52eb6c31bc33dae4241bf554fde852ab2b94ee5c4571feb876c5c03c031a1abc435b7695e18d23ab9e5e0a5a65f7555
@@ -0,0 +1,41 @@
1
+ name: Releasing Ruby Gem
2
+
3
+ on:
4
+ release:
5
+ types: [created]
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ build:
10
+ name: Publish
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Set up Ruby
16
+ uses: ruby/setup-ruby@v1.127.0
17
+ with:
18
+ ruby-version: '3.1'
19
+
20
+ - name: Publish to GPR
21
+ run: |
22
+ mkdir -p $HOME/.gem
23
+ touch $HOME/.gem/credentials
24
+ chmod 0600 $HOME/.gem/credentials
25
+ printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
26
+ gem build *.gemspec
27
+ gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
28
+ env:
29
+ GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
30
+ OWNER: ${{ github.repository_owner }}
31
+
32
+ - name: Publish to RubyGems
33
+ run: |
34
+ mkdir -p $HOME/.gem
35
+ touch $HOME/.gem/credentials
36
+ chmod 0600 $HOME/.gem/credentials
37
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
38
+ gem build *.gemspec
39
+ gem push *.gem
40
+ env:
41
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ elixir-toolkit-theme-plugins*
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 ELIXIR Belgium
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1 @@
1
+ # elixir-toolkit-theme-plugins
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib/', __FILE__)
3
+ $:.unshift lib unless $:.include?(lib)
4
+
5
+ require 'elixir-toolkit-theme-plugins/version'
6
+ require 'rake'
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = "elixir-toolkit-theme-plugins"
10
+ spec.version = Jekyll::Ett::VERSION.dup
11
+ spec.authors = ["bedroesb","janslifka"]
12
+ spec.email = ["bedro@psb.vib-ugent.be\n"]
13
+
14
+ spec.summary = "Plugins to work together with ELIXIR Toolkit theme"
15
+ spec.homepage = "https://elixir-belgium.github.io/elixir-toolkit-theme-plugins/"
16
+ spec.license = "MIT"
17
+
18
+ spec.date = Time.now
19
+
20
+ spec.files = `git ls-files -z`.split("\x0")
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_runtime_dependency "jekyll", '~> 4.3', ">= 4.3.1"
24
+ spec.add_development_dependency "rake", "~> 12.0"
25
+ end
@@ -0,0 +1,40 @@
1
+ require "jekyll"
2
+
3
+
4
+ module Jekyll
5
+ class Ett
6
+ module ToolTableFilter
7
+ def add_related_pages(data)
8
+ load_page_data
9
+
10
+ for tool in data
11
+ if tool['id'] && @related_pages[tool['id']]
12
+ tool['related_pages'] = @related_pages[tool['id']].to_a
13
+ end
14
+ end
15
+
16
+ data
17
+ end
18
+
19
+ private
20
+
21
+ def load_page_data
22
+ @related_pages = {}
23
+ pages_path = File.join(Dir.pwd, "pages", "**", "*.md")
24
+ Dir.glob(pages_path).each do |f|
25
+ file = File.read(f)
26
+ page_id_matches = file.match(/page_id:\s*(\w+)/)
27
+
28
+ if page_id_matches
29
+ page_id = page_id_matches[1]
30
+ file.scan(/\{% tool "([^"]+)" %}/).flatten.each do |m|
31
+ @related_pages[m] = Set[] unless @related_pages[m]
32
+ @related_pages[m].add(page_id)
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ Liquid::Template.register_filter(Jekyll::Ett::ToolTableFilter)
40
+ end
@@ -0,0 +1,70 @@
1
+ require "jekyll"
2
+
3
+
4
+ module Jekyll
5
+ class Ett
6
+ class ToolTag < Liquid::Tag
7
+ def initialize(tagName, content, tokens)
8
+ super
9
+ @content = content
10
+ load_tools
11
+ end
12
+
13
+ def load_tools
14
+ tools_path = File.join(Dir.pwd, "_data", "tool_and_resource_list.yml")
15
+ @tools = YAML.load(File.read(tools_path))
16
+ end
17
+
18
+ def render(context)
19
+ tool = find_tool(context[@content.strip])
20
+ tags = create_tags(tool["registry"])
21
+
22
+ %Q{<a
23
+ tabindex="0"
24
+ class="tool"
25
+ aria-description="#{tool["description"]}"
26
+ data-bs-toggle="popover"
27
+ data-bs-placement="bottom"
28
+ data-bs-trigger="focus"
29
+ data-bs-content="<h5><a href='#{tool["url"]}' target='_blank'>#{tool["name"]}</a></h5><div class='mb-2'>#{tool["description"]}</div>#{tags}"
30
+ data-bs-template="<div class='popover popover-tool' role='tooltip'><div class='popover-arrow'></div><h3 class='popover-header'></h3><div class='popover-body'></div></div>"
31
+ data-bs-html="true"
32
+ ><i class="fa-solid fa-wrench me-2"></i>#{ tool["name"] }</a>}
33
+ end
34
+
35
+ def find_tool(tool_id)
36
+ tool = @tools.find { |t| t["id"] == tool_id }
37
+ return tool if tool
38
+
39
+ raise Exception.new "Undefined tool ID: #{tool_id}"
40
+ end
41
+
42
+ def create_tags(registry)
43
+ tags = ""
44
+
45
+ if registry["biotools"]
46
+ tags << create_tag("https://bio.tools/#{registry["biotools"]}", "fa-info", "Tool info")
47
+ end
48
+
49
+ if registry["fairsharing"]
50
+ tags << create_tag("https://fairsharing.org/FAIRsharing.#{registry["fairsharing"]}", "fa-database", "Standards/Databases")
51
+ end
52
+
53
+ if registry["fairsharing-coll"]
54
+ tags << create_tag("https://fairsharing.org/#{registry["fairsharing-coll"]}", "fa-database", "Standards/Databases")
55
+ end
56
+
57
+ if registry["tess"]
58
+ tags << create_tag("https://tess.elixir-europe.org/search?q=#{registry["tess"]}", "fa-graduation-cap", "Training")
59
+ end
60
+
61
+ tags
62
+ end
63
+
64
+ def create_tag(url, icon, label)
65
+ "<a href='#{url}' class='mt-2 me-2'><span class='badge bg-dark text-white hover-primary'><i class='fa-solid #{icon} me-2'></i>#{label}</span></a>"
66
+ end
67
+ end
68
+ end
69
+ Liquid::Template.register_tag("tool", Jekyll::Ett::ToolTag)
70
+ end
@@ -0,0 +1,5 @@
1
+ module Jekyll
2
+ class Ett
3
+ VERSION = '0.1.0'
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'jekyll'
4
+
5
+ require "elixir-toolkit-theme-plugins/version"
6
+ require "elixir-toolkit-theme-plugins/tool_table_filter"
7
+ require "elixir-toolkit-theme-plugins/tool_tag"
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: elixir-toolkit-theme-plugins
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - bedroesb
8
+ - janslifka
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2022-12-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: jekyll
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '4.3'
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 4.3.1
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - "~>"
29
+ - !ruby/object:Gem::Version
30
+ version: '4.3'
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 4.3.1
34
+ - !ruby/object:Gem::Dependency
35
+ name: rake
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '12.0'
41
+ type: :development
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '12.0'
48
+ description:
49
+ email:
50
+ - 'bedro@psb.vib-ugent.be
51
+
52
+ '
53
+ executables: []
54
+ extensions: []
55
+ extra_rdoc_files: []
56
+ files:
57
+ - ".github/workflows/release.yml"
58
+ - ".gitignore"
59
+ - LICENSE
60
+ - README.md
61
+ - elixir-toolkit-theme-plugins.gemspec
62
+ - lib/elixir-toolkit-theme-plugins.rb
63
+ - lib/elixir-toolkit-theme-plugins/tool_table_filter.rb
64
+ - lib/elixir-toolkit-theme-plugins/tool_tag.rb
65
+ - lib/elixir-toolkit-theme-plugins/version.rb
66
+ homepage: https://elixir-belgium.github.io/elixir-toolkit-theme-plugins/
67
+ licenses:
68
+ - MIT
69
+ metadata: {}
70
+ post_install_message:
71
+ rdoc_options: []
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ requirements: []
85
+ rubygems_version: 3.3.26
86
+ signing_key:
87
+ specification_version: 4
88
+ summary: Plugins to work together with ELIXIR Toolkit theme
89
+ test_files: []