jekyll-link-url-filter 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/jekyll-link-url-filter.rb +23 -0
  3. metadata +68 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 23d6dcf12783a045cbd40dc96c2efb2a3e21ca2924191f39cd6b7e76da7f20f8
4
+ data.tar.gz: 6a43951f34b7c3e5e3734775ce47e0d693ad210e1ef9cf66e99ce7eb6086bc83
5
+ SHA512:
6
+ metadata.gz: 5ca502c1634d83d7552843867afa6b47538fab587979b09e18e347421ed80ecf2d25e9ca497b89b6f00fada9e1d0f28eea7e1579141080ffdebad7f39ac0aad0
7
+ data.tar.gz: b65e3b29384901bc2176746eb4743e95c1fd3685910006219fc05c9275aa5e5398c6dc29f023a0c4e5f34091443c68d81b12f39478419d8bf704a4159e9e7351
@@ -0,0 +1,23 @@
1
+ module Jekyll
2
+ module LinkFilter
3
+ def link_url(input)
4
+ # This is taken from https://github.com/jekyll/jekyll/blob/d971e39b4feca9c8d2e8c7e954aa78713ce4eb90/lib/jekyll/tags/link.rb
5
+ # Tweaked to work via filters.
6
+ site = @context.registers[:site]
7
+ relative_path = Liquid::Template.parse(input).render(@context)
8
+
9
+ site.each_site_file do |item|
10
+ return relative_url(item) if item.relative_path == relative_path
11
+ # This takes care of the case for static files that have a leading /
12
+ return relative_url(item) if item.relative_path == "/#{relative_path}"
13
+ end
14
+
15
+ raise ArgumentError, <<~MSG
16
+ Could not find document '#{relative_path}' in filter '#{__method__}'.
17
+ Make sure the document exists and the path is correct.
18
+ MSG
19
+ end
20
+ end
21
+ end
22
+
23
+ Liquid::Template.register_filter(Jekyll::LinkFilter)
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-link-url-filter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Angus Johnston
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-11-04 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.7'
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.7'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
33
+ description:
34
+ email:
35
+ - admin+rubygems@codeanimu.net
36
+ executables: []
37
+ extensions: []
38
+ extra_rdoc_files: []
39
+ files:
40
+ - lib/jekyll-link-url-filter.rb
41
+ homepage: https://github.com/DakuTree/jekyll-git-updated
42
+ licenses:
43
+ - MIT
44
+ metadata:
45
+ homepage_uri: https://github.com/DakuTree/jekyll-git-updated
46
+ source_code_uri: https://github.com/DakuTree/jekyll-git-updated
47
+ changelog_uri: https://github.com/DakuTree/jekyll-git-updated/blob/master/CHANGELOG.md
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubygems_version: 3.0.3
64
+ signing_key:
65
+ specification_version: 4
66
+ summary: This adds a link_url filter which acts like the link tag, except it works
67
+ with variables.
68
+ test_files: []