kielce 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kielce/kielce.rb +10 -2
- data/lib/kielce.rb +6 -1
- data/lib/kielce_plugins/schedule/assignment.rb +1 -1
- data/lib/kielce_plugins/schedule/schedule.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96a898ef151c47cbb2c8e00cfacd36f8cca6df75cc885afe42c5933aa151ad34
|
4
|
+
data.tar.gz: fdbaf02fc59ebc75166ed85934263239ecbf172cb078b5eff8c7ce5a5f6f22f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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.
|
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,7 +51,7 @@ 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
|
54
|
+
(linked && !@link.nil?) ? "<a target='_blank' href='#{@link}'>#{text}</a>" : text
|
55
55
|
end # title
|
56
56
|
end # class Assignment
|
57
57
|
end # module Schedule
|
@@ -24,7 +24,7 @@ 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
30
|
value.gsub!(/<<(assign|due|ref)\s+(\S.+?)>>/) do
|
@@ -58,7 +58,7 @@ module KielcePlugins
|
|
58
58
|
else
|
59
59
|
link = link_rule
|
60
60
|
end
|
61
|
-
"(<a href='#{link}'>#{text}</a>)"
|
61
|
+
"(<a target='_blank' href='#{link}'>#{text}</a>)"
|
62
62
|
end # end gsub
|
63
63
|
|
64
64
|
end # end if value is string
|