stepmod-utils 0.4.8 → 0.4.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/lib/stepmod/utils/converters/a.rb +10 -3
  3. data/lib/stepmod/utils/converters/arm.rb +1 -1
  4. data/lib/stepmod/utils/converters/base.rb +31 -0
  5. data/lib/stepmod/utils/converters/blockquote.rb +1 -1
  6. data/lib/stepmod/utils/converters/br.rb +1 -1
  7. data/lib/stepmod/utils/converters/bypass.rb +1 -1
  8. data/lib/stepmod/utils/converters/clause_ref.rb +1 -1
  9. data/lib/stepmod/utils/converters/code.rb +1 -1
  10. data/lib/stepmod/utils/converters/comment.rb +1 -1
  11. data/lib/stepmod/utils/converters/dd.rb +1 -1
  12. data/lib/stepmod/utils/converters/def.rb +1 -1
  13. data/lib/stepmod/utils/converters/definition.rb +1 -1
  14. data/lib/stepmod/utils/converters/description.rb +1 -1
  15. data/lib/stepmod/utils/converters/dl.rb +1 -1
  16. data/lib/stepmod/utils/converters/drop.rb +1 -1
  17. data/lib/stepmod/utils/converters/dt.rb +1 -1
  18. data/lib/stepmod/utils/converters/em.rb +1 -1
  19. data/lib/stepmod/utils/converters/em_express_description.rb +1 -1
  20. data/lib/stepmod/utils/converters/eqn.rb +1 -1
  21. data/lib/stepmod/utils/converters/example.rb +1 -1
  22. data/lib/stepmod/utils/converters/express_example.rb +1 -1
  23. data/lib/stepmod/utils/converters/express_g.rb +1 -1
  24. data/lib/stepmod/utils/converters/express_note.rb +1 -1
  25. data/lib/stepmod/utils/converters/express_ref.rb +1 -1
  26. data/lib/stepmod/utils/converters/express_ref_express_description.rb +1 -1
  27. data/lib/stepmod/utils/converters/ext_description.rb +1 -1
  28. data/lib/stepmod/utils/converters/ext_descriptions.rb +1 -1
  29. data/lib/stepmod/utils/converters/fund_cons.rb +1 -1
  30. data/lib/stepmod/utils/converters/head.rb +1 -1
  31. data/lib/stepmod/utils/converters/hr.rb +1 -1
  32. data/lib/stepmod/utils/converters/ignore.rb +1 -1
  33. data/lib/stepmod/utils/converters/introduction.rb +1 -1
  34. data/lib/stepmod/utils/converters/module_ref.rb +24 -5
  35. data/lib/stepmod/utils/converters/module_ref_express_description.rb +1 -1
  36. data/lib/stepmod/utils/converters/note.rb +1 -1
  37. data/lib/stepmod/utils/converters/ol.rb +1 -1
  38. data/lib/stepmod/utils/converters/p.rb +1 -1
  39. data/lib/stepmod/utils/converters/pass_through.rb +1 -1
  40. data/lib/stepmod/utils/converters/q.rb +1 -1
  41. data/lib/stepmod/utils/converters/resource.rb +1 -1
  42. data/lib/stepmod/utils/converters/schema.rb +1 -1
  43. data/lib/stepmod/utils/converters/schema_diag.rb +1 -1
  44. data/lib/stepmod/utils/converters/stem.rb +1 -1
  45. data/lib/stepmod/utils/converters/stepmod_ext_description.rb +1 -1
  46. data/lib/stepmod/utils/converters/strong.rb +1 -1
  47. data/lib/stepmod/utils/converters/sub.rb +1 -1
  48. data/lib/stepmod/utils/converters/sup.rb +1 -1
  49. data/lib/stepmod/utils/converters/synonym.rb +1 -1
  50. data/lib/stepmod/utils/converters/table.rb +1 -1
  51. data/lib/stepmod/utils/converters/term.rb +1 -1
  52. data/lib/stepmod/utils/converters/text.rb +2 -2
  53. data/lib/stepmod/utils/converters/uof.rb +1 -1
  54. data/lib/stepmod/utils/smrl_description_converter.rb +1 -1
  55. data/lib/stepmod/utils/smrl_resource_converter.rb +1 -1
  56. data/lib/stepmod/utils/stepmod_definition_converter.rb +1 -1
  57. data/lib/stepmod/utils/version.rb +1 -1
  58. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56af2e43aaa49e4c057e994a493a9c0d2c725814787d324e374593a153b94130
