stepmod-utils 0.6.7 → 0.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/Gemfile +6 -3
- data/exe/stepmod-convert-express-description +1 -1
- data/exe/stepmod-convert-express-resource +1 -1
- data/lib/stepmod/utils/cleaner.rb +31 -2
- data/lib/stepmod/utils/concept.rb +33 -17
- data/lib/stepmod/utils/converters/a.rb +2 -2
- data/lib/stepmod/utils/converters/arm.rb +2 -2
- data/lib/stepmod/utils/converters/base.rb +3 -23
- data/lib/stepmod/utils/converters/clause_ref.rb +2 -2
- data/lib/stepmod/utils/converters/comment.rb +2 -2
- data/lib/stepmod/utils/converters/dd.rb +2 -2
- data/lib/stepmod/utils/converters/def.rb +3 -3
- data/lib/stepmod/utils/converters/definition.rb +2 -2
- data/lib/stepmod/utils/converters/description.rb +2 -2
- data/lib/stepmod/utils/converters/dl.rb +2 -2
- data/lib/stepmod/utils/converters/dt.rb +2 -2
- data/lib/stepmod/utils/converters/em.rb +3 -3
- data/lib/stepmod/utils/converters/em_express_description.rb +5 -3
- data/lib/stepmod/utils/converters/eqn.rb +3 -3
- data/lib/stepmod/utils/converters/example.rb +2 -2
- data/lib/stepmod/utils/converters/express_example.rb +0 -2
- data/lib/stepmod/utils/converters/express_figure.rb +3 -2
- data/lib/stepmod/utils/converters/express_g.rb +3 -3
- data/lib/stepmod/utils/converters/express_note.rb +2 -2
- data/lib/stepmod/utils/converters/express_ref.rb +2 -2
- data/lib/stepmod/utils/converters/express_ref_express_description.rb +3 -3
- data/lib/stepmod/utils/converters/express_table.rb +1 -2
- data/lib/stepmod/utils/converters/ext_description.rb +3 -2
- data/lib/stepmod/utils/converters/ext_descriptions.rb +3 -2
- data/lib/stepmod/utils/converters/figure.rb +10 -5
- data/lib/stepmod/utils/converters/fund_cons.rb +2 -2
- data/lib/stepmod/utils/converters/introduction.rb +2 -2
- data/lib/stepmod/utils/converters/li.rb +20 -0
- data/lib/stepmod/utils/converters/module_ref.rb +2 -2
- data/lib/stepmod/utils/converters/module_ref_express_description.rb +3 -3
- data/lib/stepmod/utils/converters/note.rb +2 -2
- data/lib/stepmod/utils/converters/ol.rb +9 -42
- data/lib/stepmod/utils/converters/pass_through.rb +1 -1
- data/lib/stepmod/utils/converters/resource.rb +2 -2
- data/lib/stepmod/utils/converters/schema.rb +2 -2
- data/lib/stepmod/utils/converters/schema_diag.rb +2 -2
- data/lib/stepmod/utils/converters/stepmod_ext_description.rb +3 -3
- data/lib/stepmod/utils/converters/strong.rb +3 -3
- data/lib/stepmod/utils/converters/sub.rb +9 -7
- data/lib/stepmod/utils/converters/sup.rb +9 -7
- data/lib/stepmod/utils/converters/synonym.rb +2 -2
- data/lib/stepmod/utils/converters/table.rb +3 -3
- data/lib/stepmod/utils/converters/term.rb +2 -2
- data/lib/stepmod/utils/converters/text.rb +3 -16
- data/lib/stepmod/utils/converters/tr.rb +17 -0
- data/lib/stepmod/utils/smrl_description_converter.rb +5 -13
- data/lib/stepmod/utils/smrl_resource_converter.rb +12 -20
- data/lib/stepmod/utils/stepmod_definition_converter.rb +19 -22
- data/lib/stepmod/utils/stepmod_file_annotator.rb +11 -11
- data/lib/stepmod/utils/term.rb +36 -14
- data/lib/stepmod/utils/terms_extractor.rb +17 -13
- data/lib/stepmod/utils/version.rb +1 -1
- data/stepmod-utils.gemspec +14 -17
- metadata +23 -75
- data/lib/stepmod/utils/converters/blockquote.rb +0 -20
- data/lib/stepmod/utils/converters/br.rb +0 -15
- data/lib/stepmod/utils/converters/bypass.rb +0 -81
- data/lib/stepmod/utils/converters/code.rb +0 -19
- data/lib/stepmod/utils/converters/drop.rb +0 -22
- data/lib/stepmod/utils/converters/head.rb +0 -23
- data/lib/stepmod/utils/converters/hr.rb +0 -15
- data/lib/stepmod/utils/converters/ignore.rb +0 -16
- data/lib/stepmod/utils/converters/p.rb +0 -21
- data/lib/stepmod/utils/converters/q.rb +0 -16
- data/lib/stepmod/utils/converters/stem.rb +0 -19
- data/lib/stepmod/utils/converters/uof.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b84fbdfaf0322f4f207043d9f7f8034a58539f33c030846c593f6c3cac8b7c8
|
4
|
+
data.tar.gz: 8689dceb2e71c4401732e5e5e1c522be9bca434de6014f2054e54ef85e3e9845
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebc46e61ce576382b898913fc348ba473e52fb23a7fb65677ac6436a93d5bfcf1a9208e64f3d25c38a0e57eac7718384589dabfebac2925deb3fb6e39ba4d529
|
7
|
+
data.tar.gz: d075afeb2933647f9b6fc2fe32a32f2dcf49f4a7dc0ed12fa750f4ae4f02aac115a5e08581bacd68869a14c3c02fc3a4c794e0676bd6dc2dae02411398fd385c
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
@@ -5,7 +5,10 @@ source "https://rubygems.org"
|
|
5
5
|
gemspec
|
6
6
|
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
7
7
|
|
8
|
-
gem "concurrent-ruby"
|
8
|
+
gem "concurrent-ruby"
|
9
9
|
gem "pry"
|
10
|
-
gem "rake"
|
11
|
-
gem "rspec"
|
10
|
+
gem "rake"
|
11
|
+
gem "rspec"
|
12
|
+
gem "rubocop"
|
13
|
+
gem "rubocop-performance"
|
14
|
+
gem "rubocop-rails"
|
@@ -11,7 +11,7 @@ $:.unshift File.expand_path("../../lib", bin_file)
|
|
11
11
|
require "bundler/setup"
|
12
12
|
require "stepmod/utils/smrl_description_converter"
|
13
13
|
|
14
|
-
|
14
|
+
Coradoc::Input::Html.config.unknown_tags = :bypass
|
15
15
|
|
16
16
|
input_content = ARGF.read
|
17
17
|
|
@@ -11,7 +11,7 @@ $:.unshift File.expand_path("../../lib", bin_file)
|
|
11
11
|
require "bundler/setup"
|
12
12
|
require "stepmod/utils/smrl_resource_converter"
|
13
13
|
|
14
|
-
|
14
|
+
Coradoc::Input::Html.config.unknown_tags = :bypass
|
15
15
|
|
16
16
|
input_content = ARGF.read
|
17
17
|
|
@@ -1,13 +1,42 @@
|
|
1
|
-
require "
|
1
|
+
require "coradoc/input/html/cleaner"
|
2
2
|
|
3
3
|
module Stepmod
|
4
4
|
module Utils
|
5
|
-
class Cleaner <
|
5
|
+
class Cleaner < Coradoc::Input::Html::Cleaner
|
6
6
|
def tidy(string)
|
7
7
|
super
|
8
8
|
.gsub(/^ +/, "")
|
9
9
|
.gsub(/\*\s([,.])/, '*\1') # remove space between * and comma or dot.
|
10
10
|
end
|
11
|
+
|
12
|
+
# Find non-asterisk content that is enclosed by two or
|
13
|
+
# more asterisks. Ensure that only one whitespace occurs
|
14
|
+
# in the border area.
|
15
|
+
# Same for underscores and brackets.
|
16
|
+
def clean_tag_borders(string)
|
17
|
+
patterns = {
|
18
|
+
/\s?\*{2,}.*?\*{2,}\s?/ => "**",
|
19
|
+
/\s?_{2,}.*?_{2,}\s?/ => "__",
|
20
|
+
/\s?~{2,}.*?~{2,}\s?/ => "~~",
|
21
|
+
}
|
22
|
+
|
23
|
+
result = string.dup
|
24
|
+
patterns.each do |pattern, value|
|
25
|
+
result = result.gsub(pattern) do |match|
|
26
|
+
preserve_border_whitespaces(match,
|
27
|
+
default_border: Coradoc::Input::Html.config.tag_border) do
|
28
|
+
match.strip.sub(" #{value}", value).sub("#{value} ", value)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
result = result.gsub(/\s?\[.*?\]\s?/) do |match|
|
34
|
+
preserve_border_whitespaces(match) do
|
35
|
+
match.strip.sub("[ ", "[").sub(" ]", "[")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
result
|
39
|
+
end
|
11
40
|
end
|
12
41
|
end
|
13
42
|
end
|
@@ -3,16 +3,17 @@ require "glossarist"
|
|
3
3
|
module Stepmod
|
4
4
|
module Utils
|
5
5
|
class Concept < Glossarist::LocalizedConcept
|
6
|
-
|
6
|
+
CUSTOM_ATTRIBUTES = %w(
|
7
7
|
reference_clause
|
8
8
|
reference_anchor
|
9
9
|
converted_definition
|
10
10
|
file_path
|
11
11
|
schema
|
12
12
|
part
|
13
|
-
domain
|
14
13
|
document
|
15
|
-
)
|
14
|
+
).freeze
|
15
|
+
|
16
|
+
attr_accessor(*CUSTOM_ATTRIBUTES)
|
16
17
|
|
17
18
|
# TODO: converted_definition is not supposed to be an attribute, it is
|
18
19
|
# supposed to be a method!
|
@@ -45,14 +46,20 @@ file_path:, language_code: "eng")
|
|
45
46
|
# TODO: `designations:` should include the `alt:[...]` terms here,
|
46
47
|
# they are now only included in definition_xml_converted_definition.
|
47
48
|
new(
|
48
|
-
|
49
|
-
|
49
|
+
data: Glossarist::ConceptData.new(
|
50
|
+
{
|
51
|
+
terms: designation,
|
52
|
+
definition: [
|
53
|
+
Glossarist::DetailedDefinition.new({ content: definition }),
|
54
|
+
],
|
55
|
+
language_code: language_code,
|
56
|
+
},
|
57
|
+
),
|
50
58
|
converted_definition: converted_definition,
|
51
59
|
id: "#{reference_anchor}.#{reference_clause}",
|
52
60
|
reference_anchor: reference_anchor,
|
53
61
|
reference_clause: reference_clause,
|
54
62
|
file_path: file_path,
|
55
|
-
language_code: language_code,
|
56
63
|
)
|
57
64
|
end
|
58
65
|
|
@@ -80,7 +87,9 @@ file_path:, language_code: "eng")
|
|
80
87
|
designations << { "designation" => alt, "type" => "expression" }
|
81
88
|
end
|
82
89
|
|
83
|
-
designations
|
90
|
+
designations.map do |des|
|
91
|
+
Glossarist::Designation::Base.from_yaml(des.to_yaml)
|
92
|
+
end
|
84
93
|
end
|
85
94
|
|
86
95
|
def definition_xml_definition(definition_xml, reference_anchor)
|
@@ -106,24 +115,19 @@ file_path:, language_code: "eng")
|
|
106
115
|
end
|
107
116
|
|
108
117
|
def definition_xml_converted_definition(designation, definition)
|
109
|
-
accepted_designation = designation.select
|
110
|
-
|
111
|
-
end
|
112
|
-
|
113
|
-
alt_designations = designation.reject do |des|
|
114
|
-
des["normative_status"] == "preferred"
|
115
|
-
end
|
118
|
+
accepted_designation = designation.select(&:preferred?)
|
119
|
+
alt_designations = designation.reject(&:preferred?)
|
116
120
|
|
117
121
|
if alt_designations.length.positive?
|
118
122
|
alt_designations_text = alt_designations.map do |d|
|
119
|
-
d
|
123
|
+
d.designation.strip
|
120
124
|
end.join(",")
|
121
125
|
|
122
126
|
alt_notation = "alt:[#{alt_designations_text}]"
|
123
127
|
end
|
124
128
|
|
125
129
|
result = <<~TEXT
|
126
|
-
=== #{accepted_designation.map { |d| d
|
130
|
+
=== #{accepted_designation.map { |d| d.designation.strip }.join(',')}
|
127
131
|
TEXT
|
128
132
|
|
129
133
|
if alt_notation
|
@@ -140,6 +144,14 @@ file_path:, language_code: "eng")
|
|
140
144
|
end
|
141
145
|
end
|
142
146
|
|
147
|
+
def initialize(hash = {})
|
148
|
+
super(hash)
|
149
|
+
|
150
|
+
CUSTOM_ATTRIBUTES.each do |attr|
|
151
|
+
public_send("#{attr}=", hash[attr] || hash[attr.to_sym])
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
143
155
|
def to_h
|
144
156
|
super.merge({
|
145
157
|
"domain" => domain,
|
@@ -149,9 +161,13 @@ file_path:, language_code: "eng")
|
|
149
161
|
}.compact)
|
150
162
|
end
|
151
163
|
|
164
|
+
def domain
|
165
|
+
data.domain
|
166
|
+
end
|
167
|
+
|
152
168
|
def to_mn_adoc
|
153
169
|
<<~TEXT
|
154
|
-
// STEPmod path:#{file_path.empty? ? '' : " #{file_path}"}
|
170
|
+
// STEPmod path:#{file_path.to_s.empty? ? '' : " #{file_path}"}
|
155
171
|
#{converted_definition}
|
156
172
|
|
157
173
|
[.source]
|
@@ -4,7 +4,7 @@ module Stepmod
|
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
6
|
class A < Stepmod::Utils::Converters::Base
|
7
|
-
def
|
7
|
+
def to_coradoc(node, state = {})
|
8
8
|
name = treat_children(node, state)
|
9
9
|
href = node["href"]
|
10
10
|
title = extract_title(node)
|
@@ -41,7 +41,7 @@ module Stepmod
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
|
44
|
+
Coradoc::Input::Html::Converters.register :a, A.new
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
@@ -4,7 +4,7 @@ module Stepmod
|
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
6
|
class Arm < Stepmod::Utils::Converters::Base
|
7
|
-
def
|
7
|
+
def to_coradoc(node, state = {})
|
8
8
|
treat_children(node, state)
|
9
9
|
end
|
10
10
|
|
@@ -16,7 +16,7 @@ module Stepmod
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
Coradoc::Input::Html::Converters.register :arm, Arm.new
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -1,30 +1,10 @@
|
|
1
|
-
require "
|
1
|
+
require "coradoc"
|
2
|
+
require "coradoc/input/html"
|
2
3
|
|
3
4
|
module Stepmod
|
4
5
|
module Utils
|
5
6
|
module Converters
|
6
|
-
class 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
|
7
|
+
class Base < Coradoc::Input::Html::Converters::Base
|
28
8
|
end
|
29
9
|
end
|
30
10
|
end
|
@@ -4,7 +4,7 @@ module Stepmod
|
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
6
|
class ClauseRef < Stepmod::Utils::Converters::Base
|
7
|
-
def
|
7
|
+
def to_coradoc(node, _state = {})
|
8
8
|
" {{#{normalized_ref(node['linkend'])}}} "
|
9
9
|
end
|
10
10
|
|
@@ -16,7 +16,7 @@ module Stepmod
|
|
16
16
|
ref.to_s.split(":").last.squeeze(" ").strip
|
17
17
|
end
|
18
18
|
end
|
19
|
-
|
19
|
+
Coradoc::Input::Html::Converters.register :clause_ref, ClauseRef.new
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -4,7 +4,7 @@ module Stepmod
|
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
6
|
class Comment < Stepmod::Utils::Converters::Base
|
7
|
-
def
|
7
|
+
def to_coradoc(node, _state = {})
|
8
8
|
comment = node.text.strip.split("\n").map do |line|
|
9
9
|
"\n// #{line}"
|
10
10
|
end.join("\n")
|
@@ -12,7 +12,7 @@ module Stepmod
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
|
15
|
+
Coradoc::Input::Html::Converters.register :comment, Comment.new
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -4,11 +4,11 @@ module Stepmod
|
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
6
|
class Dd < Stepmod::Utils::Converters::Base
|
7
|
-
def
|
7
|
+
def to_coradoc(node, _state = {})
|
8
8
|
"#{node.text}\n"
|
9
9
|
end
|
10
10
|
|
11
|
-
|
11
|
+
Coradoc::Input::Html::Converters.register :dd, Dd.new
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -2,7 +2,7 @@ module Stepmod
|
|
2
2
|
module Utils
|
3
3
|
module Converters
|
4
4
|
class Def < Stepmod::Utils::Converters::Base
|
5
|
-
def
|
5
|
+
def to_coradoc(node, state = {})
|
6
6
|
node = node.dup
|
7
7
|
"#{additional_block(node)}#{treat_children(node, state)}"
|
8
8
|
end
|
@@ -78,8 +78,8 @@ module Stepmod
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
|
82
|
-
|
81
|
+
Coradoc::Input::Html::Converters.register :def, Def.new
|
82
|
+
Coradoc::Input::Html::Converters.register :description, Def.new
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
@@ -4,7 +4,7 @@ module Stepmod
|
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
6
|
class Definition < Stepmod::Utils::Converters::Base
|
7
|
-
def
|
7
|
+
def to_coradoc(node, state = {})
|
8
8
|
treat_children(node, state)
|
9
9
|
end
|
10
10
|
|
@@ -16,7 +16,7 @@ module Stepmod
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
Coradoc::Input::Html::Converters.register :definition, Definition.new
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -4,7 +4,7 @@ module Stepmod
|
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
6
|
class Description < Stepmod::Utils::Converters::Base
|
7
|
-
def
|
7
|
+
def to_coradoc(node, state = {})
|
8
8
|
treat_children(node, state)
|
9
9
|
end
|
10
10
|
|
@@ -16,7 +16,7 @@ module Stepmod
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
Coradoc::Input::Html::Converters.register :description, Description.new
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -4,7 +4,7 @@ module Stepmod
|
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
6
|
class Dl < Stepmod::Utils::Converters::Base
|
7
|
-
def
|
7
|
+
def to_coradoc(node, state = {})
|
8
8
|
cleaned_node = cleanup_trash_tags(node.clone)
|
9
9
|
treat_children(cleaned_node, state)
|
10
10
|
end
|
@@ -24,7 +24,7 @@ module Stepmod
|
|
24
24
|
node
|
25
25
|
end
|
26
26
|
|
27
|
-
|
27
|
+
Coradoc::Input::Html::Converters.register :dl, Dl.new
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -4,13 +4,13 @@ module Stepmod
|
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
6
|
class Dt < Stepmod::Utils::Converters::Base
|
7
|
-
def
|
7
|
+
def to_coradoc(node, _state = {})
|
8
8
|
return "\n\n{blank}::" if node.text.strip.empty?
|
9
9
|
|
10
10
|
"\n\n#{node.text}:: "
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
Coradoc::Input::Html::Converters.register :dt, Dt.new
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -4,7 +4,7 @@ module Stepmod
|
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
6
|
class Em < Stepmod::Utils::Converters::Base
|
7
|
-
def
|
7
|
+
def to_coradoc(node, state = {})
|
8
8
|
content = treat_children(node, state.merge(already_italic: true))
|
9
9
|
if content.strip.empty? || state[:already_italic]
|
10
10
|
content
|
@@ -14,8 +14,8 @@ module Stepmod
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
Coradoc::Input::Html::Converters.register :em, Em.new
|
18
|
+
Coradoc::Input::Html::Converters.register :cite, Em.new
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -8,6 +8,10 @@ module Stepmod
|
|
8
8
|
italic_converted(node, state)
|
9
9
|
end
|
10
10
|
|
11
|
+
def to_coradoc(node, state = {})
|
12
|
+
italic_converted(node, state)
|
13
|
+
end
|
14
|
+
|
11
15
|
private
|
12
16
|
|
13
17
|
def italic_converted(node, state)
|
@@ -44,9 +48,7 @@ module Stepmod
|
|
44
48
|
end
|
45
49
|
end
|
46
50
|
|
47
|
-
|
48
|
-
ReverseAdoc::Converters.register :i, Em.new
|
49
|
-
ReverseAdoc::Converters.register :cite, Em.new
|
51
|
+
Coradoc::Input::Html::Converters.register :i, Em.new
|
50
52
|
end
|
51
53
|
end
|
52
54
|
end
|
@@ -9,7 +9,7 @@ module Stepmod
|
|
9
9
|
class Eqn < Stepmod::Utils::Converters::Base
|
10
10
|
TAGS_NOT_IN_CONTEXT = %w[b i].freeze
|
11
11
|
|
12
|
-
def
|
12
|
+
def to_coradoc(node, state = {})
|
13
13
|
cloned_node = node.clone
|
14
14
|
if definition_node?(cloned_node)
|
15
15
|
return definition_converted(cloned_node, state)
|
@@ -123,8 +123,8 @@ module Stepmod
|
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
126
|
-
|
127
|
-
|
126
|
+
Coradoc::Input::Html::Converters.register :eqn, Eqn.new
|
127
|
+
Coradoc::Input::Html::Converters.register :bigeqn, Eqn.new
|
128
128
|
end
|
129
129
|
end
|
130
130
|
end
|
@@ -4,7 +4,7 @@ module Stepmod
|
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
6
|
class Example < Stepmod::Utils::Converters::Base
|
7
|
-
def
|
7
|
+
def to_coradoc(node, state = {})
|
8
8
|
# If we want to skip this node
|
9
9
|
return "" if state[:no_notes_examples]
|
10
10
|
|
@@ -19,7 +19,7 @@ module Stepmod
|
|
19
19
|
TEMPLATE
|
20
20
|
end
|
21
21
|
end
|
22
|
-
|
22
|
+
Coradoc::Input::Html::Converters.register :example, Example.new
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -10,7 +10,7 @@ module Stepmod
|
|
10
10
|
# "figure-exp-#{id}"
|
11
11
|
# end
|
12
12
|
|
13
|
-
def
|
13
|
+
def to_coradoc(node, state = {})
|
14
14
|
<<~TEMPLATE
|
15
15
|
(*"#{state[:schema_and_entity]}.__figure"
|
16
16
|
#{super(node, state.merge(no_notes_examples: nil)).strip}
|
@@ -19,7 +19,8 @@ module Stepmod
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
|
22
|
+
Coradoc::Input::Html::Converters.register :express_figure,
|
23
|
+
ExpressFigure.new
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
@@ -4,7 +4,7 @@ module Stepmod
|
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
6
|
class ExpressG < Stepmod::Utils::Converters::Base
|
7
|
-
def
|
7
|
+
def to_coradoc(node, state = {})
|
8
8
|
node.children.map do |child|
|
9
9
|
next unless child.name == "imgfile"
|
10
10
|
|
@@ -29,7 +29,7 @@ module Stepmod
|
|
29
29
|
====
|
30
30
|
image::#{svg_filename}.svg[]
|
31
31
|
|
32
|
-
#{image_document.xpath(
|
32
|
+
#{image_document.xpath('//img.area').map.with_index(1) { |n, i| schema_reference(n['href'], i) }.join("\n")}
|
33
33
|
====
|
34
34
|
SVGMAP
|
35
35
|
end
|
@@ -49,7 +49,7 @@ module Stepmod
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
|
52
|
+
Coradoc::Input::Html::Converters.register "express-g", ExpressG.new
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -4,7 +4,7 @@ module Stepmod
|
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
6
|
class ExpressNote < Stepmod::Utils::Converters::Base
|
7
|
-
def
|
7
|
+
def to_coradoc(node, state = {})
|
8
8
|
<<~TEMPLATE
|
9
9
|
|
10
10
|
(*"#{state[:schema_and_entity]}.__note"
|
@@ -14,7 +14,7 @@ module Stepmod
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
|
17
|
+
Coradoc::Input::Html::Converters.register :express_note, ExpressNote.new
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -4,11 +4,11 @@ module Stepmod
|
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
6
|
class ExpressRef < Stepmod::Utils::Converters::Base
|
7
|
-
def
|
7
|
+
def to_coradoc(node, _state = {})
|
8
8
|
" *#{node['linkend'].to_s.split('.').last}* "
|
9
9
|
end
|
10
10
|
end
|
11
|
-
|
11
|
+
Coradoc::Input::Html::Converters.register :express_ref, ExpressRef.new
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -2,13 +2,13 @@ module Stepmod
|
|
2
2
|
module Utils
|
3
3
|
module Converters
|
4
4
|
class ExpressRefExpressDescription < Stepmod::Utils::Converters::Base
|
5
|
-
def
|
5
|
+
def to_coradoc(node, _state = {})
|
6
6
|
parts = node["linkend"].to_s.split(":").last.split(".")
|
7
7
|
"<<express:#{parts.join('.').strip},#{parts.last.strip}>>"
|
8
8
|
end
|
9
9
|
end
|
10
|
-
|
11
|
-
|
10
|
+
Coradoc::Input::Html::Converters.register :express_ref,
|
11
|
+
ExpressRefExpressDescription.new
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -10,7 +10,7 @@ module Stepmod
|
|
10
10
|
# "table-exp-#{id}"
|
11
11
|
# end
|
12
12
|
|
13
|
-
def
|
13
|
+
def to_coradoc(node, state = {})
|
14
14
|
<<~TEMPLATE
|
15
15
|
(*"#{state[:schema_and_entity]}.__table"
|
16
16
|
#{super(node, state.merge(no_notes_examples: nil)).strip}
|
@@ -19,7 +19,6 @@ module Stepmod
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
ReverseAdoc::Converters.register :express_table, ExpressTable.new
|
23
22
|
end
|
24
23
|
end
|
25
24
|
end
|
@@ -2,7 +2,7 @@ module Stepmod
|
|
2
2
|
module Utils
|
3
3
|
module Converters
|
4
4
|
class ExtDescription < Stepmod::Utils::Converters::Base
|
5
|
-
def
|
5
|
+
def to_coradoc(node, state = {})
|
6
6
|
state = state.merge(schema_name: node["linkend"],
|
7
7
|
non_flanking_whitesapce: true)
|
8
8
|
child_text = treat_children(node, state).strip
|
@@ -14,7 +14,8 @@ module Stepmod
|
|
14
14
|
TEMPLATE
|
15
15
|
end
|
16
16
|
end
|
17
|
-
|
17
|
+
Coradoc::Input::Html::Converters.register :ext_description,
|
18
|
+
ExtDescription.new
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|