stepmod-utils 0.4.14 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +4 -3
  3. data/exe/stepmod-annotate-all +42 -5
  4. data/exe/stepmod-convert-express-description +4 -6
  5. data/exe/stepmod-convert-express-resource +4 -6
  6. data/exe/stepmod-extract-concepts +5 -4
  7. data/exe/stepmod-srl-migrate +21 -22
  8. data/exe/stepmod-validate-express +13 -15
  9. data/lib/stepmod/utils/change.rb +33 -5
  10. data/lib/stepmod/utils/change_collection.rb +1 -1
  11. data/lib/stepmod/utils/changes_extractor.rb +23 -3
  12. data/lib/stepmod/utils/concept.rb +12 -10
  13. data/lib/stepmod/utils/converters/blockquote.rb +0 -2
  14. data/lib/stepmod/utils/converters/def.rb +4 -4
  15. data/lib/stepmod/utils/converters/dt.rb +1 -1
  16. data/lib/stepmod/utils/converters/em_express_description.rb +8 -7
  17. data/lib/stepmod/utils/converters/eqn.rb +8 -6
  18. data/lib/stepmod/utils/converters/express_figure.rb +1 -1
  19. data/lib/stepmod/utils/converters/express_g.rb +1 -1
  20. data/lib/stepmod/utils/converters/express_table.rb +1 -1
  21. data/lib/stepmod/utils/converters/ext_description.rb +2 -1
  22. data/lib/stepmod/utils/converters/figure.rb +5 -5
  23. data/lib/stepmod/utils/converters/module_ref.rb +3 -5
  24. data/lib/stepmod/utils/converters/module_ref_express_description.rb +3 -7
  25. data/lib/stepmod/utils/converters/ol.rb +7 -7
  26. data/lib/stepmod/utils/converters/stepmod_ext_description.rb +3 -3
  27. data/lib/stepmod/utils/converters/strong.rb +12 -11
  28. data/lib/stepmod/utils/converters/term.rb +0 -1
  29. data/lib/stepmod/utils/express_bibdata.rb +6 -2
  30. data/lib/stepmod/utils/html_to_asciimath.rb +80 -80
  31. data/lib/stepmod/utils/parsers/mapping_table_parser.rb +31 -0
  32. data/lib/stepmod/utils/parsers/models/a.rb +40 -0
  33. data/lib/stepmod/utils/parsers/models/aa.rb +53 -0
  34. data/lib/stepmod/utils/parsers/models/ae.rb +54 -0
  35. data/lib/stepmod/utils/parsers/models/aimelt.rb +21 -0
  36. data/lib/stepmod/utils/parsers/models/alt.rb +19 -0
  37. data/lib/stepmod/utils/parsers/models/alt_map.rb +46 -0
  38. data/lib/stepmod/utils/parsers/models/alt_scmap.rb +34 -0
  39. data/lib/stepmod/utils/parsers/models/b.rb +58 -0
  40. data/lib/stepmod/utils/parsers/models/bigeqn.rb +55 -0
  41. data/lib/stepmod/utils/parsers/models/bold.rb +52 -0
  42. data/lib/stepmod/utils/parsers/models/bom_ref.rb +21 -0
  43. data/lib/stepmod/utils/parsers/models/constraint.rb +19 -0
  44. data/lib/stepmod/utils/parsers/models/dd.rb +86 -0
  45. data/lib/stepmod/utils/parsers/models/description.rb +86 -0
  46. data/lib/stepmod/utils/parsers/models/dl.rb +24 -0
  47. data/lib/stepmod/utils/parsers/models/dt.rb +86 -0
  48. data/lib/stepmod/utils/parsers/models/eqn.rb +57 -0
  49. data/lib/stepmod/utils/parsers/models/example.rb +84 -0
  50. data/lib/stepmod/utils/parsers/models/express_extref.rb +21 -0
  51. data/lib/stepmod/utils/parsers/models/express_ref.rb +21 -0
  52. data/lib/stepmod/utils/parsers/models/figure.rb +30 -0
  53. data/lib/stepmod/utils/parsers/models/i.rb +52 -0
  54. data/lib/stepmod/utils/parsers/models/img.rb +25 -0
  55. data/lib/stepmod/utils/parsers/models/imgarea.rb +23 -0
  56. data/lib/stepmod/utils/parsers/models/li.rb +86 -0
  57. data/lib/stepmod/utils/parsers/models/mapping_table.rb +26 -0
  58. data/lib/stepmod/utils/parsers/models/module_ref.rb +21 -0
  59. data/lib/stepmod/utils/parsers/models/note.rb +84 -0
  60. data/lib/stepmod/utils/parsers/models/ol.rb +25 -0
  61. data/lib/stepmod/utils/parsers/models/p.rb +56 -0
  62. data/lib/stepmod/utils/parsers/models/refpath.rb +23 -0
  63. data/lib/stepmod/utils/parsers/models/refpath_extend.rb +23 -0
  64. data/lib/stepmod/utils/parsers/models/rules.rb +19 -0
  65. data/lib/stepmod/utils/parsers/models/sc.rb +36 -0
  66. data/lib/stepmod/utils/parsers/models/screen.rb +55 -0
  67. data/lib/stepmod/utils/parsers/models/source.rb +21 -0
  68. data/lib/stepmod/utils/parsers/models/sub.rb +52 -0
  69. data/lib/stepmod/utils/parsers/models/sup.rb +52 -0
  70. data/lib/stepmod/utils/parsers/models/table.rb +29 -0
  71. data/lib/stepmod/utils/parsers/models/td.rb +98 -0
  72. data/lib/stepmod/utils/parsers/models/th.rb +98 -0
  73. data/lib/stepmod/utils/parsers/models/title.rb +53 -0
  74. data/lib/stepmod/utils/parsers/models/tr.rb +26 -0
  75. data/lib/stepmod/utils/parsers/models/tt.rb +68 -0
  76. data/lib/stepmod/utils/parsers/models/ul.rb +21 -0
  77. data/lib/stepmod/utils/parsers/models.rb +0 -0
  78. data/lib/stepmod/utils/parsers/types/string_without_indent.rb +17 -0
  79. data/lib/stepmod/utils/parsers.rb +4 -0
  80. data/lib/stepmod/utils/smrl_description_converter.rb +2 -1
  81. data/lib/stepmod/utils/smrl_resource_converter.rb +2 -1
  82. data/lib/stepmod/utils/stepmod_file_annotator.rb +14 -7
  83. data/lib/stepmod/utils/term.rb +1 -1
  84. data/lib/stepmod/utils/terms_extractor.rb +33 -31
  85. data/lib/stepmod/utils/version.rb +1 -1
  86. data/stepmod-utils.gemspec +4 -3
  87. metadata +76 -13