4
- data.tar.gz: 79619510b0aeed2723f8559b5279ae1eb4deaa95c39d2166313a2081d37ba681
3
+ metadata.gz: 30074f7f914399a053288da39ea9d8174da5fe9e5018fb5940a58e4d6b0c2cb1
4
+ data.tar.gz: b328f0eaf853ea85e9b25fcb4184477d01222af545f3e7fb224e20ffeab93f26
5
5
  SHA512:
6
- metadata.gz: 45c66ca593d749fc7313d27f730cfe9b652b93f2528cf8895e812334b3e26e2a390c263d086c4a0a6dbed62f3fd0b68dbe341f477625a6c469a927e750012bcc
7
- data.tar.gz: f4414a374e31493b945f1474a150e5684a3a661b72a327ebddcb8c204f28904f74446b46d87ae079993f49a44b843858c17e0cf39eaeb88aa5451e1cd61b5f7e
6
+ metadata.gz: eb61d04b4c2caa5a4e02edb84b34c2e78fa473cae5120d1d3d04f5e0feacd02c452121412a3dd8024d38033c5213b9c15e653731e766e1c3f5cc604cd2199feb
7
+ data.tar.gz: 5313c564f0f147609363f015368d5ac4176ad0653b810968fc6f3bc9e544093e53aeede2dffa74ae8cddd7ef0f5350618c9d8aced4092fdd846417b3c6aaa897
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class A < ReverseAdoc::Converters::Base
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 = "#{href}[#{name}]"
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
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Arm < ReverseAdoc::Converters::Base
6
+ class Arm < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  treat_children(node, state)
9
9
  end
@@ -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 Blockquote < ReverseAdoc::Converters::Base
6
+ class Blockquote < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  id = node["id"]
9
9
  anchor = id ? "[[#{id}]]\n" : ""
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Br < ReverseAdoc::Converters::Base
6
+ class Br < Stepmod::Utils::Converters::Base
7
7
  def convert(_node, _state = {})
8
8
  " +\n"
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Bypass < ReverseAdoc::Converters::Base
6
+ class Bypass < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  treat_children(node, state)
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class ClauseRef < ReverseAdoc::Converters::Base
6
+ class ClauseRef < Stepmod::Utils::Converters::Base
7
7
  def convert(node, _state = {})
8
8
  " {{#{normalized_ref(node['linkend'])}}} "
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Code < ReverseAdoc::Converters::Base
6
+ class Code < Stepmod::Utils::Converters::Base
7
7
  def convert(node, _state = {})
8
8
  "`#{node.text}`"
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Comment < ReverseAdoc::Converters::Base
6
+ class Comment < Stepmod::Utils::Converters::Base
7
7
  def convert(node, _state = {})
8
8
  comment = node.text.strip.split("\n").map do |line|
9
9
  "\n// #{line}"
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Dd < ReverseAdoc::Converters::Base
6
+ class Dd < Stepmod::Utils::Converters::Base
7
7
  def convert(node, _state = {})
8
8
  "#{node.text}\n"
9
9
  end
@@ -1,7 +1,7 @@
1
1
  module Stepmod
2
2
  module Utils
3
3
  module Converters
4
- class Def < ReverseAdoc::Converters::Base
4
+ class Def < Stepmod::Utils::Converters::Base
5
5
  def convert(node, state = {})
6
6
  node = node.dup
