openhab-jrubyscripting 5.0.0.rc6 → 5.0.0.rc8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/openhab/core.rb +1 -1
- data/lib/openhab/dsl/version.rb +1 -1
- metadata +1 -4
- data/lib/openhab/yard/base_helper.rb +0 -46
- data/lib/openhab/yard/markdown_directive.rb +0 -125
- data/lib/openhab/yard/markdown_helper.rb +0 -99
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a08d2ec63be7c6f1049ddc92de20e0184a9c4e959c6a20e97ce9c9214520d94
|
4
|
+
data.tar.gz: 90178ba5a194cc91e24381c91bb691ddbafae498a033284a687698a8406c3b68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 659647412602ecb689524f4f760f1b4f6f054617190ffb8adee922daeb5a715b75f6e245a062f250e18b9262dc27667f7081ed2ca168454552ae1ca12fd24e0b
|
7
|
+
data.tar.gz: ac977120af8e531f0471d9f17601e7b59de9c9f44a40379d069b50227c4ec6d9674ab6f5a7791afb79f90174b6e532de3846f45d6f270459a94b2e12ecb47917
|
data/lib/openhab/core.rb
CHANGED
data/lib/openhab/dsl/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openhab-jrubyscripting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.0.
|
4
|
+
version: 5.0.0.rc8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Cutrer
|
@@ -488,7 +488,6 @@ files:
|
|
488
488
|
- lib/openhab/rspec/shell.rb
|
489
489
|
- lib/openhab/rspec/suspend_rules.rb
|
490
490
|
- lib/openhab/yard.rb
|
491
|
-
- lib/openhab/yard/base_helper.rb
|
492
491
|
- lib/openhab/yard/cli/stats.rb
|
493
492
|
- lib/openhab/yard/code_objects/group_object.rb
|
494
493
|
- lib/openhab/yard/code_objects/java/base.rb
|
@@ -503,8 +502,6 @@ files:
|
|
503
502
|
- lib/openhab/yard/handlers/jruby/java_import_handler.rb
|
504
503
|
- lib/openhab/yard/handlers/jruby/mixin_handler.rb
|
505
504
|
- lib/openhab/yard/html_helper.rb
|
506
|
-
- lib/openhab/yard/markdown_directive.rb
|
507
|
-
- lib/openhab/yard/markdown_helper.rb
|
508
505
|
- lib/openhab/yard/tags/constant_directive.rb
|
509
506
|
- lib/openhab/yard/tags/group_directive.rb
|
510
507
|
- lib/openhab/yard/tags/library.rb
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "nokogiri"
|
4
|
-
|
5
|
-
module OpenHAB
|
6
|
-
module YARD
|
7
|
-
# @!visibility private
|
8
|
-
module BaseHelper
|
9
|
-
def preprocess(text)
|
10
|
-
html = Nokogiri::HTML5.fragment(text)
|
11
|
-
|
12
|
-
context = if ENV["ADDON"]
|
13
|
-
:addon
|
14
|
-
else
|
15
|
-
:yard
|
16
|
-
end
|
17
|
-
|
18
|
-
# process directives on which content is supposed to be included in this context
|
19
|
-
node = html.children.first
|
20
|
-
loop do
|
21
|
-
break unless node
|
22
|
-
|
23
|
-
next_node = node.next
|
24
|
-
|
25
|
-
if node.comment? && (directive = MarkdownDirective.new(node)).directive?
|
26
|
-
next_node = directive.process(context) || next_node
|
27
|
-
end
|
28
|
-
node = next_node
|
29
|
-
end
|
30
|
-
|
31
|
-
html.to_s
|
32
|
-
end
|
33
|
-
|
34
|
-
def link_object(obj, title = nil, *)
|
35
|
-
::YARD::Handlers::JRuby::Base.infer_java_class(obj) if obj.is_a?(String)
|
36
|
-
obj = ::YARD::Registry.resolve(object, obj, true, true) if obj.is_a?(String)
|
37
|
-
if obj.is_a?(::YARD::CodeObjects::Java::Base) && (see = obj.docstring.tag(:see))
|
38
|
-
# link to the first see tag
|
39
|
-
return linkify(see.name, title&.to_s || see.text)
|
40
|
-
end
|
41
|
-
|
42
|
-
super
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,125 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "nokogiri"
|
4
|
-
|
5
|
-
module OpenHAB
|
6
|
-
module YARD
|
7
|
-
# @!visibility private
|
8
|
-
class MarkdownDirective
|
9
|
-
attr_reader :comment, :context
|
10
|
-
|
11
|
-
def initialize(comment)
|
12
|
-
@comment = comment
|
13
|
-
@lines = comment.text.split("\n")
|
14
|
-
directive_text = @lines.first.strip
|
15
|
-
|
16
|
-
@multiline = @lines.length > 1
|
17
|
-
@directive = false
|
18
|
-
return unless (match = directive_text.match(%r{^<(/)?(!)?([a-z]+)-only>$}))
|
19
|
-
|
20
|
-
@closing = match[1]
|
21
|
-
@context = match[3].to_sym
|
22
|
-
@inverted = match[2]
|
23
|
-
|
24
|
-
if closing? && multiline?
|
25
|
-
log.warn "In file `#{file}':#{line}: Multiline closing directives are not allowed (#{directive_text})."
|
26
|
-
return
|
27
|
-
end
|
28
|
-
@directive = true
|
29
|
-
end
|
30
|
-
|
31
|
-
def directive?
|
32
|
-
@directive
|
33
|
-
end
|
34
|
-
|
35
|
-
def multiline?
|
36
|
-
@multiline
|
37
|
-
end
|
38
|
-
|
39
|
-
def closing?
|
40
|
-
@closing
|
41
|
-
end
|
42
|
-
|
43
|
-
def inverted?
|
44
|
-
@inverted
|
45
|
-
end
|
46
|
-
|
47
|
-
def match?(context)
|
48
|
-
result = context == self.context
|
49
|
-
result = !result if inverted?
|
50
|
-
result
|
51
|
-
end
|
52
|
-
|
53
|
-
def closing_directive
|
54
|
-
return nil if multiline?
|
55
|
-
|
56
|
-
unless instance_variable_defined?(:@closing_directive)
|
57
|
-
next_node = @comment.next
|
58
|
-
loop do
|
59
|
-
return @closing_directive = nil unless next_node
|
60
|
-
|
61
|
-
if next_node.comment?
|
62
|
-
directive = MarkdownDirective.new(next_node)
|
63
|
-
if directive.directive? &&
|
64
|
-
directive.closing? &&
|
65
|
-
directive.context == context &&
|
66
|
-
directive.inverted? == inverted?
|
67
|
-
return @closing_directive = next_node
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
next_node = next_node.next
|
72
|
-
end
|
73
|
-
end
|
74
|
-
@closing_directive
|
75
|
-
end
|
76
|
-
|
77
|
-
def process(context)
|
78
|
-
return unless directive?
|
79
|
-
return if closing?
|
80
|
-
|
81
|
-
matched = match?(context)
|
82
|
-
|
83
|
-
# if it's a matched multiline, extract the contents and insert them directly,
|
84
|
-
# and remove the comment
|
85
|
-
if multiline?
|
86
|
-
result = comment.next
|
87
|
-
comment.before(Nokogiri::HTML5.fragment(@lines[1..].join("\n"))) if matched
|
88
|
-
comment.remove
|
89
|
-
return result
|
90
|
-
end
|
91
|
-
|
92
|
-
unless closing_directive
|
93
|
-
log.warn "In file `#{file}':#{line}: Unmatched directive <#{"!" if inverted?}#{context}-only>."
|
94
|
-
return
|
95
|
-
end
|
96
|
-
|
97
|
-
result = closing_directive.next
|
98
|
-
|
99
|
-
unless matched
|
100
|
-
# remove all nodes between the opening and closing directives
|
101
|
-
comment.next.remove while comment.next != closing_directive
|
102
|
-
end
|
103
|
-
# now remove the directives themselves
|
104
|
-
closing_directive.remove
|
105
|
-
comment.remove
|
106
|
-
result
|
107
|
-
end
|
108
|
-
|
109
|
-
def file
|
110
|
-
((defined?(@file) && @file) ? @file.filename : object.file) || "(unknown)"
|
111
|
-
end
|
112
|
-
|
113
|
-
def line
|
114
|
-
return @line if instance_variable_defined?(@line)
|
115
|
-
|
116
|
-
@line = (if defined?(@file) && @file
|
117
|
-
1
|
118
|
-
else
|
119
|
-
(object.docstring.line_range ? object.docstring.line_range.first : 1)
|
120
|
-
end) + (match ? $`.count("\n") : 0)
|
121
|
-
@line += comment.line - 1
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
@@ -1,99 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "nokogiri"
|
4
|
-
|
5
|
-
module OpenHAB
|
6
|
-
module YARD
|
7
|
-
# @!visibility private
|
8
|
-
module MarkdownHelper
|
9
|
-
# @group Linking Objects and URLs
|
10
|
-
|
11
|
-
def diskfile
|
12
|
-
preprocess(super)
|
13
|
-
end
|
14
|
-
|
15
|
-
# mostly copied from HTMLHelper
|
16
|
-
def resolve_links(text)
|
17
|
-
blockquotes = false
|
18
|
-
text.gsub(%r{(```)|(\\|!)?\{(?!\})(\S+?)(?:\s([^\}]*?\S))?\}(?=[\W<]|.+</|$)}m) do |str|
|
19
|
-
blockquote = $1
|
20
|
-
escape = $2
|
21
|
-
name = $3
|
22
|
-
title = $4
|
23
|
-
match = $&
|
24
|
-
if blockquote
|
25
|
-
blockquotes = !blockquotes
|
26
|
-
next str
|
27
|
-
end
|
28
|
-
next str if blockquotes
|
29
|
-
|
30
|
-
next(match[1..-1]) if escape
|
31
|
-
|
32
|
-
next(match) if name[0, 1] == '|'
|
33
|
-
|
34
|
-
if object.is_a?(String)
|
35
|
-
object
|
36
|
-
else
|
37
|
-
link = linkify(name, title)
|
38
|
-
if (link == name || link == title) && (name + ' ' + link !~ /\A<a\s.*>/)
|
39
|
-
match = /(.+)?(\{#{Regexp.quote name}(?:\s.*?)?\})(.+)?/.match(text)
|
40
|
-
file = (defined?(@file) && @file ? @file.filename : object.file) || '(unknown)'
|
41
|
-
line = (defined?(@file) && @file ? 1 : (object.docstring.line_range ? object.docstring.line_range.first : 1)) + (match ? $`.count("\n") : 0)
|
42
|
-
log.warn "In file `#{file}':#{line}: Cannot resolve link to #{name} from text" + (match ? ":" : ".") +
|
43
|
-
"\n\t" + (match[1] ? '...' : '') + match[2].delete("\n") + (match[3] ? '...' : '') if match
|
44
|
-
end
|
45
|
-
|
46
|
-
link
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# mostly copied from HTMLHelper
|
52
|
-
def link_object(obj, title = nil, anchor = nil, relative = true)
|
53
|
-
return title if obj.nil?
|
54
|
-
|
55
|
-
obj = Registry.resolve(object, obj, true, true) if obj.is_a?(String)
|
56
|
-
|
57
|
-
was_const = false
|
58
|
-
# Re-link references to constants that are aliases to their target. But keep
|
59
|
-
# their current title.
|
60
|
-
while obj.is_a?(CodeObjects::ConstantObject) && obj.target
|
61
|
-
title ||= h(object.relative_path(obj)).to_s
|
62
|
-
was_const = true
|
63
|
-
obj = obj.target
|
64
|
-
end
|
65
|
-
return link_object(obj, title, anchor, relative) if was_const
|
66
|
-
|
67
|
-
title = if title
|
68
|
-
title.to_s
|
69
|
-
elsif object.is_a?(CodeObjects::Base)
|
70
|
-
# Check if we're linking to a class method in the current
|
71
|
-
# object. If we are, create a title in the format of
|
72
|
-
# "CurrentClass.method_name"
|
73
|
-
if obj.is_a?(CodeObjects::MethodObject) && obj.scope == :class && obj.parent == object
|
74
|
-
h([object.name, obj.sep, obj.name].join)
|
75
|
-
elsif obj.title != obj.path
|
76
|
-
h(obj.title)
|
77
|
-
else
|
78
|
-
h(object.relative_path(obj))
|
79
|
-
end
|
80
|
-
else
|
81
|
-
h(obj.title)
|
82
|
-
end
|
83
|
-
return title unless serializer
|
84
|
-
return title if obj.is_a?(CodeObjects::Proxy)
|
85
|
-
|
86
|
-
link = url_for(obj, anchor, relative)
|
87
|
-
link ? link_url(link, title, title: h("#{obj.title} (#{obj.type})")) : title
|
88
|
-
rescue Parser::UndocumentableError
|
89
|
-
log.warn "The namespace of link #{obj.inspect} is a constant or invalid."
|
90
|
-
title || obj.to_s
|
91
|
-
end
|
92
|
-
|
93
|
-
def link_url(url, title = nil, _params = nil)
|
94
|
-
title ||= url
|
95
|
-
"[#{title}](#{url})"
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|