@@ -26,8 +26,8 @@ module Stepmod
26
26
 
27
27
  def definition_node?(node)
28
28
  first_strong_node = node
29
- .children
30
- .find do |n|
29
+ .children
30
+ .find do |n|
31
31
  return false if !n.text? && n.name != "b"
32
32
 
33
33
  n.name == "b"
@@ -39,8 +39,8 @@ module Stepmod
39
39
 
40
40
  def definition_converted(cloned_node, state)
41
41
  first_strong_node = cloned_node
42
- .children
43
- .find do |n|
42
+ .children
43
+ .find do |n|
44
44
  return false if !n.text? && n.name != "b"
45
45
 
46
46
  n.name == "b"
@@ -56,7 +56,8 @@ module Stepmod
56
56
 
57
57
  def stem_converted(cloned_node, state)
58
58
  remove_tags_not_in_context(cloned_node) unless state[:convert_bold_and_italics]
59
- internal_content = treat_children(cloned_node, state.merge(equation: true))
59
+ internal_content = treat_children(cloned_node,
60
+ state.merge(equation: true))
60
61
  content = Stepmod::Utils::HtmlToAsciimath.new.call(internal_content)
61
62
  res = <<~TEMPLATE
62
63
  #{source_type_comment(cloned_node)}
@@ -107,7 +108,8 @@ module Stepmod
107
108
  end
108
109
 
109
110
  def log_equation(node, state, equation_converted)