7
7
  "#{additional_block(node)}#{treat_children(node, state)}"
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Definition < ReverseAdoc::Converters::Base
6
+ class Definition < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  treat_children(node, state)
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Description < ReverseAdoc::Converters::Base
6
+ class Description < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  treat_children(node, state)
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Dl < ReverseAdoc::Converters::Base
6
+ class Dl < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  cleaned_node = cleanup_trash_tags(node.clone)
9
9
  treat_children(cleaned_node, state)
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Drop < ReverseAdoc::Converters::Base
6
+ class Drop < Stepmod::Utils::Converters::Base
7
7
  def convert(_node, _state = {})
8
8
  ""
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Dt < ReverseAdoc::Converters::Base
6
+ class Dt < Stepmod::Utils::Converters::Base
7
7
  def convert(node, _state = {})
8
8
  return "\n\n{blank}::" if node.text.strip.length.zero?
9
9
 
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Em < ReverseAdoc::Converters::Base
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]
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Em < ReverseAdoc::Converters::Base
6
+ class Em < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  italic_converted(node, state)
9
9
  end
@@ -5,7 +5,7 @@ require "stepmod/utils/html_to_asciimath"
5
5
  module Stepmod
6
6
  module Utils
7
7
  module Converters
8
- class Eqn < ReverseAdoc::Converters::Base
8
+ class Eqn < Stepmod::Utils::Converters::Base
9
9
  TAGS_NOT_IN_CONTEXT = %w[b i].freeze
10
10
 
11
11
  def convert(node, state = {})
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Example < ReverseAdoc::Converters::Base
6
+ class Example < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  # If we want to skip this node
9
9
  return "" if state[:no_notes_examples]
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class ExpressExample < ReverseAdoc::Converters::Base
6
+ class ExpressExample < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  <<~TEMPLATE
9
9
  (*"#{state[:schema_and_entity]}.__example"
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class ExpressG < ReverseAdoc::Converters::Base
6
+ class ExpressG < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  node.children.map do |child|
9
9
  next unless child.name == "imgfile"
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class ExpressNote < ReverseAdoc::Converters::Base
6
+ class ExpressNote < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  <<~TEMPLATE
9
9
 
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class ExpressRef < ReverseAdoc::Converters::Base
6
+ class ExpressRef < Stepmod::Utils::Converters::Base
7
7
  def convert(node, _state = {})
8
8
  " *#{node['linkend'].to_s.split('.').last}* "
9
9
  end
@@ -1,7 +1,7 @@
1
1
  module Stepmod
2
2
  module Utils
3
3
  module Converters
4
- class ExpressRefExpressDescription < ReverseAdoc::Converters::Base
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 < ReverseAdoc::Converters::Base
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 ExtDescriptions < ReverseAdoc::Converters::Base
6
+ class ExtDescriptions < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  treat_children(node, state)
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class FundCons < ReverseAdoc::Converters::Base
6
+ class FundCons < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  <<~TEXT
9
9
 
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Head < ReverseAdoc::Converters::Base
6
+ class Head < Stepmod::Utils::Converters::Base
7
7
  def convert(node, _state = {})
8
8
  title = extract_title(node)
9
9
  "= #{title}\n:stem:\n\n"
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Hr < ReverseAdoc::Converters::Base
6
+ class Hr < Stepmod::Utils::Converters::Base
7
7
  def convert(_node, _state = {})
8
8
  "\n* * *\n"
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Ignore < ReverseAdoc::Converters::Base
6
+ class Ignore < Stepmod::Utils::Converters::Base
7
7
  def convert(_node, _state = {})
8
8
  "" # noop
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Introduction < ReverseAdoc::Converters::Base
6
+ class Introduction < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  treat_children(node, state)
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class ModuleRef < ReverseAdoc::Converters::Base
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,Figure 1>>
52
- "<<#{Figure.pattern(_state,ref_id)},#{text}>>"
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,Table 1>>
58
- "<<#{Table.pattern(_state,ref_id)},#{text}>>"
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 < ReverseAdoc::Converters::Base
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 Note < ReverseAdoc::Converters::Base
6
+ class Note < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  # If we want to skip this node
9
9
  return "" if state[:no_notes_examples]
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Ol < ReverseAdoc::Converters::Base
6
+ class Ol < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  id = node["id"]
9
9
  anchor = id ? "[[#{id}]]\n" : ""
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class P < ReverseAdoc::Converters::Base
6
+ class P < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  id = node["id"]
9
9
  anchor = id ? "[[#{id}]]\n" : ""
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class PassThrough < ReverseAdoc::Converters::Base
6
+ class PassThrough < Stepmod::Utils::Converters::Base
7
7
  def convert(node, _state = {})
8
8
  node.to_s
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Q < ReverseAdoc::Converters::Base
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*$/]}"
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Resource < ReverseAdoc::Converters::Base
6
+ class Resource < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  treat_children(node, state)
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Schema < ReverseAdoc::Converters::Base
6
+ class Schema < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  state = state.merge(schema_name: node["name"])
9
9
  <<~TEMPLATE
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class SchemaDiag < ReverseAdoc::Converters::Base
6
+ class SchemaDiag < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  treat_children(node, state).strip
9
9
  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 < ReverseAdoc::Converters::Base
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 < ReverseAdoc::Converters::Base
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(".")
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Strong < ReverseAdoc::Converters::Base
6
+ class Strong < Stepmod::Utils::Converters::Base
7
7
  BLANK_CHARS = "{blank}"
