jekyll-zybook-tag 0.1.1 → 0.1.3

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
2
  SHA256:
3
- metadata.gz: acf9da92e83954d65542a35b007bfaf14d48953afaa4a2cefa186ea1ddcecd87
4
- data.tar.gz: 1440c068311b82d5f2e52e55e6c915e2db9f6365eb204113cf49b70340c5a9ff
3
+ metadata.gz: 5bc5a5695ff58bf35af5bbb49c3a7cbca1fb5796ac066c773aa79e75d25663c8
4
+ data.tar.gz: d7dcf6e07047eeadf72ae8f924dd2c141efea4ec89872fb6c76d65077c68087a
5
5
  SHA512:
6
- metadata.gz: 0ac9a7f636e231239ee186255c14dc4981edb4c82ff01734c88f4e590ed3418a8c75d9df4e438cc059a2fb9a3c9f7c28b16b178916f41c3c4cbc433f993e9dba
7
- data.tar.gz: d1b6cff25a5a80f2d9ede503e37c7c4fde81ae2ea9340188cb9a038393d640f66f7716bc7d1b62a960eb17305ac201d35893eea019994df434680523ece878cf
6
+ metadata.gz: 27ab04d016e96fa5ccf3d4442f8cfe23dbe2e3824ea68567994e5bee2fe4294dc329d69bcbbaccc432d53c1983b4de20d426efd1185d325ad7e95dc23aa7504c
7
+ data.tar.gz: 87fc49672fabdd2dd6cba3cef508ea9f12348fe6bf95bc957a41fdb9f9483d5f212b60ba46fd5369dc8e2ac21ca9a89718bf4cceba3575206479caf2f2e91cf7
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2020 Colorado State University
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.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Colorado State University
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 CHANGED
@@ -1,52 +1,52 @@
1
- # Zybooks Liquid Tag Plugin
2
-
3
-
4
- This allows a link to the most recent version of zybooks, without having to
5
- change links throughout the entire website. Instead the link updates based on the contents
6
- of the _config.yml direction.
7
-
8
- ## Setup
9
- Make sure the _config.yml includes the line zybook, and book-id
10
-
11
- ```yaml
12
- zybook:
13
- book_id: "COLOSTATECS1634Summer2020"
14
- ```
15
- Replace COLOSTATE... with your latest book ID, that is find in the URL of the book. For example:
16
-
17
- ```
18
- https://learn.zybooks.com/zybook/COLOSTATECS1634Summer2020/`
19
- ```
20
-
21
-
22
- ## Usage
23
-
24
- ```
25
- {% zybook chapter:x section:x %}Link text{% endzybook %}
26
- ```
27
-
28
- For example:
29
- ```
30
- {% zybook chapter:13 section:2 %}Loops{%endzybook%}
31
- ```
32
- would create the following link (assuming Summer Book)
33
- ```html
34
- <a href="https://learn.zybooks.com/zybook/COLOSTATECS1634Summer2020/chapter/13/section/2" target="_blank">Loops</a>
35
- ```
36
-
37
- Arguments are optional, possible arguments are as follows:
38
-
39
- * chapter
40
- defaults to nothing, directing the link to the zybook TOC if omitted
41
- * section
42
- defaults to 1
43
- * resource_id
44
- for the content_resource_id in links, defaults to nothing
45
-
46
- The text between the tag block is used for the link text.
47
-
48
- ## _config.yml options
49
- All arguments can also be included in the _config.yml. They will
50
- be used as default arguments, but local (placing in the tag) use overwrites
51
- the _config.yml setting. In most cases, the only option
1
+ # Zybooks Liquid Tag Plugin
2
+
3
+
4
+ This allows a link to the most recent version of zybooks, without having to
5
+ change links throughout the entire website. Instead the link updates based on the contents
6
+ of the _config.yml direction.
7
+
8
+ ## Setup
9
+ Make sure the _config.yml includes the line zybook, and book-id
10
+
11
+ ```yaml
12
+ zybook:
13
+ book_id: "COLOSTATECS1634Summer2020"
14
+ ```
15
+ Replace COLOSTATE... with your latest book ID, that is find in the URL of the book. For example:
16
+
17
+ ```
18
+ https://learn.zybooks.com/zybook/COLOSTATECS1634Summer2020/`
19
+ ```
20
+
21
+
22
+ ## Usage
23
+
24
+ ```
25
+ {% zybook chapter:x section:x %}Link text{% endzybook %}
26
+ ```
27
+
28
+ For example:
29
+ ```
30
+ {% zybook chapter:13 section:2 %}Loops{%endzybook%}
31
+ ```
32
+ would create the following link (assuming Summer Book)
33
+ ```html
34
+ <a href="https://learn.zybooks.com/zybook/COLOSTATECS1634Summer2020/chapter/13/section/2" target="_blank">Loops</a>
35
+ ```
36
+
37
+ Arguments are optional, possible arguments are as follows:
38
+
39
+ * chapter
40
+ defaults to nothing, directing the link to the zybook TOC if omitted
41
+ * section
42
+ defaults to 1
43
+ * resource_id
44
+ for the content_resource_id in links, defaults to nothing
45
+
46
+ The text between the tag block is used for the link text.
47
+
48
+ ## _config.yml options
49
+ All arguments can also be included in the _config.yml. They will
50
+ be used as default arguments, but local (placing in the tag) use overwrites
51
+ the _config.yml setting. In most cases, the only option
52
52
  in _config.yml that makes sense is `book-id`.
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "jekyll-zybook-tag"
5
+ spec.version = "0.1.3"
6
+ spec.authors = ["Albert Lionelle"]
7
+ spec.email = ["Albert.Lionelle@colostate.edu"]
8
+
9
+ spec.summary = "Jekyll-zybook Tag for include zybooks content from Semester to Semester, developed to work with Colorado State University Courses, but can be used for any course that uses zybooks and jekyll."
10
+ spec.homepage = "https://github.com/Dept-of-Computer-Science/jekyll-zybook-tag"
11
+ spec.license = "MIT"
12
+
13
+ spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r!^(jekyll-zybook-tag|LICENSE|README)!i) }
14
+
15
+ spec.add_runtime_dependency "jekyll", ">= 2.0.0"
16
+
17
+ spec.add_development_dependency "bundler"
18
+ spec.add_development_dependency "rake"
19
+
20
+ end
@@ -1,94 +1,94 @@
1
- # Zybooks Link Plugin
2
- #
3
- # The following plugin creates a liquid tag that links to the most recent zybooks for the course
4
- # it needs to have the zybook in the _config.yml file for it successfully link for students.
5
- #
6
- #
7
- # example usage
8
- # {% zybook chapter:x section:x %}{% endzybook %}
9
- #
10
- # For example:
11
- # {% zybook chapter:13 section:2 %}Loops{%endzybook%}
12
- # would create the following link (assuming Summer Book)
13
- # <a href="http://https://learn.zybooks.com/zybook/COLOSTATECS1634Summer2020/chapter/13/section/2" target="_blank">Loops</a>
14
- #
15
- # All arguments are OPTIONAL the defaults are follows
16
- # chapter = nothing
17
- # section = 1 (if chapter is specified)
18
- # resource_id = nothing
19
- # So just putting in {% zybook %} would link to the TOC of your zybook.
20
- #
21
- #
22
- #
23
- module Jekyll
24
- module CSU_Plugin_Zybook
25
- class ZybookTag < Liquid::Block
26
-
27
-
28
- @@DEFAULTS = {
29
- :chapter => '',
30
- :section => '1',
31
- :book_base => 'https://learn.zybooks.com/zybook/',
32
- :book_id => 'invalid',
33
- :resource_id => ''
34
- }
35
-
36
- def self.DEFAULTS
37
- return @@DEFAULTS
38
- end
39
-
40
- def initialize(tag_name, markup, tokens)
41
- super
42
-
43
- @config = {}
44
- # set defaults
45
- override_config(@@DEFAULTS)
46
-
47
- # override configuration with values defined within _config.yml
48
-
49
- if Jekyll.configuration({}).has_key?('zybook')
50
- jek_config = Jekyll.configuration({})['zybook']
51
- override_config(jek_config)
52
- end
53
-
54
- params = markup.split
55
-
56
-
57
-
58
- if params.size > 0
59
- # override configuration with parameters
60
- pconfig = {} # reset local config
61
- params.each do |param|
62
- param = param.gsub /\s+/, '' # remove whitespaces
63
- key, value = param.split(':',2) # split first occurrence of ':' only
64
- pconfig[key.to_sym] = value
65
- end
66
- override_config(pconfig)
67
- end
68
- end
69
-
70
- def override_config(config)
71
- config.each{ |key,value| @config[key] = value }
72
- end
73
-
74
- def render(context)
75
- content = super
76
-
77
- rtn = ""
78
- if @config[:chapter].empty?
79
- rtn = "<a href='#{@config[:book_base]}/#{@config["book_id"]}/' target='_blank'>#{content}</a>".gsub(%r{/{2,}}, '/')
80
- elsif @config[:resource_id].empty?
81
- rtn = "<a href='#{@config[:book_base]}/#{@config["book_id"]}/chapter/#{@config[:chapter]}/section/#{@config[:section]}/' target='_blank'>#{content}</a>".gsub(%r{/{2,}}, '/')
82
- else #content_resource_id was included
83
- rtn = "<a href='#{@config[:book_base]}/#{@config["book_id"]}/chapter/#{@config[:chapter]}/section/#{@config[:section]}?content_resource_id=#{@config[:resource_id]}' target='_blank'>#{content}</a>".gsub(%r{/{2,}}, '/')
84
- end
85
-
86
- return rtn
87
- end
88
- end
89
- end
90
- end
91
-
92
- Liquid::Template.register_tag('zybook', Jekyll::CSU_Plugin_Zybook::ZybookTag)
93
-
94
-
1
+ # Zybooks Link Plugin
2
+ #
3
+ # The following plugin creates a liquid tag that links to the most recent zybooks for the course
4
+ # it needs to have the zybook in the _config.yml file for it successfully link for students.
5
+ #
6
+ #
7
+ # example usage
8
+ # {% zybook chapter:x section:x %}{% endzybook %}
9
+ #
10
+ # For example:
11
+ # {% zybook chapter:13 section:2 %}Loops{%endzybook%}
12
+ # would create the following link (assuming Summer Book)
13
+ # <a href="http://https://learn.zybooks.com/zybook/COLOSTATECS1634Summer2020/chapter/13/section/2" target="_blank">Loops</a>
14
+ #
15
+ # All arguments are OPTIONAL the defaults are follows
16
+ # chapter = nothing
17
+ # section = 1 (if chapter is specified)
18
+ # resource_id = nothing
19
+ # So just putting in {% zybook %} would link to the TOC of your zybook.
20
+ #
21
+ #
22
+ #
23
+ module Jekyll
24
+ module CSU_Plugin_Zybook
25
+ class ZybookTag < Liquid::Block
26
+
27
+
28
+ @@DEFAULTS = {
29
+ :chapter => '',
30
+ :section => '1',
31
+ :book_base => 'https://learn.zybooks.com/zybook/',
32
+ :book_id => 'invalid',
33
+ :resource_id => ''
34
+ }
35
+
36
+ def self.DEFAULTS
37
+ return @@DEFAULTS
38
+ end
39
+
40
+ def initialize(tag_name, markup, tokens)
41
+ super
42
+
43
+ @config = {}
44
+ # set defaults
45
+ override_config(@@DEFAULTS)
46
+
47
+ # override configuration with values defined within _config.yml
48
+
49
+ if Jekyll.configuration({}).has_key?('zybook')
50
+ jek_config = Jekyll.configuration({})['zybook']
51
+ override_config(jek_config)
52
+ end
53
+
54
+ params = markup.split
55
+
56
+
57
+
58
+ if params.size > 0
59
+ # override configuration with parameters
60
+ pconfig = {} # reset local config
61
+ params.each do |param|
62
+ param = param.gsub /\s+/, '' # remove whitespaces
63
+ key, value = param.split(':',2) # split first occurrence of ':' only
64
+ pconfig[key.to_sym] = value
65
+ end
66
+ override_config(pconfig)
67
+ end
68
+ end
69
+
70
+ def override_config(config)
71
+ config.each{ |key,value| @config[key] = value }
72
+ end
73
+
74
+ def render(context)
75
+ content = super
76
+
77
+ rtn = ""
78
+ if @config[:chapter].empty?
79
+ rtn = "<a href='#{@config[:book_base]}/#{@config["book_id"]}/' target='_blank'>#{content}</a>".gsub(%r{/{2,}}, '/')
80
+ elsif @config[:resource_id].empty?
81
+ rtn = "<a href='#{@config[:book_base]}/#{@config["book_id"]}/chapter/#{@config[:chapter]}/section/#{@config[:section]}/' target='_blank'>#{content}</a>".gsub(%r{/{2,}}, '/')
82
+ else #content_resource_id was included
83
+ rtn = "<a href='#{@config[:book_base]}/#{@config["book_id"]}/chapter/#{@config[:chapter]}/section/#{@config[:section]}?content_resource_id=#{@config[:resource_id]}' target='_blank'>#{content}</a>".gsub(%r{/{2,}}, '/')
84
+ end
85
+
86
+ return rtn
87
+ end
88
+ end
89
+ end
90
+ end
91
+
92
+ Liquid::Template.register_tag('zybook', Jekyll::CSU_Plugin_Zybook::ZybookTag)
93
+
94
+
metadata CHANGED
@@ -1,69 +1,68 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-zybook-tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Albert Lionelle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-02 00:00:00.000000000 Z
11
+ date: 2021-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.8'
19
+ version: 2.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '3.8'
26
+ version: 2.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '2.0'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '12.0'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '12.0'
54
+ version: '0'
55
55
  description:
56
56
  email:
57
57
  - Albert.Lionelle@colostate.edu
58
58
  executables: []
59
59
  extensions: []
60
- extra_rdoc_files:
61
- - README.md
62
- - LICENSE.txt
60
+ extra_rdoc_files: []
63
61
  files:
64
62
  - LICENSE.txt
65
63
  - README.md
66
- - lib/jekyll-zybook-tag.rb
64
+ - jekyll-zybook-tag.gemspec
65
+ - jekyll-zybook-tag.rb
67
66
  homepage: https://github.com/Dept-of-Computer-Science/jekyll-zybook-tag
68
67
  licenses:
69
68
  - MIT
@@ -83,8 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
82
  - !ruby/object:Gem::Version
84
83
  version: '0'
85
84
  requirements: []
86
- rubyforge_project:
87
- rubygems_version: 2.7.6
85
+ rubygems_version: 3.1.4
88
86
  signing_key:
89
87
  specification_version: 4
90
88
  summary: Jekyll-zybook Tag for include zybooks content from Semester to Semester,