jekyll-theme-open-project-helpers 2.0.18 → 2.0.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: da36555e1f842b64fcdaad22a38dd74525c6ffe6
4
- data.tar.gz: f1acd009d682c175258c635bd96203526c3719f8
2
+ SHA256:
3
+ metadata.gz: ca57af7201d24be44b8599119f06542dc5259103eb3f1e7b6e2296039ba0a150
4
+ data.tar.gz: 8517f92762844b2b3c3219190c9240229d4217cf0d167ab69455e7bf8db257cc
5
5
  SHA512:
6
- metadata.gz: c379cdda8c9b677ed9fcd7eb03801d3a29e3189c201c24a175466172c10c05f389db716f84c52a7fa03a0543ddf752d73585ce59135052a12e2952381a1f5f53
7
- data.tar.gz: 7879abc68451e78432b22ab97f395568bd8e6b3e7ad8b407a705feb59d367b86c8b2b90a4821ff02acc7b084c656b83dd556958fbc77d024e49af50c7152b188
6
+ metadata.gz: b423c8c81a5c1f329c77fcf76e0fe6ea1471effd204320050f537aa26f6348be85c87b95d620ecc7a8e5fd37addc4658cfe881a5cff9d1536248f65247bf030d
7
+ data.tar.gz: f2bfa0879b66b8266e66a4e04d970fb35ec193f81d140291bbc629fc47071d9bfaa02042feb41865fd6de02422f42310dfa854a58e67cad109ec7cb6988ba585
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'jekyll-theme-open-project-helpers'
5
- s.version = '2.0.18'
5
+ s.version = '2.0.19'
6
6
  s.authors = ['Ribose Inc.']
7
7
  s.email = ['open.source@ribose.com']
8
8
 
@@ -7,7 +7,6 @@ require 'jekyll-theme-open-project-helpers/site_type'
7
7
  require 'jekyll-theme-open-project-helpers/project_data_reader'
8
8
  require 'jekyll-theme-open-project-helpers/filterable_index'
9
9
  require 'jekyll-theme-open-project-helpers/blog_index'
10
- require 'jekyll-theme-open-project-helpers/external_links'
11
10
  require 'jekyll-theme-open-project-helpers/spec_builders/spec_builder'
12
11
  require 'jekyll-theme-open-project-helpers/static_file_fix'
13
12
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-open-project-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.18
4
+ version: 2.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-04 00:00:00.000000000 Z
11
+ date: 2019-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -93,7 +93,6 @@ files:
93
93
  - jekyll-theme-open-project-helpers.gemspec
94
94
  - lib/jekyll-theme-open-project-helpers.rb
95
95
  - lib/jekyll-theme-open-project-helpers/blog_index.rb
96
- - lib/jekyll-theme-open-project-helpers/external_links.rb
97
96
  - lib/jekyll-theme-open-project-helpers/filterable_index.rb
98
97
  - lib/jekyll-theme-open-project-helpers/project_data_reader.rb
99
98
  - lib/jekyll-theme-open-project-helpers/site_type.rb
@@ -121,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
120
  version: '0'
122
121
  requirements: []
123
122
  rubyforge_project:
124
- rubygems_version: 2.5.2.3
123
+ rubygems_version: 2.7.6.2
125
124
  signing_key:
126
125
  specification_version: 4
127
126
  summary: Helpers for the Open Project Jekyll theme
@@ -1,49 +0,0 @@
1
- require 'nokogiri'
2
- require 'uri'
3
-
4
- # Given hostname and content, updates <a> elements as follows:
5
- #
6
- # - Adds `rel` attribute
7
- # - Appends inner markup for FontAwesome external link icon
8
- #
9
- # Only processes external links where `href` starts with "http"
10
- # and target host does not include given site hostname.
11
- def process_content(site_hostname, content, exclude_selectors=[])
12
- content = Nokogiri::HTML(content)
13
- content.css('body.site--project main a, body.site--hub.layout--post main a').each do |a|
14
- next if matches_one_of(a, exclude_selectors)
15
- next unless a.get_attribute('href') =~ /\Ahttp/i
16
- next if a.get_attribute('href') =~ /\Ahttp(s)?:\/\/#{site_hostname}\//i
17
- next if a.inner_html.include? "ico-ext"
18
- a.set_attribute('rel', 'external')
19
- a.inner_html = "#{a.inner_html}<span class='ico-ext'><i class='fas fa-external-link-square-alt'></i></span>"
20
- end
21
- return content.to_s
22
- end
23
-
24
- # Returns true if Nokogiri’s Node matches one of selectors,
25
- # otherwise return false
26
- def matches_one_of(node, selectors)
27
- for selector in selectors
28
- if node.matches? selector
29
- return true
30
- end
31
- end
32
- return false
33
- end
34
-
35
- Jekyll::Hooks.register :documents, :post_render do |doc|
36
- site_hostname = URI(doc.site.config['url']).host
37
- unmarked_link_selectors = doc.site.config['unmarked_external_link_selectors']
38
- unless doc.asset_file?
39
- doc.output = process_content(site_hostname, doc.output, unmarked_link_selectors)
40
- end
41
- end
42
-
43
- Jekyll::Hooks.register :pages, :post_render do |page|
44
- site_hostname = URI(page.site.config['url']).host
45
- unmarked_link_selectors = page.site.config['unmarked_external_link_selectors']
46
- unless page.asset_file?
47
- page.output = process_content(site_hostname, page.output, unmarked_link_selectors)
48
- end
49
- end