8
8
 
9
9
  def convert(node, state = {})
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Sub < ReverseAdoc::Converters::Base
6
+ class Sub < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  content = treat_children(node, state)
9
9
  return stem_notation(content) if state[:equation]
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Sup < ReverseAdoc::Converters::Base
6
+ class Sup < Stepmod::Utils::Converters::Base
7
7
  def convert(node, state = {})
8
8
  content = treat_children(node, state)
9
9
  return stem_notation(content) if state[:equation]
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Synonym < ReverseAdoc::Converters::Base
6
+ class Synonym < Stepmod::Utils::Converters::Base
7
7
  def convert(node, _state = {})
8
8
  "alt:[#{node.text.strip}]"
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Stepmod
4
4
  module Utils
5
5
  module Converters
6
- class Table < ReverseAdoc::Converters::Base
6
+ class Table < Stepmod::Utils::Converters::Base
7
7
 
8
8
  def self.pattern(state, id)
9
9
  if state[:schema_and_entity].nil?
@@ -7,7 +7,7 @@ require "glossarist"
7
7
  module Stepmod
8
8
  module Utils
9
9
  module Converters
10
- class Term < ReverseAdoc::Converters::Base
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 < ReverseAdoc::Converters::Base
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 == " " # Regular whitespace text node
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 < ReverseAdoc::Converters::Base
8
+ class Uof < Stepmod::Utils::Converters::Base
9
9
  def convert(_node, _state = {})
10
10
  # WARNING: <uof> tag content is deprecated
11
11
  ""
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "reverse_adoc"
3
+ require "stepmod/utils/converters/base"
4
4
  require "stepmod/utils/converters/a"
5
5
  require "stepmod/utils/converters/blockquote"
6
6
  require "stepmod/utils/converters/br"
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "reverse_adoc"
3
+ require "stepmod/utils/converters/base"
4
4
  require "reverse_adoc/converters/bypass"
5
5
  require "reverse_adoc/converters/pass_through"
6
6
  require "stepmod/utils/converters/a"
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "reverse_adoc"
3
+ require "stepmod/utils/converters/base"
4
4
  require "stepmod/utils/converters/arm"
5
5
  require "stepmod/utils/converters/clause_ref"
6
6
  require "stepmod/utils/converters/express_ref"
@@ -1,5 +1,5 @@
1
1
  module Stepmod
2
2
  module Utils
3
- VERSION = "0.4.8".freeze
3
+ VERSION = "0.4.9".freeze
4
4
  end
5
5
  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.8
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-18 00:00:00.000000000 Z
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