stepmod-utils 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/README.adoc +59 -2
- data/exe/stepmod-extract-terms +79 -20
- data/lib/stepmod/utils/bibdata.rb +1 -1
- data/lib/stepmod/utils/concept.rb +16 -3
- data/lib/stepmod/utils/converters/clause_ref.rb +2 -2
- data/lib/stepmod/utils/converters/def.rb +2 -2
- data/lib/stepmod/utils/converters/definition.rb +2 -2
- data/lib/stepmod/utils/converters/em.rb +3 -3
- data/lib/stepmod/utils/converters/example.rb +2 -2
- data/lib/stepmod/utils/converters/express_ref.rb +2 -2
- data/lib/stepmod/utils/converters/module_ref.rb +2 -2
- data/lib/stepmod/utils/converters/note.rb +2 -2
- data/lib/stepmod/utils/converters/ol.rb +4 -4
- data/lib/stepmod/utils/converters/stem.rb +2 -2
- data/lib/stepmod/utils/converters/synonym.rb +2 -2
- data/lib/stepmod/utils/converters/term.rb +2 -2
- data/lib/stepmod/utils/stepmod_definition_converter.rb +21 -21
- data/lib/stepmod/utils/version.rb +1 -1
- data/stepmod-utils.gemspec +2 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83672fac3acf9ef0d9a2ab17fffab1204b326c7d41018675c2cc819976ac8b40
|
4
|
+
data.tar.gz: 2a59c155d059ca7b73e48ebf5ddedac314e998dbb92eb301a55c460d8ac44e79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca130bac46780aeef8434443d68e02a83cfc2d17a5dd1634c13c6448fd33c1861e85cc3173303db64449e7da3465b1953ed344690894e09cd5698304c4b129eb
|
7
|
+
data.tar.gz: f4d94ac262f4c98ca810a1002c0bdc22d67cc3bd771521f4700e512386f226156d442de3c3f826c0aa7757bbc7d41a78dd42c22b166eca6a032b9b1177511424
|
data/Gemfile
CHANGED
data/README.adoc
CHANGED
@@ -10,7 +10,7 @@ image:https://img.shields.io/github/commits-since/metanorma/stepmod-utils/latest
|
|
10
10
|
|
11
11
|
== Purpose
|
12
12
|
|
13
|
-
The stepmod-utils Ruby gem provides a number of tools to work with the STEPmod repository
|
13
|
+
The `stepmod-utils` Ruby gem provides a number of tools to work with the STEPmod repository.
|
14
14
|
|
15
15
|
== Installation
|
16
16
|
|
@@ -25,7 +25,11 @@ Or include it in your gemspec.
|
|
25
25
|
|
26
26
|
[source,sh]
|
27
27
|
----
|
28
|
-
|
28
|
+
# Extracts from current directory
|
29
|
+
$ stepmod-extract-terms
|
30
|
+
|
31
|
+
# Extracts from specified stepmod/ or stepmod/data/ directory
|
32
|
+
$ stepmod-extract-terms {stepmod-data-directory}
|
29
33
|
----
|
30
34
|
|
31
35
|
Then these files will be created:
|
@@ -34,3 +38,56 @@ Then these files will be created:
|
|
34
38
|
* `991-generated-bibliography.adoc` all bibliographic sources where the terms come from
|
35
39
|
|
36
40
|
|
41
|
+
== CVS revision detection
|
42
|
+
|
43
|
+
If the STEPmod repository is a CVS repository, it will display the
|
44
|
+
working and repository revisions as comments.
|
45
|
+
|
46
|
+
WARNING: CVS revision detection can be *slow*! Be patient.
|
47
|
+
|
48
|
+
Sample output:
|
49
|
+
|
50
|
+
[source,sh]
|
51
|
+
----
|
52
|
+
[stepmod-utils] INFO: STEPmod directory set to ../x/stepmod/.
|
53
|
+
[stepmod-utils] INFO: STEPmod directory is a CVS repository and will detect revisions.
|
54
|
+
[stepmod-utils] INFO: [CVS] Detecting file revisions can be slow, please be patient!
|
55
|
+
[stepmod-utils] INFO: Detecting paths...
|
56
|
+
[stepmod-utils] INFO: Processing XML file data/business_object_models/managed_model_based_3d_engineering/business_object_model.xml
|
57
|
+
[stepmod-utils] INFO: Detecting CVS revision...
|
58
|
+
[stepmod-utils] INFO: CVS working rev (1.148), repo rev (1.148)
|
59
|
+
[stepmod-utils] INFO: Completed processing XML file data/business_object_models/managed_model_based_3d_engineering/business_object_model.xml
|
60
|
+
[stepmod-utils] INFO: Processing XML file data/business_object_models/managed_model_based_3d_engineering_domain/business_object_model.xml
|
61
|
+
[stepmod-utils] INFO: Detecting CVS revision...
|
62
|
+
[stepmod-utils] INFO: CVS working rev (1.31), repo rev (1.31)
|
63
|
+
[stepmod-utils] INFO: Completed processing XML file data/business_object_models/managed_model_based_3d_engineering_domain/business_object_model.xml
|
64
|
+
...
|
65
|
+
stepmod/data/business_object_models/managed_model_based_3d_engineering_domain/business_object_model.xml
|
66
|
+
[stepmod-utils] INFO: written to: 031-generated-terms.adoc
|
67
|
+
[stepmod-utils] INFO: written to: 991-generated-bibliography.adoc
|
68
|
+
----
|
69
|
+
|
70
|
+
|
71
|
+
== Non-CVS repository
|
72
|
+
|
73
|
+
If the STEPmod repository is not a CVS repository, or if the `cvs` executable
|
74
|
+
cannot be found, term extract will still work.
|
75
|
+
|
76
|
+
Sample output:
|
77
|
+
|
78
|
+
[source,sh]
|
79
|
+
----
|
80
|
+
[stepmod-utils] INFO: STEPmod directory set to ../iso-10303-stepmod.
|
81
|
+
[stepmod-utils] INFO: STEPmod directory is not a CVS repository, skipping revision detection.
|
82
|
+
[stepmod-utils] INFO: Detecting paths...
|
83
|
+
[stepmod-utils] INFO: Processing XML file data/application_protocols/boundary_representation_for_iso_14306_open_jt/application_protocol.xml
|
84
|
+
[stepmod-utils] INFO: skipped ISO/CD 10303-243 as it is not IS, DIS or TS
|
85
|
+
[stepmod-utils] INFO: Processing XML file data/application_protocols/configuration_control_3d_design_ed2/application_protocol.xml
|
86
|
+
[stepmod-utils] INFO: Completed processing XML file data/application_protocols/configuration_control_3d_design_ed2/application_protocol.xml
|
87
|
+
[stepmod-utils] INFO: Processing XML file data/application_protocols/electronic_assembly_interconnect_and_packaging_design/application_protocol.xml
|
88
|
+
[stepmod-utils] INFO: skipped ISO/CD 10303-210:2019 as it is not IS, DIS or TS
|
89
|
+
[stepmod-utils] INFO: Processing XML file data/application_protocols/functional_data_and_their_schematic_representation_for_process_plant/application_protocol.xml
|
90
|
+
[stepmod-utils] INFO: Completed processing XML file data/application_protocols/functional_data_and_their_schematic_representation_for_process_plant/application_protocol.xml
|
91
|
+
...
|
92
|
+
----
|
93
|
+
|
data/exe/stepmod-extract-terms
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
#!/usr/bin/env ruby
|
4
2
|
# encoding: UTF-8
|
5
3
|
|
4
|
+
require 'pry'
|
6
5
|
# resolve bin path, ignoring symlinks
|
7
6
|
require "pathname"
|
8
7
|
bin_file = Pathname.new(__FILE__).realpath
|
@@ -21,38 +20,89 @@ require 'bundler/setup'
|
|
21
20
|
require 'stepmod/utils/stepmod_definition_converter'
|
22
21
|
require 'stepmod/utils/bibdata'
|
23
22
|
require 'stepmod/utils/concept'
|
23
|
+
require 'ptools'
|
24
24
|
|
25
|
-
|
25
|
+
ReverseAdoc.config.unknown_tags = :bypass
|
26
26
|
|
27
27
|
parsed_terms = []
|
28
28
|
parsed_bibliography = []
|
29
29
|
encountered_terms = {}
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
31
|
+
stepmod_dir = ARGV.first || Dir.pwd
|
32
|
+
|
33
|
+
def log message
|
34
|
+
puts "[stepmod-utils] #{message}"
|
35
|
+
end
|
36
|
+
|
37
|
+
stepmod_path = Pathname.new(stepmod_dir).realpath
|
38
|
+
|
39
|
+
# If we are using the stepmod CVS repository, provide the revision number per file
|
40
|
+
has_cvs = File.which("cvs")
|
41
|
+
cvs_mode = has_cvs && Dir.exists?(stepmod_path.join('CVS'))
|
42
|
+
|
43
|
+
log "INFO: STEPmod directory set to #{stepmod_dir}."
|
44
|
+
|
45
|
+
if cvs_mode
|
46
|
+
log "INFO: STEPmod directory is a CVS repository and will detect revisions."
|
47
|
+
log "INFO: [CVS] Detecting file revisions can be slow, please be patient!"
|
48
|
+
else
|
49
|
+
log "INFO: STEPmod directory is not a CVS repository, skipping revision detection."
|
50
|
+
end
|
51
|
+
|
52
|
+
log "INFO: Detecting paths..."
|
53
|
+
|
54
|
+
files = %w(
|
55
|
+
resource.xml
|
56
|
+
application_protocol.xml
|
57
|
+
business_object_model.xml
|
58
|
+
module.xml
|
59
|
+
).inject([]) do |acc, t|
|
60
|
+
acc << Dir["#{stepmod_dir}/**/#{t}"]
|
40
61
|
end.flatten.sort.uniq
|
41
62
|
|
42
|
-
|
43
|
-
|
63
|
+
files.each do |file_path|
|
64
|
+
file_path = Pathname.new(file_path).realpath
|
65
|
+
fpath = file_path.relative_path_from(stepmod_path)
|
66
|
+
|
67
|
+
log "INFO: Processing XML file #{fpath}"
|
44
68
|
current_document = Nokogiri::XML(File.read(file_path)).root
|
45
69
|
|
46
70
|
bibdata = nil
|
47
71
|
begin
|
48
72
|
bibdata = Stepmod::Utils::Bibdata.new(document: current_document)
|
49
73
|
rescue
|
50
|
-
|
74
|
+
log "WARNING: Unknown file #{fpath}, skipped"
|
75
|
+
next
|
76
|
+
end
|
77
|
+
|
78
|
+
# TODO: we may want a command line option to override this in the future
|
79
|
+
unless %w(IS DIS TS).include? bibdata.doctype
|
80
|
+
log "INFO: skipped #{bibdata.docid} as it is not IS, DIS or TS"
|
51
81
|
next
|
52
82
|
end
|
53
83
|
|
54
84
|
if bibdata.part.to_s.empty?
|
55
|
-
|
85
|
+
log "FATAL: missing `part` attribute: #{fpath}"
|
86
|
+
log "INFO: skipped #{bibdata.docid} as it is missing `part` attribute."
|
87
|
+
next
|
88
|
+
end
|
89
|
+
|
90
|
+
revision_string = "\n// CVS: revision not detected"
|
91
|
+
if cvs_mode
|
92
|
+
# Run `cvs status` to find out version
|
93
|
+
|
94
|
+
log "INFO: Detecting CVS revision..."
|
95
|
+
Dir.chdir(stepmod_path) do
|
96
|
+
status = `cvs status #{fpath}`
|
97
|
+
|
98
|
+
unless status.empty?
|
99
|
+
working_rev = status.split(/\n/).grep(/Working revision:/).first.match(/revision:\s+(.+)$/)[1]
|
100
|
+
repo_rev = status.split(/\n/).grep(/Repository revision:/).first.match(/revision:\t(.+)\t/)[1]
|
101
|
+
log "INFO: CVS working rev (#{working_rev}), repo rev (#{repo_rev})"
|
102
|
+
revision_string = "\n// CVS working rev: (#{working_rev}), repo rev (#{repo_rev})\n" +
|
103
|
+
"// CVS: revision #{working_rev == repo_rev ? 'up to date' : 'differs'}"
|
104
|
+
end
|
105
|
+
end
|
56
106
|
end
|
57
107
|
|
58
108
|
# read definitions
|
@@ -61,23 +111,28 @@ paths.each do |file_path|
|
|
61
111
|
term_id = definition['id']
|
62
112
|
unless term_id.nil?
|
63
113
|
if encountered_terms[term_id]
|
64
|
-
|
114
|
+
log "FATAL: Duplicated term with id: #{term_id}, #{fpath}"
|
65
115
|
end
|
66
116
|
encountered_terms[term_id] = true
|
67
117
|
end
|
68
118
|
|
119
|
+
# Assume that definition is located in clause 3 of the ISO document
|
120
|
+
# in order. We really don't have a good reference here.
|
121
|
+
ref_clause = "3.#{index}"
|
122
|
+
|
69
123
|
concept = Stepmod::Utils::Concept.parse(
|
70
124
|
definition,
|
71
125
|
reference_anchor: bibdata.anchor,
|
72
|
-
|
73
|
-
|
74
|
-
reference_clause: "3.#{index}"
|
126
|
+
reference_clause: ref_clause,
|
127
|
+
file_path: fpath + revision_string
|
75
128
|
)
|
76
129
|
|
77
130
|
parsed_terms << concept
|
78
131
|
parsed_bibliography << bibdata
|
79
132
|
end
|
80
133
|
|
134
|
+
log "INFO: Completed processing XML file #{fpath}"
|
135
|
+
|
81
136
|
end
|
82
137
|
|
83
138
|
parsed_bibliography.uniq!
|
@@ -86,6 +141,10 @@ File.open('031-generated-terms.adoc', 'w') { |file|
|
|
86
141
|
file.puts(parsed_terms.map(&:to_mn_adoc).join("\n"))
|
87
142
|
}
|
88
143
|
|
144
|
+
log "INFO: written to: 031-generated-terms.adoc"
|
145
|
+
|
89
146
|
File.open('991-generated-bibliography.adoc', 'w') { |file|
|
90
147
|
file.puts(parsed_bibliography.map(&:to_mn_adoc).join("\n"))
|
91
148
|
}
|
149
|
+
|
150
|
+
log "INFO: written to: 991-generated-bibliography.adoc"
|
@@ -2,7 +2,17 @@ module Stepmod
|
|
2
2
|
module Utils
|
3
3
|
|
4
4
|
class Concept
|
5
|
-
attr_accessor *%w(
|
5
|
+
attr_accessor *%w(
|
6
|
+
designation
|
7
|
+
definition
|
8
|
+
reference_anchor
|
9
|
+
reference_clause
|
10
|
+
examples
|
11
|
+
notes
|
12
|
+
synonym
|
13
|
+
converted_definition
|
14
|
+
file_path
|
15
|
+
)
|
6
16
|
|
7
17
|
def initialize(options)
|
8
18
|
options.each_pair do |k, v|
|
@@ -10,20 +20,23 @@ module Stepmod
|
|
10
20
|
end
|
11
21
|
end
|
12
22
|
|
13
|
-
def self.parse(definition_xml, reference_anchor:, reference_clause:)
|
23
|
+
def self.parse(definition_xml, reference_anchor:, reference_clause:, file_path:)
|
14
24
|
new(
|
15
25
|
converted_definition: Stepmod::Utils::StepmodDefinitionConverter.convert(definition_xml),
|
16
26
|
reference_anchor: reference_anchor,
|
17
|
-
reference_clause: reference_clause
|
27
|
+
reference_clause: reference_clause,
|
28
|
+
file_path: file_path
|
18
29
|
)
|
19
30
|
end
|
20
31
|
|
21
32
|
def to_mn_adoc
|
22
33
|
<<~TEXT
|
34
|
+
// STEPmod path: #{file_path}
|
23
35
|
#{converted_definition}
|
24
36
|
|
25
37
|
[.source]
|
26
38
|
<<#{reference_anchor},clause=#{reference_clause}>>
|
39
|
+
|
27
40
|
TEXT
|
28
41
|
end
|
29
42
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Stepmod
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
|
-
class ClauseRef <
|
6
|
+
class ClauseRef < ReverseAdoc::Converters::Base
|
7
7
|
def convert(node, _state = {})
|
8
8
|
" term:[#{normalized_ref(node['linkend'])}] "
|
9
9
|
end
|
@@ -16,7 +16,7 @@ module Stepmod
|
|
16
16
|
ref.to_s.split(':').last.squeeze(' ').strip
|
17
17
|
end
|
18
18
|
end
|
19
|
-
|
19
|
+
ReverseAdoc::Converters.register :clause_ref, ClauseRef.new
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
module Stepmod
|
3
3
|
module Utils
|
4
4
|
module Converters
|
5
|
-
class Def <
|
5
|
+
class Def < ReverseAdoc::Converters::Base
|
6
6
|
def convert(node, state = {})
|
7
7
|
node = node.dup
|
8
8
|
"#{additional_block(node)}#{treat_children(node, state)}"
|
@@ -63,7 +63,7 @@ module Stepmod
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
|
66
|
+
ReverseAdoc::Converters.register :def, Def.new
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Stepmod
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
|
-
class Definition <
|
6
|
+
class Definition < ReverseAdoc::Converters::Base
|
7
7
|
def convert(node, state = {})
|
8
8
|
treat_children(node, state)
|
9
9
|
end
|
@@ -16,7 +16,7 @@ module Stepmod
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
ReverseAdoc::Converters.register :definition, Definition.new
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Stepmod
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
|
-
class Em <
|
6
|
+
class Em < ReverseAdoc::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]
|
@@ -14,8 +14,8 @@ module Stepmod
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
ReverseAdoc::Converters.register :em, Em.new
|
18
|
+
ReverseAdoc::Converters.register :cite, Em.new
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Stepmod
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
|
-
class Example <
|
6
|
+
class Example < ReverseAdoc::Converters::Base
|
7
7
|
def convert(node, state = {})
|
8
8
|
<<~TEMPLATE
|
9
9
|
[example]
|
@@ -13,7 +13,7 @@ module Stepmod
|
|
13
13
|
TEMPLATE
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
16
|
+
ReverseAdoc::Converters.register :example, Example.new
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -3,12 +3,12 @@
|
|
3
3
|
module Stepmod
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
|
-
class ExpressRef <
|
6
|
+
class ExpressRef < ReverseAdoc::Converters::Base
|
7
7
|
def convert(node, _state = {})
|
8
8
|
"*#{node['linkend'].to_s.split('.').last}*"
|
9
9
|
end
|
10
10
|
end
|
11
|
-
|
11
|
+
ReverseAdoc::Converters.register :express_ref, ExpressRef.new
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Stepmod
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
|
-
class ModuleRef <
|
6
|
+
class ModuleRef < ReverseAdoc::Converters::Base
|
7
7
|
def convert(node, _state = {})
|
8
8
|
ref = node['linkend']
|
9
9
|
# #23:
|
@@ -27,7 +27,7 @@ module Stepmod
|
|
27
27
|
ref.squeeze(' ').strip
|
28
28
|
end
|
29
29
|
end
|
30
|
-
|
30
|
+
ReverseAdoc::Converters.register :module_ref, ModuleRef.new
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Stepmod
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
|
-
class Note <
|
6
|
+
class Note < ReverseAdoc::Converters::Base
|
7
7
|
def convert(node, state = {})
|
8
8
|
<<~TEMPLATE
|
9
9
|
[NOTE]
|
@@ -13,7 +13,7 @@ module Stepmod
|
|
13
13
|
TEMPLATE
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
16
|
+
ReverseAdoc::Converters.register :note, Note.new
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Stepmod
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
|
-
class Ol <
|
6
|
+
class Ol < ReverseAdoc::Converters::Base
|
7
7
|
def convert(node, state = {})
|
8
8
|
id = node['id']
|
9
9
|
anchor = id ? "[[#{id}]]\n" : ""
|
@@ -44,9 +44,9 @@ module Stepmod
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
ReverseAdoc::Converters.register :ol, Ol.new
|
48
|
+
ReverseAdoc::Converters.register :ul, Ol.new
|
49
|
+
ReverseAdoc::Converters.register :dir, Ol.new
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
@@ -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 < ReverseAdoc::Converters::Base
|
9
9
|
def convert(node, state = {})
|
10
10
|
return Em.new.convert(node, state) if node.text.strip.length > 8
|
11
11
|
|
@@ -13,7 +13,7 @@ module Stepmod
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
|
16
|
+
ReverseAdoc::Converters.register :i, Stem.new
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -3,13 +3,13 @@
|
|
3
3
|
module Stepmod
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
|
-
class Synonym <
|
6
|
+
class Synonym < ReverseAdoc::Converters::Base
|
7
7
|
def convert(node, state = {})
|
8
8
|
"alt:[#{node.text.strip}]"
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
ReverseAdoc::Converters.register :synonym, Synonym.new
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -5,7 +5,7 @@ require 'stepmod/utils/converters/synonym'
|
|
5
5
|
module Stepmod
|
6
6
|
module Utils
|
7
7
|
module Converters
|
8
|
-
class Term <
|
8
|
+
class Term < ReverseAdoc::Converters::Base
|
9
9
|
def convert(node, state = {})
|
10
10
|
first_child = node.children.find do |child|
|
11
11
|
child.name == 'text' && !child.text.to_s.strip.empty?
|
@@ -23,7 +23,7 @@ module Stepmod
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
ReverseAdoc::Converters.register :term, Term.new
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'reverse_adoc'
|
4
4
|
require 'stepmod/utils/converters/clause_ref'
|
5
5
|
require 'stepmod/utils/converters/express_ref'
|
6
6
|
require 'stepmod/utils/converters/module_ref'
|
@@ -14,23 +14,23 @@ require 'stepmod/utils/converters/stem'
|
|
14
14
|
require 'stepmod/utils/converters/term'
|
15
15
|
require 'stepmod/utils/converters/synonym'
|
16
16
|
|
17
|
-
require '
|
18
|
-
require '
|
19
|
-
require '
|
20
|
-
require '
|
21
|
-
require '
|
22
|
-
require '
|
23
|
-
require '
|
24
|
-
require '
|
25
|
-
require '
|
26
|
-
require '
|
27
|
-
require '
|
28
|
-
require '
|
29
|
-
require '
|
30
|
-
require '
|
31
|
-
require '
|
32
|
-
require '
|
33
|
-
require '
|
17
|
+
require 'reverse_adoc/converters/a'
|
18
|
+
require 'reverse_adoc/converters/blockquote'
|
19
|
+
require 'reverse_adoc/converters/bypass'
|
20
|
+
require 'reverse_adoc/converters/br'
|
21
|
+
require 'reverse_adoc/converters/code'
|
22
|
+
require 'reverse_adoc/converters/drop'
|
23
|
+
require 'reverse_adoc/converters/head'
|
24
|
+
require 'reverse_adoc/converters/hr'
|
25
|
+
require 'reverse_adoc/converters/ignore'
|
26
|
+
require 'reverse_adoc/converters/li'
|
27
|
+
require 'reverse_adoc/converters/p'
|
28
|
+
require 'reverse_adoc/converters/pass_through'
|
29
|
+
require 'reverse_adoc/converters/q'
|
30
|
+
require 'reverse_adoc/converters/strong'
|
31
|
+
require 'reverse_adoc/converters/sup'
|
32
|
+
require 'reverse_adoc/converters/sub'
|
33
|
+
require 'reverse_adoc/converters/text'
|
34
34
|
|
35
35
|
|
36
36
|
module Stepmod
|
@@ -47,9 +47,9 @@ module Stepmod
|
|
47
47
|
|
48
48
|
root || (return '')
|
49
49
|
|
50
|
-
|
51
|
-
result =
|
52
|
-
|
50
|
+
ReverseAdoc.config.with(options) do
|
51
|
+
result = ReverseAdoc::Converters.lookup(root.name).convert(root)
|
52
|
+
ReverseAdoc.cleaner.tidy(result)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
data/stepmod-utils.gemspec
CHANGED
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.require_paths = ["lib"]
|
31
31
|
|
32
32
|
spec.add_runtime_dependency "thor", ">= 0.20.3"
|
33
|
-
spec.add_runtime_dependency "reverse_adoc", "
|
33
|
+
spec.add_runtime_dependency "reverse_adoc", ">= 0.2.9"
|
34
|
+
spec.add_runtime_dependency "ptools", '~> 1.3'
|
34
35
|
spec.add_development_dependency "byebug", "~> 11.1"
|
35
36
|
end
|
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
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -26,18 +26,32 @@ dependencies:
|
|
26
26
|
version: 0.20.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: reverse_adoc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.2.9
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.2.9
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: ptools
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
47
|
+
version: '1.3'
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
54
|
+
version: '1.3'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: byebug
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|