stepmod-utils 0.4.7 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/stepmod-srl-migrate +3 -2
- data/lib/stepmod/utils/converters/a.rb +10 -3
- data/lib/stepmod/utils/converters/arm.rb +1 -1
- data/lib/stepmod/utils/converters/base.rb +31 -0
- data/lib/stepmod/utils/converters/blockquote.rb +1 -1
- data/lib/stepmod/utils/converters/br.rb +1 -1
- data/lib/stepmod/utils/converters/bypass.rb +1 -1
- data/lib/stepmod/utils/converters/clause_ref.rb +1 -1
- data/lib/stepmod/utils/converters/code.rb +1 -1
- data/lib/stepmod/utils/converters/comment.rb +1 -1
- data/lib/stepmod/utils/converters/dd.rb +1 -1
- data/lib/stepmod/utils/converters/def.rb +1 -1
- data/lib/stepmod/utils/converters/definition.rb +1 -1
- data/lib/stepmod/utils/converters/description.rb +1 -1
- data/lib/stepmod/utils/converters/dl.rb +1 -1
- data/lib/stepmod/utils/converters/drop.rb +1 -1
- data/lib/stepmod/utils/converters/dt.rb +1 -1
- data/lib/stepmod/utils/converters/em.rb +1 -1
- data/lib/stepmod/utils/converters/em_express_description.rb +1 -1
- data/lib/stepmod/utils/converters/eqn.rb +1 -1
- data/lib/stepmod/utils/converters/example.rb +1 -1
- data/lib/stepmod/utils/converters/express_example.rb +1 -1
- data/lib/stepmod/utils/converters/express_g.rb +1 -1
- data/lib/stepmod/utils/converters/express_note.rb +1 -1
- data/lib/stepmod/utils/converters/express_ref.rb +1 -1
- data/lib/stepmod/utils/converters/express_ref_express_description.rb +1 -1
- data/lib/stepmod/utils/converters/ext_description.rb +1 -1
- data/lib/stepmod/utils/converters/ext_descriptions.rb +1 -1
- data/lib/stepmod/utils/converters/fund_cons.rb +1 -1
- data/lib/stepmod/utils/converters/head.rb +1 -1
- data/lib/stepmod/utils/converters/hr.rb +1 -1
- data/lib/stepmod/utils/converters/ignore.rb +1 -1
- data/lib/stepmod/utils/converters/introduction.rb +1 -1
- data/lib/stepmod/utils/converters/module_ref.rb +24 -5
- data/lib/stepmod/utils/converters/module_ref_express_description.rb +1 -1
- data/lib/stepmod/utils/converters/note.rb +1 -1
- data/lib/stepmod/utils/converters/ol.rb +1 -1
- data/lib/stepmod/utils/converters/p.rb +1 -1
- data/lib/stepmod/utils/converters/pass_through.rb +1 -1
- data/lib/stepmod/utils/converters/q.rb +1 -1
- data/lib/stepmod/utils/converters/resource.rb +1 -1
- data/lib/stepmod/utils/converters/schema.rb +1 -1
- data/lib/stepmod/utils/converters/schema_diag.rb +1 -1
- data/lib/stepmod/utils/converters/stem.rb +1 -1
- data/lib/stepmod/utils/converters/stepmod_ext_description.rb +1 -1
- data/lib/stepmod/utils/converters/strong.rb +1 -1
- data/lib/stepmod/utils/converters/sub.rb +1 -1
- data/lib/stepmod/utils/converters/sup.rb +1 -1
- data/lib/stepmod/utils/converters/synonym.rb +1 -1
- data/lib/stepmod/utils/converters/table.rb +1 -1
- data/lib/stepmod/utils/converters/term.rb +1 -1
- data/lib/stepmod/utils/converters/text.rb +2 -2
- data/lib/stepmod/utils/converters/uof.rb +1 -1
- data/lib/stepmod/utils/smrl_description_converter.rb +1 -1
- data/lib/stepmod/utils/smrl_resource_converter.rb +1 -1
- data/lib/stepmod/utils/stepmod_definition_converter.rb +1 -1
- data/lib/stepmod/utils/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30074f7f914399a053288da39ea9d8174da5fe9e5018fb5940a58e4d6b0c2cb1
|
4
|
+
data.tar.gz: b328f0eaf853ea85e9b25fcb4184477d01222af545f3e7fb224e20ffeab93f26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb61d04b4c2caa5a4e02edb84b34c2e78fa473cae5120d1d3d04f5e0feacd02c452121412a3dd8024d38033c5213b9c15e653731e766e1c3f5cc604cd2199feb
|
7
|
+
data.tar.gz: 5313c564f0f147609363f015368d5ac4176ad0653b810968fc6f3bc9e544093e53aeede2dffa74ae8cddd7ef0f5350618c9d8aced4092fdd846417b3c6aaa897
|
data/exe/stepmod-srl-migrate
CHANGED
@@ -149,14 +149,15 @@ log("[SRL MIGRATION] Migration starts!")
|
|
149
149
|
log("*"*30)
|
150
150
|
log("[SRL MIGRATION: stepmod2mn.jar] START SVG generation.")
|
151
151
|
log("*"*30)
|
152
|
-
system "java -Xss5m -jar #{stepmod2mn_path} #{stepmod_dir} --output #{srl_output_docs_dir} --svg"
|
152
|
+
system "java -Xss5m -jar #{stepmod2mn_path} #{stepmod_dir} --output-documents #{srl_output_docs_dir} --output-schemas #{srl_output_schemas_dir} --svg"
|
153
|
+
|
153
154
|
log("*"*30)
|
154
155
|
log("[SRL MIGRATION: stepmod2mn.jar] COMPLETE SVG generation.")
|
155
156
|
|
156
157
|
log("*"*30)
|
157
158
|
log("[SRL MIGRATION: stepmod2mn.jar] START document migration and SVG generation.")
|
158
159
|
log("*"*30)
|
159
|
-
system "java -Xss5m -jar #{stepmod2mn_path} #{stepmod_dir} --output #{srl_output_docs_dir}"
|
160
|
+
system "java -Xss5m -jar #{stepmod2mn_path} #{stepmod_dir} --output-documents #{srl_output_docs_dir} --output-schemas #{srl_output_schemas_dir}"
|
160
161
|
log("*"*30)
|
161
162
|
log("[SRL MIGRATION: stepmod2mn.jar] COMPLETE document migration and SVG generation.")
|
162
163
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Stepmod
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
|
-
class A <
|
6
|
+
class A < Stepmod::Utils::Converters::Base
|
7
7
|
def convert(node, state = {})
|
8
8
|
name = treat_children(node, state)
|
9
9
|
href = node["href"]
|
@@ -18,7 +18,7 @@ module Stepmod
|
|
18
18
|
"[[#{id}]]"
|
19
19
|
elsif href.to_s.start_with?("#")
|
20
20
|
href = href.sub(/^#/, "").gsub(/\s/, "").gsub(/__+/, "_")
|
21
|
-
if name.empty?
|
21
|
+
if name.empty? || number_with_optional_prefix?(name)
|
22
22
|
"<<#{href}>>"
|
23
23
|
else
|
24
24
|
"<<#{href},#{name}>>"
|
@@ -28,10 +28,17 @@ module Stepmod
|
|
28
28
|
else
|
29
29
|
name = title if name.empty?
|
30
30
|
href = "link:#{href}" unless href.to_s&.match?(URI::DEFAULT_PARSER.make_regexp)
|
31
|
-
link =
|
31
|
+
link = href
|
32
|
+
link += "[#{name}]" unless number_with_optional_prefix?(name)
|
32
33
|
" #{link}"
|
33
34
|
end
|
34
35
|
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def number_with_optional_prefix?(name)
|
40
|
+
/.*?\s*\(?\d+\)?/.match(name)
|
41
|
+
end
|
35
42
|
end
|
36
43
|
|
37
44
|
ReverseAdoc::Converters.register :a, A.new
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "reverse_adoc"
|
2
|
+
|
3
|
+
module Stepmod
|
4
|
+
module Utils
|
5
|
+
module Converters
|
6
|
+
class Base < ReverseAdoc::Converters::Base
|
7
|
+
PREFIXES_REGEX = /([Ff]ormula|[Ff]igure|[Tt]able)\s*/.freeze
|
8
|
+
|
9
|
+
def treat_children(node, state)
|
10
|
+
updated_node = remove_prefixes(node)
|
11
|
+
|
12
|
+
updated_node.children.inject("") do |memo, child|
|
13
|
+
memo << treat(child, state)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def remove_prefixes(node)
|
20
|
+
node.children.each_with_index do |child, index|
|
21
|
+
if child.text.match(PREFIXES_REGEX) && node.children[index + 1]&.name == "a"
|
22
|
+
child.content = child.content.gsub(PREFIXES_REGEX, "")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
node
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Stepmod
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
|
-
class Em <
|
6
|
+
class Em < Stepmod::Utils::Converters::Base
|
7
7
|
def convert(node, state = {})
|
8
8
|
content = treat_children(node, state.merge(already_italic: true))
|
9
9
|
if content.strip.empty? || state[:already_italic]
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Stepmod
|
2
2
|
module Utils
|
3
3
|
module Converters
|
4
|
-
class ExpressRefExpressDescription <
|
4
|
+
class ExpressRefExpressDescription < Stepmod::Utils::Converters::Base
|
5
5
|
def convert(node, _state = {})
|
6
6
|
parts = node["linkend"].to_s.split(":").last.split(".")
|
7
7
|
"<<express:#{parts.join('.').strip},#{parts.last.strip}>>"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Stepmod
|
2
2
|
module Utils
|
3
3
|
module Converters
|
4
|
-
class ExtDescription <
|
4
|
+
class ExtDescription < Stepmod::Utils::Converters::Base
|
5
5
|
def convert(node, state = {})
|
6
6
|
state = state.merge(schema_name: node["linkend"], non_flanking_whitesapce: true)
|
7
7
|
child_text = treat_children(node, state).strip
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Stepmod
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
|
-
class ModuleRef <
|
6
|
+
class ModuleRef < Stepmod::Utils::Converters::Base
|
7
7
|
def convert(node, _state = {})
|
8
8
|
link_end = node["linkend"].to_s.split(":")
|
9
9
|
ref_id = link_end.last
|
@@ -48,14 +48,22 @@ module Stepmod
|
|
48
48
|
# When we see this:
|
49
49
|
# <module_ref linkend="assembly_module_design:4_entities:figure:pudv">Figure 1</module_ref>
|
50
50
|
# We convert to this:
|
51
|
-
# <<figure-pudv
|
52
|
-
|
51
|
+
# <<figure-pudv>>
|
52
|
+
# When we see this (without a number):
|
53
|
+
# <module_ref linkend="assembly_module_design:4_entities:figure:pudv">This Figure</module_ref>
|
54
|
+
# We convert to this:
|
55
|
+
# <<figure-pudv,This Figure>>
|
56
|
+
create_ref(Figure.pattern(_state, ref_id), text)
|
53
57
|
when "table"
|
54
58
|
# When we see this:
|
55
59
|
# <module_ref linkend="independent_property_definition:4_entities:table:T1">Table 1</module_ref>
|
56
60
|
# We convert to this:
|
57
|
-
# <<table-T1
|
58
|
-
|
61
|
+
# <<table-T1>>
|
62
|
+
# When we see this (without a number):
|
63
|
+
# <module_ref linkend="independent_property_definition:4_entities:table:T1">This Table</module_ref>
|
64
|
+
# We convert to this:
|
65
|
+
# <<table-T1,This Table>>
|
66
|
+
create_ref(Table.pattern(_state, ref_id), text)
|
59
67
|
end
|
60
68
|
else
|
61
69
|
puts "[module_ref]: encountered unknown <module_ref> tag, #{link_end.join(":")}"
|
@@ -68,6 +76,17 @@ module Stepmod
|
|
68
76
|
|
69
77
|
private
|
70
78
|
|
79
|
+
def create_ref(link, text)
|
80
|
+
if number_with_optional_prefix?(text)
|
81
|
+
"<<#{link}>>"
|
82
|
+
else
|
83
|
+
"<<#{link},#{text}>>"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def number_with_optional_prefix?(text)
|
88
|
+
/.*?\s*\(?\d+\)?/.match(text)
|
89
|
+
end
|
71
90
|
end
|
72
91
|
ReverseAdoc::Converters.register :module_ref, ModuleRef.new
|
73
92
|
end
|
@@ -5,7 +5,7 @@ require "stepmod/utils/converters/table"
|
|
5
5
|
module Stepmod
|
6
6
|
module Utils
|
7
7
|
module Converters
|
8
|
-
class ModuleRefExpressDescription <
|
8
|
+
class ModuleRefExpressDescription < Stepmod::Utils::Converters::Base
|
9
9
|
def convert(node, _state = {})
|
10
10
|
link_end = node["linkend"].to_s.split(":")
|
11
11
|
ref_id = link_end.last
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Stepmod
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
|
-
class Q <
|
6
|
+
class Q < Stepmod::Utils::Converters::Base
|
7
7
|
def convert(node, state = {})
|
8
8
|
content = treat_children(node, state)
|
9
9
|
"#{content[/^\s*/]}\"#{content.strip}\"#{content[/\s*$/]}"
|
@@ -5,7 +5,7 @@ require "stepmod/utils/converters/em"
|
|
5
5
|
module Stepmod
|
6
6
|
module Utils
|
7
7
|
module Converters
|
8
|
-
class Stem <
|
8
|
+
class Stem < Stepmod::Utils::Converters::Base
|
9
9
|
def convert(node, state = {})
|
10
10
|
return Em.new.convert(node, state) if node.text.strip.length > 8
|
11
11
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Stepmod
|
2
2
|
module Utils
|
3
3
|
module Converters
|
4
|
-
class StepmodExtDescription <
|
4
|
+
class StepmodExtDescription < Stepmod::Utils::Converters::Base
|
5
5
|
def convert(node, state = {})
|
6
6
|
state = state.merge(schema_name: node["linkend"])
|
7
7
|
linkend = node["linkend"].split(".")
|
@@ -7,7 +7,7 @@ require "glossarist"
|
|
7
7
|
module Stepmod
|
8
8
|
module Utils
|
9
9
|
module Converters
|
10
|
-
class Term <
|
10
|
+
class Term < Stepmod::Utils::Converters::Base
|
11
11
|
|
12
12
|
# We strip all the children in the case for "stem:[d]-manifold"
|
13
13
|
# vs "stem:[d] -manifold"
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Stepmod
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
|
-
class Text <
|
6
|
+
class Text < Stepmod::Utils::Converters::Base
|
7
7
|
def convert(node, state = {})
|
8
8
|
if node.text.strip.empty?
|
9
9
|
treat_empty(node, state)
|
@@ -20,7 +20,7 @@ module Stepmod
|
|
20
20
|
""
|
21
21
|
elsif state[:tdsinglepara]
|
22
22
|
""
|
23
|
-
elsif node.text == " "
|
23
|
+
elsif node.text == " " # Regular whitespace text node
|
24
24
|
" "
|
25
25
|
else
|
26
26
|
""
|
@@ -5,7 +5,7 @@ require "stepmod/utils/converters/synonym"
|
|
5
5
|
module Stepmod
|
6
6
|
module Utils
|
7
7
|
module Converters
|
8
|
-
class Uof <
|
8
|
+
class Uof < Stepmod::Utils::Converters::Base
|
9
9
|
def convert(_node, _state = {})
|
10
10
|
# WARNING: <uof> tag content is deprecated
|
11
11
|
""
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stepmod-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -240,6 +240,7 @@ files:
|
|
240
240
|
- lib/stepmod/utils/concept.rb
|
241
241
|
- lib/stepmod/utils/converters/a.rb
|
242
242
|
- lib/stepmod/utils/converters/arm.rb
|
243
|
+
- lib/stepmod/utils/converters/base.rb
|
243
244
|
- lib/stepmod/utils/converters/blockquote.rb
|
244
245
|
- lib/stepmod/utils/converters/br.rb
|
245
246
|
- lib/stepmod/utils/converters/bypass.rb
|