110
- equation_converted_with_bold_and_italics = stem_converted(node.clone, state.merge(convert_bold_and_italics: true))
111
+ equation_converted_with_bold_and_italics = stem_converted(node.clone,
112
+ state.merge(convert_bold_and_italics: true))
111
113
 
112
114
  return if equation_converted_with_bold_and_italics == equation_converted
113
115
 
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative "./figure"
3
4
 
4
5
  module Stepmod
5
6
  module Utils
6
7
  module Converters
7
8
  class ExpressFigure < Stepmod::Utils::Converters::Figure
8
-
9
9
  # def self.pattern(state, id)
10
10
  # "figure-exp-#{id}"
11
11
  # end
@@ -19,7 +19,7 @@ module Stepmod
19
19
 
20
20
  image_document = Nokogiri::XML(File.read(file))
21
21
  svg_filename = File.basename(image_document.xpath("//img").first["src"],
22
- ".*")
22
+ ".*")
23
23
  <<~SVGMAP
24
24
 
25
25
  *)
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative "./table"
3
4
 
4
5
  module Stepmod
5
6
  module Utils
6
7
  module Converters
7
8
  class ExpressTable < Stepmod::Utils::Converters::Table
8
-
9
9
  # def self.pattern(id)
10
10
  # "table-exp-#{id}"
11
11
  # end
@@ -3,7 +3,8 @@ module Stepmod
3
3
  module Converters
4
4
  class ExtDescription < Stepmod::Utils::Converters::Base
5
5
  def convert(node, state = {})
6
- state = state.merge(schema_name: node["linkend"], non_flanking_whitesapce: true)
6
+ state = state.merge(schema_name: node["linkend"],
7
+ non_flanking_whitesapce: true)
7
8
  child_text = treat_children(node, state).strip
8
9
 
9
10
  <<~TEMPLATE
@@ -20,11 +20,11 @@ module Stepmod
20
20
  return "" if state[:no_notes_examples]
21
21
 
22
22
  # Set ID to "figure-id" in case of conflicts
23
- node['id'] = if node['id']
24
- self.class.pattern(state, node['id'])
25
- else
26
- self.class.pattern(state, node['number'])
27
- end
23
+ node["id"] = if node["id"]
24
+ self.class.pattern(state, node["id"])
25
+ else
26
+ self.class.pattern(state, node["number"])
27
+ end
28
28
 
29
29
  super(node, state)
30
30
  end
@@ -7,7 +7,6 @@ module Stepmod
7
7
  def convert(node, _state = {})
8
8
  link_end = node["linkend"].to_s.split(":")
9
9
  ref_id = link_end.last
10
- parts = link_end.last.split(".")
11
10
  text = node.text.gsub(/\s/, " ").squeeze(" ").strip
12
11
  schema = link_end.first
13
12
 
@@ -16,7 +15,7 @@ module Stepmod
16
15
  _state[:schema_and_entity] = schema
17
16
  end
18
17
 
19
- result = case link_end[1]
18
+ case link_end[1]
20
19
  when "1_scope", "introduction"
21
20
  # When we see this:
22
21
  # <module_ref linkend="functional_usage_view:1_scope">Functional usage view</module_ref>
@@ -66,12 +65,11 @@ module Stepmod
66
65
  create_ref(Table.pattern(_state, ref_id), text)
67
66
  end
68
67
  else
69
- puts "[module_ref]: encountered unknown <module_ref> tag, #{link_end.join(":")}"
70
- raise StandardError.new("[module_ref]: encountered unknown <module_ref> tag, #{link_end.join(":")}")
68
+ puts "[module_ref]: encountered unknown <module_ref> tag, #{link_end.join(':')}"
69
+ raise StandardError.new("[module_ref]: encountered unknown <module_ref> tag, #{link_end.join(':')}")
71
70
  end
72
71
 
73
72
  # puts "[module_ref] #{result}"
74
- result
75
73
  end
76
74
 
77
75
  private
@@ -1,4 +1,3 @@
1
-
2
1
  require "stepmod/utils/converters/figure"
3
2
  require "stepmod/utils/converters/table"
4
3
 
