5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/stepmod/utils/converters/stepmod_ext_description.rb', line 5
def convert(node, state = {})
state = state.merge(schema_name: node["linkend"])
linkend = node["linkend"].split(".")
return nil if linkend.length != 2
child_text = treat_children(node, state).strip
return nil if child_text.empty?
first_child = child_text.split("\n").first
unless (
first_child =~ /between:?\s*\Z/ ||
first_child =~ /include:?\s*\Z/ ||
first_child =~ /of:?\s*\Z/ ||
first_child =~ /[:;]\s*\Z/
) &&
child_text =~ /\n\n\*/
child_text = first_child
end
if child_text =~ /\n\ +/
child_text = child_text.gsub(/\n\ +/, "\n")
end
domain = case linkend.first
when /_mim$/, /_arm$/
"application module"
else
"resource"
end
<<~TEMPLATE
=== #{linkend.last}
#{domain ? "domain:[#{domain}: #{linkend.first}]" : ''}
#{child_text.strip}
TEMPLATE
end
|