kielce 2.0.0 → 2.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38341d1480aea6176a4d3d289f543a82c6846464268057cce43704b0c04fe811
4
- data.tar.gz: 711eca88ec683a63c017c326ff9169e5c14f8456cc91a499cac68ce77071b79c
3
+ metadata.gz: 96a898ef151c47cbb2c8e00cfacd36f8cca6df75cc885afe42c5933aa151ad34
4
+ data.tar.gz: fdbaf02fc59ebc75166ed85934263239ecbf172cb078b5eff8c7ce5a5f6f22f2
5
5
  SHA512:
6
- metadata.gz: 9359354d455c3e81e46d57f5a59da179137d60c016544cf57887677f67f5da578ccccf2e720a1c007703ddeaab093cd8c1403f417c947775220386722c9311ea
7
- data.tar.gz: b62f1d98c6309e32e4b97f26337c4538b8ed6e4b750bd399fc61d925768ce0e4f1b451f3542c40d9d3c92f69afc9807e972d7a177a2611137d2b5bfdd31757d6
6
+ metadata.gz: 865f0d9d6fecd8be05748c45dd043c79306d2edf43ff8bfa336a162fde9d3bb8c43ee650be3662580a30bc8648c669c5df2829697786947e30d9c5ee8b15e39c
7
+ data.tar.gz: 98967e3125f061543661fc30277854f9bb3764cf618544c04da18a9770134e09ba28db31cc9c976ece6db24f78573af3904d8db3d0a4f66e1aabaea2205f41ce
data/lib/kielce/kielce.rb CHANGED
@@ -38,7 +38,7 @@ module Kielce
38
38
  #
39
39
  # This could be a class method. We make it
40
40
  # an instance method so it can be used using the "$k.link" syntax.
41
- def link(url, text_param = nil, code: nil, classes: nil)
41
+ def link(url, text_param = nil, code: nil, classes: nil, target: nil)
42
42
  class_list = classes.nil? ? "" : " class='#{classes}'"
43
43
 
44
44
  # Make the text the same as the URL if no text given
@@ -47,7 +47,15 @@ module Kielce
47
47
  # use <code> if either (1) user requests it, or (2) no text_param given and no code param given
48
48
  text = "<code>#{text}</code>" if code || (text_param.nil? && code.nil?)
49
49
 
50
- "<a href='#{url}'#{class_list}>#{text}</a>"
50
+ if target.nil?
51
+ target_str = ''
52
+ else
53
+ target = "_#{target.to_s}" if target.is_a?(Symbol)
54
+ # NOTE: Space at the end of target_str is important
55
+ target_str = "target='#{target}' " unless target.nil?
56
+ end
57
+
58
+ "<a #{target_str}href='#{url}'#{class_list}>#{text}</a>"
51
59
  end
52
60
 
53
61
  # Load +file+ and run ERB. The binding parameter determines
data/lib/kielce.rb CHANGED
@@ -14,7 +14,12 @@ require "kielce/kielce"
14
14
  ##############################################################################################
15
15
 
16
16
  module Kielce
17
- VERSION = "2.0.0"
17
+ VERSION = "2.0.4"
18
+
19
+ # Changelog
20
+ #
21
+ # 2.0.4: Added a "target" option to "link", and made the timeline links open in a new tab.
22
+
18
23
 
19
24
  def self.run
20
25
 
@@ -51,8 +51,8 @@ module KielcePlugins
51
51
  end
52
52
 
53
53
  # build a link, if a link provided
54
- (linked && !@link.nil?) ? "<a href='#{@link}'>#{text}</a>" : text
55
- end
56
- end
57
- end
58
- end
54
+ (linked && !@link.nil?) ? "<a target='_blank' href='#{@link}'>#{text}</a>" : text
55
+ end # title
56
+ end # class Assignment
57
+ end # module Schedule
58
+ end # module KielcePlugins
@@ -13,7 +13,7 @@ module KielcePlugins
13
13
 
14
14
  attr_accessor :assignments, :schedule_days
15
15
 
16
- def initialize(filename)
16
+ def initialize(filename)
17
17
  workbook = RubyXL::Parser.parse(filename)
18
18
  @assignments = build_assignments(build_rows(workbook['Assignments'], Assignment::ASSIGNMENT_KEYS))
19
19
  @schedule_days = build_schedule_days(build_rows(workbook['Schedule'], SCHEDULE_KEYS))
@@ -24,10 +24,10 @@ module KielcePlugins
24
24
  # Replace link markup
25
25
  value.gsub!(/\[\[([^\s]+)(\s+(\S.*)|\s*)\]\]/) do
26
26
  text = $3.nil? ? "<code>#{$1}</code>" : $3
27
- "<a href='#{$1}'>#{text}</a>"
27
+ "<a target='_blank' href='#{$1}'>#{text}</a>"
28
28
  end
29
29
 
30
- value.gsub!(/<<(assign|due)\s+(\S.+)>>/) do
30
+ value.gsub!(/<<(assign|due|ref)\s+(\S.+?)>>/) do
31
31
  #$stderr.puts "Found assignment ref #{$1} --- #{$2} -- #{@assignments[$2].inspect}"
32
32
  $stderr.puts "Assignment #{$2} not found" unless @assignments.has_key?($2)
33
33
 
@@ -36,6 +36,8 @@ module KielcePlugins
36
36
  "Assign #{text}"
37
37
  elsif $1 == 'due'
38
38
  "<b>Due</b> #{text}"
39
+ elsif $1 == 'ref'
40
+ text
39
41
  else
40
42
  $stderr.puts "Unexpected match #{$1}"
41
43
  end
@@ -50,13 +52,13 @@ module KielcePlugins
50
52
  param = $2
51
53
 
52
54
  method = 'default' if method.empty?
53
- #$stderr.puts "Found link rule =>#{method}<= #{method.empty?} =>#{param}<="
55
+ # $stderr.puts "Found link rule =>#{method}<= #{method.empty?} =>#{param}<="
54
56
 
55
57
  link = $d.course.notesTemplates.method_missing(method, param)
56
58
  else
57
59
  link = link_rule
58
60
  end
59
- "(<a href='#{link}'>#{text}</a>)"
61
+ "(<a target='_blank' href='#{link}'>#{text}</a>)"
60
62
  end # end gsub
61
63
 
62
64
  end # end if value is string
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kielce
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zachary Kurmas
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-11 00:00:00.000000000 Z
11
+ date: 2022-01-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'An ERB-based templating engine for generating course documents. '
14
- email:
14
+ email:
15
15
  executables:
16
16
  - kielce
17
17
  extensions: []
@@ -31,7 +31,7 @@ homepage: https://github.com/kurmasz/KielceRB
31
31
  licenses:
32
32
  - MIT
33
33
  metadata: {}
34
- post_install_message:
34
+ post_install_message:
35
35
  rdoc_options: []
36
36
  require_paths:
37
37
  - lib
@@ -46,8 +46,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  requirements: []
49
- rubygems_version: 3.0.8
50
- signing_key:
49
+ rubygems_version: 3.2.3
50
+ signing_key:
51
51
  specification_version: 4
52
52
  summary: An ERB-based templating engine for generating course documents.
53
53
  test_files: []