@@ -8,13 +7,11 @@ module Stepmod
8
7
  class ModuleRefExpressDescription < Stepmod::Utils::Converters::Base
9
8
  def convert(node, _state = {})
10
9
  link_end = node["linkend"].to_s.split(":")
11
- ref_id = link_end.last
12
- parts = link_end.last.split(".")
13
10
  text = node.text.gsub(/\s/, " ").squeeze(" ").strip
14
11
 
15
12
  # puts "linkend #{node["linkend"]}"
16
13
 
17
- result = case link_end[1]
14
+ case link_end[1]
18
15
  when "1_scope", "introduction"
19
16
  # When we see this:
20
17
  # <module_ref linkend="functional_usage_view:1_scope">Functional usage view</module_ref>
@@ -41,12 +38,11 @@ module Stepmod
41
38
  # ISO 10303-2 does not contain figures and tables, ignore
42
39
  ""
43
40
  else
44
- puts "[module_ref_express_description]: encountered unknown <module_ref> tag, #{link_end.join(":")}"
45
- raise StandardError.new("[module_ref_express_description]: encountered unknown <module_ref> tag, #{link_end.join(":")}")
41
+ puts "[module_ref_express_description]: encountered unknown <module_ref> tag, #{link_end.join(':')}"
42
+ raise StandardError.new("[module_ref_express_description]: encountered unknown <module_ref> tag, #{link_end.join(':')}")
46
43
  end
47
44
 
48
45
  # puts "[module_ref] #{result}"
49
- result
50
46
  end
51
47
  end
52
48
  ReverseAdoc::Converters.register :module_ref,
@@ -20,13 +20,13 @@ module Stepmod
20
20
  end
21
21
 
22
22
  def number_style(node)
23
- style = case node["style"]
24
- when "1" then "arabic"
25
- when "A" then "upperalpha"
26
- when "a" then "loweralpha"
27
- when "I" then "upperroman"
28
- when "i" then "lowerroman"
29
- end
23
+ case node["style"]
24
+ when "1" then "arabic"
25
+ when "A" then "upperalpha"
26
+ when "a" then "loweralpha"
27
+ when "I" then "upperroman"
28
+ when "i" then "lowerroman"
29
+ end
30
30
  end
31
31
 
32
32
  def ol_attrs(node)
@@ -22,8 +22,8 @@ module Stepmod
22
22
  first_child =~ /include:?\s*\Z/ ||
23
23
  first_child =~ /of:?\s*\Z/ ||
24
24
  first_child =~ /[:;]\s*\Z/
25
- ) &&
26
- child_text =~ /\n\n\*/
25
+ ) &&
26
+ child_text =~ /\n\n\*/
27
27
 
28
28
  # Only taking the first paragraph of the definition
29
29
  child_text = first_child
@@ -32,7 +32,7 @@ module Stepmod
32
32
  # TEMP: Remove any whitespace (" ", not newlines) after an immediate
33
33
  # newline due to:
34
34
  # https://github.com/metanorma/iso-10303-2/issues/71
35
- if child_text =~ /\n\ +/
35
+ if /\n\ +/.match?(child_text)
36
36
  child_text = child_text.gsub(/\n\ +/, "\n")
37
37
  end
38
38
 
@@ -15,22 +15,23 @@ module Stepmod
15
15
  def bold_converted(node, state)
16
16
  cloned_node = node.clone
17
17
  equations = extract_equations(cloned_node)
18
- content = treat_children(cloned_node, state.merge(already_strong: true))
18
+ content = treat_children(cloned_node,
19
+ state.merge(already_strong: true))
19
20
  equation_content = equations.map do |equation|
20
21
  treat(equation, state.merge(equation: true, already_strong: true))
21
22
  end
22
23
 
23
24
  content = if state[:equation] && state[:convert_bold_and_italics]
