jekyll-pagelink 1.1.0
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.
- checksums.yaml +7 -0
- data/lib/jekyll-pagelink.rb +54 -0
- data/lib/version.rb +3 -0
- metadata +59 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f333f6f66ee8197b8a18d42cf92dc6576892f08ec6a110c46bc4cbce39619f00
|
4
|
+
data.tar.gz: 38620594a520a729507268ceb33ad990ae395cb8505c9d6b2755da1e7baa4650
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 88ffd45082dea340d81924c7461afd9b08dddf34f4e3fbc9351cd2396165818de7543292e523d47227774f157597f164fea06071cc111321040cad25a184064a
|
7
|
+
data.tar.gz: 984b0cae8c278504c0d833726209b1f1df4b983b7923a8744527b4d30f88dc8f8557390f4c7d5c6ce75b671c608fb1c45adac88a21a6446a56578f436b45547a
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Jekyll
|
2
|
+
class PageLink < Liquid::Tag
|
3
|
+
def initialize(tag_name, text, tokens)
|
4
|
+
super
|
5
|
+
values = text.split(',')
|
6
|
+
@hrefText = nil
|
7
|
+
@link = nil
|
8
|
+
@url = nil
|
9
|
+
|
10
|
+
if values.length == 1
|
11
|
+
@url = values[0].strip
|
12
|
+
else
|
13
|
+
@hrefText = values[0].strip
|
14
|
+
@url = values[1].strip
|
15
|
+
end
|
16
|
+
|
17
|
+
urlvalues = @url.split('#')
|
18
|
+
|
19
|
+
if urlvalues.length == 1
|
20
|
+
@link = urlvalues[0].strip
|
21
|
+
else
|
22
|
+
@link = urlvalues[0].strip
|
23
|
+
@anchor = urlvalues[1].strip
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def render(context)
|
28
|
+
site = context.registers[:site]
|
29
|
+
|
30
|
+
site.each_site_file do |p|
|
31
|
+
|
32
|
+
|
33
|
+
if @link == p.relative_path
|
34
|
+
if @anchor != nil
|
35
|
+
full_url= site.config["baseurl"] + p.url + "/#" + @anchor
|
36
|
+
else
|
37
|
+
full_url= site.config["baseurl"] + p.url
|
38
|
+
end
|
39
|
+
title = @hrefText
|
40
|
+
if @hrefText == nil
|
41
|
+
title = p.data["title"]
|
42
|
+
end
|
43
|
+
return "<a href=\"#{ full_url }\">#{ title }</a>"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
raise ArgumentError.new <<-eos
|
47
|
+
Could not find page "#{@link}" in tag 'page_link'.
|
48
|
+
Make sure the post exists and the name and date is correct.
|
49
|
+
eos
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
Liquid::Template.register_tag('page_link', Jekyll::PageLink)
|
data/lib/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-pagelink
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sebastien Andreo
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-12-30 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: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
description: Simplify the creation of intern links
|
28
|
+
email: sebastien@andreo.eu
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- lib/jekyll-pagelink.rb
|
34
|
+
- lib/version.rb
|
35
|
+
homepage: https://gitlab.com/SebastienAndreo/jekyll-pagelink
|
36
|
+
licenses:
|
37
|
+
- Nonstandard
|
38
|
+
metadata: {}
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options:
|
41
|
+
- "--charset=UTF-8"
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 1.9.3
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
requirements: []
|
55
|
+
rubygems_version: 3.1.2
|
56
|
+
signing_key:
|
57
|
+
specification_version: 2
|
58
|
+
summary: Jekyll link creation Automation
|
59
|
+
test_files: []
|