24
- "bb(#{content.strip})"
25
- elsif content.strip.empty? || state[:already_strong] || state[:equation]
26
- content
27
- else
28
- strong_tag = state[:non_flanking_whitesapce] ? '**' : '*'
29
- handle_express_escape_seq(
30
- node,
31
- "#{content[/^\s*/]}#{strong_tag}#{content.strip}#{strong_tag}#{content[/\s*$/]}"
32
- )
33
- end
25
+ "bb(#{content.strip})"
26
+ elsif content.strip.empty? || state[:already_strong] || state[:equation]
27
+ content
28
+ else
29
+ strong_tag = state[:non_flanking_whitesapce] ? "**" : "*"
30
+ handle_express_escape_seq(
31
+ node,
32
+ "#{content[/^\s*/]}#{strong_tag}#{content.strip}#{strong_tag}#{content[/\s*$/]}",
33
+ )
34
+ end
34
35
 
35
36
  [content, equation_content].compact.join("")
36
37
  end
@@ -8,7 +8,6 @@ module Stepmod
8
8
  module Utils
9
9
  module Converters
10
10
  class Term < Stepmod::Utils::Converters::Base
11
-
12
11
  # We strip all the children in the case for "stem:[d]-manifold"
13
12
  # vs "stem:[d] -manifold"
14
13
  def treat_children(node, state)
@@ -26,8 +26,12 @@ module Stepmod
26
26
  @pub_year = pubid.year&.to_i
27
27
  elsif !schema.version.nil?
28
28
  @part = schema.version.items.find { |i| i.name == "part" }.value&.to_i
29
- @version = schema.version.items.find { |i| i.name == "part" }.value&.to_i
30
- @pub_year = schema.version.items.find { |i| i.name == "part" }.value&.to_i
29
+ @version = schema.version.items.find do |i|
30
+ i.name == "part"
31
+ end.value&.to_i
32
+ @pub_year = schema.version.items.find do |i|
33
+ i.name == "part"
34
+ end.value&.to_i
31
35
  else
32
36
  raise "PublishedInfoNotFound"
33
37
  end
@@ -68,90 +68,90 @@ module Stepmod
68
68
 
69
69
  def html_entities_to_asciimath(x)
70
70
  x.gsub("&alpha;", "alpha")
71
- .gsub("&beta;", "beta")
72
- .gsub("&gamma;", "gamma")
73
- .gsub("&Gamma;", "Gamma")
74
- .gsub("&delta;", "delta")
75
- .gsub("&Delta;", "Delta")
76
- .gsub("&epsilon;", "epsilon")
77
- .gsub("&varepsilon;", "varepsilon")
78
- .gsub("&zeta;", "zeta")
79
- .gsub("&eta;", "eta")
80
- .gsub("&theta;", "theta")
81
- .gsub("&Theta;", "Theta")
82
- .gsub("&vartheta;", "vartheta")
83
- .gsub("&iota;", "iota")
84
- .gsub("&kappa;", "kappa")
85
- .gsub("&lambda;", "lambda")
86
- .gsub("&Lambda;", "Lambda")
87
- .gsub("&mu;", "mu")
88
- .gsub("&nu;", "nu")
89
- .gsub("&xi;", "xi")
90
- .gsub("&Xi;", "Xi")
91
- .gsub("&pi;", "pi")
92
- .gsub("&Pi;", "Pi")
93
- .gsub("&rho;", "rho")
94
- .gsub("&beta;", "beta")
95
- .gsub("&sigma;", "sigma")
96
- .gsub("&Sigma;", "Sigma")
97
- .gsub("&tau;", "tau")
98
- .gsub("&upsilon;", "upsilon")
99
- .gsub("&phi;", "phi")
100
- .gsub("&Phi;", "Phi")
101
- .gsub("&varphi;", "varphi")
102
- .gsub("&chi;", "chi")
103
- .gsub("&psi;", "psi")
104
- .gsub("&Psi;", "Psi")
105
- .gsub("&omega;", "omega")
106
- .gsub("&#967", "χ")
107
- .gsub("&#215", "×")
108
- .gsub("&#931", "Σ")
109
- .gsub("&#961", "ρ")
110
- .gsub("&#963", "σ")
111
- .gsub("&#955", "λ")
112
- .gsub("&#964", "τ")
113
- .gsub("&#8706", "∂")
114
- .gsub("&#8804", "≤")
115
- .gsub("&#8805", "≥")
71
+ .gsub("&beta;", "beta")
72
+ .gsub("&gamma;", "gamma")
73
+ .gsub("&Gamma;", "Gamma")
74
+ .gsub("&delta;", "delta")
75
+ .gsub("&Delta;", "Delta")
76
+ .gsub("&epsilon;", "epsilon")
77
+ .gsub("&varepsilon;", "varepsilon")
78
+ .gsub("&zeta;", "zeta")
79
+ .gsub("&eta;", "eta")
80
+ .gsub("&theta;", "theta")
81
+ .gsub("&Theta;", "Theta")
82
+ .gsub("&vartheta;", "vartheta")
83
+ .gsub("&iota;", "iota")
84
+ .gsub("&kappa;", "kappa")
85
+ .gsub("&lambda;", "lambda")
86
+ .gsub("&Lambda;", "Lambda")
87
+ .gsub("&mu;", "mu")
88
+ .gsub("&nu;", "nu")
89
+ .gsub("&xi;", "xi")
90
+ .gsub("&Xi;", "Xi")
91
+ .gsub("&pi;", "pi")
92
+ .gsub("&Pi;", "Pi")
93
+ .gsub("&rho;", "rho")
94
+ .gsub("&beta;", "beta")
95
+ .gsub("&sigma;", "sigma")
96
+ .gsub("&Sigma;", "Sigma")
97
+ .gsub("&tau;", "tau")
98
+ .gsub("&upsilon;", "upsilon")
99
+ .gsub("&phi;", "phi")
100
+ .gsub("&Phi;", "Phi")
101
+ .gsub("&varphi;", "varphi")
102
+ .gsub("&chi;", "chi")
103
+ .gsub("&psi;", "psi")
104
+ .gsub("&Psi;", "Psi")
105
+ .gsub("&omega;", "omega")
106
+ .gsub("&#967", "χ")
107
+ .gsub("&#215", "×")
108
+ .gsub("&#931", "Σ")
109
+ .gsub("&#961", "ρ")
110
+ .gsub("&#963", "σ")
111
+ .gsub("&#955", "λ")
112
+ .gsub("&#964", "τ")
113
+ .gsub("&#8706", "∂")
114
+ .gsub("&#8804", "≤")
115
+ .gsub("&#8805", "≥")
116
116
  end
117
117
 
118
118
  def html_entities_to_stem(x)
119
119
  x.gsub("&alpha;", "stem:[alpha]")
120
- .gsub("&beta;", "stem:[beta]")
121
- .gsub("&gamma;", "stem:[gamma]")
122
- .gsub("&Gamma;", "stem:[Gamma]")
123
- .gsub("&delta;", "stem:[delta]")
124
- .gsub("&Delta;", "stem:[Delta]")
125
- .gsub("&epsilon;", "stem:[epsilon]")
126
- .gsub("&varepsilon;", "stem:[varepsilon]")
127
- .gsub("&zeta;", "stem:[zeta]")
128
- .gsub("&eta;", "stem:[eta]")
129
- .gsub("&theta;", "stem:[theta]")
130
- .gsub("&Theta;", "stem:[Theta]")
131
- .gsub("&vartheta;", "stem:[vartheta]")
132
- .gsub("&iota;", "stem:[iota]")
133
- .gsub("&kappa;", "stem:[kappa]")
134
- .gsub("&lambda;", "stem:[lambda]")
135
- .gsub("&Lambda;", "stem:[Lambda]")
136
- .gsub("&mu;", "stem:[mu]")
137
- .gsub("&nu;", "stem:[nu]")
138
- .gsub("&xi;", "stem:[xi]")
139
- .gsub("&Xi;", "stem:[Xi]")
140
- .gsub("&pi;", "stem:[pi]")
141
- .gsub("&Pi;", "stem:[Pi]")
142
- .gsub("&rho;", "stem:[rho]")
143
- .gsub("&beta;", "stem:[beta]")
144
- .gsub("&sigma;", "stem:[sigma]")
145
- .gsub("&Sigma;", "stem:[Sigma]")
146
- .gsub("&tau;", "stem:[tau]")
147
- .gsub("&upsilon;", "stem:[upsilon]")
148
- .gsub("&phi;", "stem:[phi]")
149
- .gsub("&Phi;", "stem:[Phi]")
150
- .gsub("&varphi;", "stem:[varphi]")
151
- .gsub("&chi;", "stem:[chi]")
152
- .gsub("&psi;", "stem:[psi]")
153
- .gsub("&Psi;", "stem:[Psi]")
154
- .gsub("&omega;", "stem:[omega]")
120
+ .gsub("&beta;", "stem:[beta]")
121
+ .gsub("&gamma;", "stem:[gamma]")
122
+ .gsub("&Gamma;", "stem:[Gamma]")
123
+ .gsub("&delta;", "stem:[delta]")
124
+ .gsub("&Delta;", "stem:[Delta]")
125
+ .gsub("&epsilon;", "stem:[epsilon]")
126
+ .gsub("&varepsilon;", "stem:[varepsilon]")
127
+ .gsub("&zeta;", "stem:[zeta]")
128
+ .gsub("&eta;", "stem:[eta]")
129
+ .gsub("&theta;", "stem:[theta]")
130
+ .gsub("&Theta;", "stem:[Theta]")
131
+ .gsub("&vartheta;", "stem:[vartheta]")
132
+ .gsub("&iota;", "stem:[iota]")
133
+ .gsub("&kappa;", "stem:[kappa]")
134
+ .gsub("&lambda;", "stem:[lambda]")
135
+ .gsub("&Lambda;", "stem:[Lambda]")
136
+ .gsub("&mu;", "stem:[mu]")
137
+ .gsub("&nu;", "stem:[nu]")
138
+ .gsub("&xi;", "stem:[xi]")
139
+ .gsub("&Xi;", "stem:[Xi]")
140
+ .gsub("&pi;", "stem:[pi]")
141
+ .gsub("&Pi;", "stem:[Pi]")
142
+ .gsub("&rho;", "stem:[rho]")
143
+ .gsub("&beta;", "stem:[beta]")
144
+ .gsub("&sigma;", "stem:[sigma]")
145
+ .gsub("&Sigma;", "stem:[Sigma]")
146
+ .gsub("&tau;", "stem:[tau]")
147
+ .gsub("&upsilon;", "stem:[upsilon]")
148
+ .gsub("&phi;", "stem:[phi]")
149
+ .gsub("&Phi;", "stem:[Phi]")
150
+ .gsub("&varphi;", "stem:[varphi]")
151
+ .gsub("&chi;", "stem:[chi]")
152
+ .gsub("&psi;", "stem:[psi]")
153
+ .gsub("&Psi;", "stem:[Psi]")
154
+ .gsub("&omega;", "stem:[omega]")
155
155
  end
156
156
  end
157
157
  end
@@ -0,0 +1,31 @@
1
+ module Stepmod
2
+ module Utils
3
+ module Parsers
4
+ module Models
5
+ end
6
+ end
7
+ end
8
+ end
9
+
10
+ require_relative "models/mapping_table"
11
+
12
+ module Stepmod
13
+ module Utils
14
+ module Parsers
15
+ class MappingTableParser
16
+ def self.parse(node)
17
+ new(node).parse
18
+ end
19
+
20
+ def initialize(node)
21
+ @node = node
22
+ @xml = node.to_xml
23
+ end
24
+
25
+ def parse
26
+ Models::MappingTable.from_xml(@xml)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,40 @@
1
+ require "shale"
2
+
3
+ require_relative "b"
4
+ require_relative "bold"
5
+ require_relative "i"
6
+ require_relative "sub"
7
+ require_relative "sup"
8
+ require_relative "tt"
9
+
10
+ module Stepmod
11
+ module Utils
12
+ module Parsers
13
+ module Models
14
+ class A < Shale::Mapper
15
+ attribute :content, Shale::Type::String
16
+ attribute :href, Shale::Type::String
17
+ attribute :i, Italic, collection: true
18
+ attribute :b, B, collection: true
19
+ attribute :sub, Sub, collection: true
20
+ attribute :sup, Sup, collection: true
21
+ attribute :tt, Tt, collection: true
22
+ attribute :bold, Bold, collection: true
23
+
24
+ xml do
25
+ root "a"
26
+
27
+ map_content to: :content
28
+ map_attribute "href", to: :href
29
+ map_element "i", to: :i
30
+ map_element "b", to: :b
31
+ map_element "sub", to: :sub
32
+ map_element "sup", to: :sup
33
+ map_element "tt", to: :tt
34
+ map_element "bold", to: :bold
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,53 @@
1
+ require "shale"
2
+
3
+ require_relative "aimelt"
4
+ require_relative "alt"
5
+ require_relative "alt_map"
6
+ require_relative "description"
7
+ require_relative "express_ref"
8
+ require_relative "refpath"
9
+ require_relative "refpath_extend"
10
+ require_relative "rules"
11
+ require_relative "source"
12
+
13
+ module Stepmod
14
+ module Utils
15
+ module Parsers
16
+ module Models
17
+ class Aa < Shale::Mapper
18
+ attribute :attribute, Shale::Type::String
19
+ attribute :assertion_to, Shale::Type::String
20
+ attribute :inherited_from_module, Shale::Type::Value
21
+ attribute :inherited_from_entity, Shale::Type::Value
22
+ attribute :alt, Alt
23
+ attribute :description, Description
24
+ attribute :aimelt, Aimelt
25
+ attribute :source, Source
26
+ attribute :rules, Rules
27
+ attribute :express_ref, ExpressRef, collection: true
28
+ attribute :refpath, Refpath
29
+ attribute :refpath_extend, RefpathExtend
30
+ attribute :alt_map, AltMap, collection: true
31
+
32
+ xml do
33
+ root "aa"
34
+
35
+ map_attribute "attribute", to: :attribute
36
+ map_attribute "assertion_to", to: :assertion_to
37
+ map_attribute "inherited_from_module", to: :inherited_from_module
38
+ map_attribute "inherited_from_entity", to: :inherited_from_entity
39
+ map_element "alt", to: :alt
40
+ map_element "description", to: :description
41
+ map_element "aimelt", to: :aimelt
42
+ map_element "source", to: :source
43
+ map_element "rules", to: :rules
44
+ map_element "express_ref", to: :express_ref
45
+ map_element "refpath", to: :refpath
46
+ map_element "refpath_extend", to: :refpath_extend
47
+ map_element "alt_map", to: :alt_map
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,54 @@
1
+ require "shale"
2
+
3
+ require_relative "aa"
4
+ require_relative "aimelt"
5
+ require_relative "alt"
6
+ require_relative "alt_map"
7
+ require_relative "description"
8
+ require_relative "express_ref"
9
+ require_relative "refpath"
10
+ require_relative "refpath_extend"
11
+ require_relative "rules"
12
+ require_relative "source"
13
+
14
+ module Stepmod
15
+ module Utils
16
+ module Parsers
17
+ module Models
18
+ class Ae < Shale::Mapper
19
+ attribute :entity, Shale::Type::Value
20
+ attribute :extensible, Shale::Type::String
21
+ attribute :original_module, Shale::Type::Value
22
+ attribute :alt, Alt
23
+ attribute :description, Description
24
+ attribute :aimelt, Aimelt
25
+ attribute :source, Source
26
+ attribute :rules, Rules
27
+ attribute :express_ref, ExpressRef, collection: true
28
+ attribute :refpath, Refpath
29
+ attribute :refpath_extend, RefpathExtend
30
+ attribute :alt_map, AltMap, collection: true
31
+ attribute :aa, Aa, collection: true
32
+
33
+ xml do
34
+ root "ae"
35
+
36
+ map_attribute "entity", to: :entity
37
+ map_attribute "extensible", to: :extensible
38
+ map_attribute "original_module", to: :original_module
39
+ map_element "alt", to: :alt
40
+ map_element "description", to: :description
41
+ map_element "aimelt", to: :aimelt
42
+ map_element "source", to: :source
43
+ map_element "rules", to: :rules
44
+ map_element "express_ref", to: :express_ref
45
+ map_element "refpath", to: :refpath
46
+ map_element "refpath_extend", to: :refpath_extend
47
+ map_element "alt_map", to: :alt_map
48
+ map_element "aa", to: :aa
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end