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
@@ -0,0 +1,55 @@
1
+ require "shale"
2
+
3
+ require_relative "a"
4
+ require_relative "b"
5
+ require_relative "bold"
6
+ require_relative "bom_ref"
7
+ require_relative "express_extref"
8
+ require_relative "express_ref"
9
+ require_relative "i"
10
+ require_relative "module_ref"
11
+ require_relative "sub"
12
+ require_relative "sup"
13
+ require_relative "tt"
14
+
15
+ module Stepmod
16
+ module Utils
17
+ module Parsers
18
+ module Models
19
+ class Screen < Shale::Mapper
20
+ attribute :content, Shale::Type::String
21
+ attribute :xml_space, Shale::Type::String
22
+ attribute :express_ref, ExpressRef, collection: true
23
+ attribute :express_extref, ExpressExtref, collection: true
24
+ attribute :module_ref, ModuleRef, collection: true
25
+ attribute :bom_ref, BomRef, collection: true
26
+ attribute :i, Italic, collection: true
27
+ attribute :b, B, collection: true
28
+ attribute :sub, Sub, collection: true
29
+ attribute :sup, Sup, collection: true
30
+ attribute :tt, Tt, collection: true
31
+ attribute :bold, Bold, collection: true
32
+ attribute :a, A, collection: true
33
+
34
+ xml do
35
+ root "screen"
36
+
37
+ map_content to: :content
38
+ map_attribute "xml-space", to: :xml_space
39
+ map_element "express_ref", to: :express_ref
40
+ map_element "express_extref", to: :express_extref
41
+ map_element "module_ref", to: :module_ref
42
+ map_element "bom_ref", to: :bom_ref
43
+ map_element "i", to: :i
44
+ map_element "b", to: :b
45
+ map_element "sub", to: :sub
46
+ map_element "sup", to: :sup
47
+ map_element "tt", to: :tt
48
+ map_element "bold", to: :bold
49
+ map_element "a", to: :a
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,21 @@
1
+ require "shale"
2
+
3
+ module Stepmod
4
+ module Utils
5
+ module Parsers
6
+ module Models
7
+ class Source < Shale::Mapper
8
+ attribute :content, Shale::Type::String
9
+ attribute :space, Shale::Type::Value
10
+
11
+ xml do
12
+ root "source"
13
+
14
+ map_content to: :content
15
+ map_attribute "space", to: :space
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,52 @@
1
+ require "shale"
2
+
3
+ require_relative "a"
4
+ require_relative "b"
5
+ require_relative "bold"
6
+ require_relative "bom_ref"
7
+ require_relative "express_extref"
8
+ require_relative "express_ref"
9
+ require_relative "i"
10
+ require_relative "module_ref"
11
+ require_relative "sup"
12
+ require_relative "tt"
13
+
14
+ module Stepmod
15
+ module Utils
16
+ module Parsers
17
+ module Models
18
+ class Sub < Shale::Mapper
19
+ attribute :content, Shale::Type::String
20
+ attribute :express_ref, ExpressRef, collection: true
21
+ attribute :express_extref, ExpressExtref, collection: true
22
+ attribute :module_ref, ModuleRef, collection: true
23
+ attribute :bom_ref, BomRef, collection: true
24
+ attribute :i, Italic, collection: true
25
+ attribute :b, B, collection: true
26
+ attribute :sub, Sub, collection: true
27
+ attribute :sup, Sup, collection: true
28
+ attribute :tt, Tt, collection: true
29
+ attribute :bold, Bold, collection: true
30
+ attribute :a, A, collection: true
31
+
32
+ xml do
33
+ root "sub"
34
+
35
+ map_content to: :content
36
+ map_element "express_ref", to: :express_ref
37
+ map_element "express_extref", to: :express_extref
38
+ map_element "module_ref", to: :module_ref
39
+ map_element "bom_ref", to: :bom_ref
40
+ map_element "i", to: :i
41
+ map_element "b", to: :b
42
+ map_element "sub", to: :sub
43
+ map_element "sup", to: :sup
44
+ map_element "tt", to: :tt
45
+ map_element "bold", to: :bold
46
+ map_element "a", to: :a
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,52 @@
1
+ require "shale"
2
+
3
+ require_relative "a"
4
+ require_relative "b"
5
+ require_relative "bold"
6
+ require_relative "bom_ref"
7
+ require_relative "express_extref"
8
+ require_relative "express_ref"
9
+ require_relative "i"
10
+ require_relative "module_ref"
11
+ require_relative "sub"
12
+ require_relative "tt"
13
+
14
+ module Stepmod
15
+ module Utils
16
+ module Parsers
17
+ module Models
18
+ class Sup < Shale::Mapper
19
+ attribute :content, Shale::Type::String
20
+ attribute :express_ref, ExpressRef, collection: true
21
+ attribute :express_extref, ExpressExtref, collection: true
22
+ attribute :module_ref, ModuleRef, collection: true
23
+ attribute :bom_ref, BomRef, collection: true
24
+ attribute :i, Italic, collection: true
25
+ attribute :b, B, collection: true
26
+ attribute :sub, Sub, collection: true
27
+ attribute :sup, Sup, collection: true
28
+ attribute :tt, Tt, collection: true
29
+ attribute :bold, Bold, collection: true
30
+ attribute :a, A, collection: true
31
+
32
+ xml do
33
+ root "sup"
34
+
35
+ map_content to: :content
36
+ map_element "express_ref", to: :express_ref
37
+ map_element "express_extref", to: :express_extref
38
+ map_element "module_ref", to: :module_ref
39
+ map_element "bom_ref", to: :bom_ref
40
+ map_element "i", to: :i
41
+ map_element "b", to: :b
42
+ map_element "sub", to: :sub
43
+ map_element "sup", to: :sup
44
+ map_element "tt", to: :tt
45
+ map_element "bold", to: :bold
46
+ map_element "a", to: :a
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,29 @@
1
+ require "shale"
2
+
3
+ require_relative "tr"
4
+
5
+ module Stepmod
6
+ module Utils
7
+ module Parsers
8
+ module Models
9
+ class Table < Shale::Mapper
10
+ attribute :caption, Shale::Type::String
11
+ attribute :id, Shale::Type::String
12
+ attribute :number, Shale::Type::String
13
+ attribute :width, Shale::Type::String
14
+ attribute :tr, Tr, collection: true
15
+
16
+ xml do
17
+ root "table"
18
+
19
+ map_attribute "caption", to: :caption
20
+ map_attribute "id", to: :id
21
+ map_attribute "number", to: :number
22
+ map_attribute "width", to: :width
23
+ map_element "tr", to: :tr
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,98 @@
1
+ require "shale"
2
+
3
+ require_relative "a"
4
+ require_relative "b"
5
+ require_relative "bigeqn"
6
+ require_relative "bold"
7
+ require_relative "bom_ref"
8
+ require_relative "dl"
9
+ require_relative "eqn"
10
+ require_relative "example"
11
+ require_relative "express_extref"
12
+ require_relative "express_ref"
13
+ require_relative "figure"
14
+ require_relative "i"
15
+ require_relative "module_ref"
16
+ require_relative "note"
17
+ require_relative "ol"
18
+ require_relative "p"
19
+ require_relative "screen"
20
+ require_relative "sub"
21
+ require_relative "sup"
22
+ require_relative "table"
23
+ require_relative "tt"
24
+ require_relative "ul"
25
+
26
+ module Stepmod
27
+ module Utils
28
+ module Parsers
29
+ module Models
30
+ class Td < Shale::Mapper
31
+ attribute :content, Shale::Type::String
32
+ attribute :rowspan, Shale::Type::String
33
+ attribute :colspan, Shale::Type::String
34
+ attribute :align, Shale::Type::String
35
+ attribute :valign, Shale::Type::String
36
+ attribute :width, Shale::Type::String
37
+ attribute :height, Shale::Type::String
38
+ attribute :express_ref, ExpressRef, collection: true
39
+ attribute :express_extref, ExpressExtref, collection: true
40
+ attribute :module_ref, ModuleRef, collection: true
41
+ attribute :bom_ref, BomRef, collection: true
42
+ attribute :i, Italic, collection: true
43
+ attribute :b, B, collection: true
44
+ attribute :sub, Sub, collection: true
45
+ attribute :sup, Sup, collection: true
46
+ attribute :tt, Tt, collection: true
47
+ attribute :bold, Bold, collection: true
48
+ attribute :a, A, collection: true
49
+ attribute :p, P, collection: true
50
+ attribute :ul, Ul, collection: true
51
+ attribute :ol, Ol, collection: true
52
+ attribute :dl, Dl, collection: true
53
+ attribute :screen, Screen, collection: true
54
+ attribute :note, Note, collection: true
55
+ attribute :example, Example, collection: true
56
+ attribute :eqn, Eqn, collection: true
57
+ attribute :bigeqn, Bigeqn, collection: true
58
+ attribute :figure, Figure, collection: true
59
+ attribute :table, Table, collection: true
60
+
61
+ xml do
62
+ root "td"
63
+
64
+ map_content to: :content
65
+ map_attribute "rowspan", to: :rowspan
66
+ map_attribute "colspan", to: :colspan
67
+ map_attribute "align", to: :align
68
+ map_attribute "valign", to: :valign
69
+ map_attribute "width", to: :width
70
+ map_attribute "height", to: :height
71
+ map_element "express_ref", to: :express_ref
72
+ map_element "express_extref", to: :express_extref
73
+ map_element "module_ref", to: :module_ref
74
+ map_element "bom_ref", to: :bom_ref
75
+ map_element "i", to: :i
76
+ map_element "b", to: :b
77
+ map_element "sub", to: :sub
78
+ map_element "sup", to: :sup
79
+ map_element "tt", to: :tt
80
+ map_element "bold", to: :bold
81
+ map_element "a", to: :a
82
+ map_element "p", to: :p
83
+ map_element "ul", to: :ul
84
+ map_element "ol", to: :ol
85
+ map_element "dl", to: :dl
86
+ map_element "screen", to: :screen
87
+ map_element "note", to: :note
88
+ map_element "example", to: :example
89
+ map_element "eqn", to: :eqn
90
+ map_element "bigeqn", to: :bigeqn
91
+ map_element "figure", to: :figure
92
+ map_element "table", to: :table
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,98 @@
1
+ require "shale"
2
+
3
+ require_relative "a"
4
+ require_relative "b"
5
+ require_relative "bigeqn"
6
+ require_relative "bold"
7
+ require_relative "bom_ref"
8
+ require_relative "dl"
9
+ require_relative "eqn"
10
+ require_relative "example"
11
+ require_relative "express_extref"
12
+ require_relative "express_ref"
13
+ require_relative "figure"
14
+ require_relative "i"
15
+ require_relative "module_ref"
16
+ require_relative "note"
17
+ require_relative "ol"
18
+ require_relative "p"
19
+ require_relative "screen"
20
+ require_relative "sub"
21
+ require_relative "sup"
22
+ require_relative "table"
23
+ require_relative "tt"
24
+ require_relative "ul"
25
+
26
+ module Stepmod
27
+ module Utils
28
+ module Parsers
29
+ module Models
30
+ class Th < Shale::Mapper
31
+ attribute :content, Shale::Type::String
32
+ attribute :rowspan, Shale::Type::String
33
+ attribute :colspan, Shale::Type::String
34
+ attribute :align, Shale::Type::String
35
+ attribute :valign, Shale::Type::String
36
+ attribute :width, Shale::Type::String
37
+ attribute :height, Shale::Type::String
38
+ attribute :express_ref, ExpressRef, collection: true
39
+ attribute :express_extref, ExpressExtref, collection: true
40
+ attribute :module_ref, ModuleRef, collection: true
41
+ attribute :bom_ref, BomRef, collection: true
42
+ attribute :i, Italic, collection: true
43
+ attribute :b, B, collection: true
44
+ attribute :sub, Sub, collection: true
45
+ attribute :sup, Sup, collection: true
46
+ attribute :tt, Tt, collection: true
47
+ attribute :bold, Bold, collection: true
48
+ attribute :a, A, collection: true
49
+ attribute :p, P, collection: true
50
+ attribute :ul, Ul, collection: true
51
+ attribute :ol, Ol, collection: true
52
+ attribute :dl, Dl, collection: true
53
+ attribute :screen, Screen, collection: true
54
+ attribute :note, Note, collection: true
55
+ attribute :example, Example, collection: true
56
+ attribute :eqn, Eqn, collection: true
57
+ attribute :bigeqn, Bigeqn, collection: true
58
+ attribute :figure, Figure, collection: true
59
+ attribute :table, Table, collection: true
60
+
61
+ xml do
62
+ root "th"
63
+
64
+ map_content to: :content
65
+ map_attribute "rowspan", to: :rowspan
66
+ map_attribute "colspan", to: :colspan
67
+ map_attribute "align", to: :align
68
+ map_attribute "valign", to: :valign
69
+ map_attribute "width", to: :width
70
+ map_attribute "height", to: :height
71
+ map_element "express_ref", to: :express_ref
72
+ map_element "express_extref", to: :express_extref
73
+ map_element "module_ref", to: :module_ref
74
+ map_element "bom_ref", to: :bom_ref
75
+ map_element "i", to: :i
76
+ map_element "b", to: :b
77
+ map_element "sub", to: :sub
78
+ map_element "sup", to: :sup
79
+ map_element "tt", to: :tt
80
+ map_element "bold", to: :bold
81
+ map_element "a", to: :a
82
+ map_element "p", to: :p
83
+ map_element "ul", to: :ul
84
+ map_element "ol", to: :ol
85
+ map_element "dl", to: :dl
86
+ map_element "screen", to: :screen
87
+ map_element "note", to: :note
88
+ map_element "example", to: :example
89
+ map_element "eqn", to: :eqn
90
+ map_element "bigeqn", to: :bigeqn
91
+ map_element "figure", to: :figure
92
+ map_element "table", to: :table
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,53 @@
1
+ require "shale"
2
+
3
+ require_relative "a"
4
+ require_relative "b"
5
+ require_relative "bold"
6
+ require_relative "bom_ref"
7
+ require_relative "express_extref"
8
+ require_relative "express_ref"
9
+ require_relative "i"
10
+ require_relative "module_ref"
11
+ require_relative "sub"
12
+ require_relative "sup"
13
+ require_relative "tt"
14
+
15
+ module Stepmod
16
+ module Utils
17
+ module Parsers
18
+ module Models
19
+ class Title < Shale::Mapper
20
+ attribute :content, Shale::Type::String
21
+ attribute :express_ref, ExpressRef, collection: true
22
+ attribute :express_extref, ExpressExtref, collection: true
23
+ attribute :module_ref, ModuleRef, collection: true
24
+ attribute :bom_ref, BomRef, collection: true
25
+ attribute :i, Italic, collection: true
26
+ attribute :b, B, collection: true
27
+ attribute :sub, Sub, collection: true
28
+ attribute :sup, Sup, collection: true
29
+ attribute :tt, Tt, collection: true
30
+ attribute :bold, Bold, collection: true
31
+ attribute :a, A, collection: true
32
+
33
+ xml do
34
+ root "title"
35
+
36
+ map_content to: :content
37
+ map_element "express_ref", to: :express_ref
38
+ map_element "express_extref", to: :express_extref
39
+ map_element "module_ref", to: :module_ref
40
+ map_element "bom_ref", to: :bom_ref
41
+ map_element "i", to: :i
42
+ map_element "b", to: :b
43
+ map_element "sub", to: :sub
44
+ map_element "sup", to: :sup
45
+ map_element "tt", to: :tt
46
+ map_element "bold", to: :bold
47
+ map_element "a", to: :a
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,26 @@
1
+ require "shale"
2
+
3
+ require_relative "td"
4
+ require_relative "th"
5
+
6
+ module Stepmod
7
+ module Utils
8
+ module Parsers
9
+ module Models
10
+ class Tr < Shale::Mapper
11
+ attribute :align, Shale::Type::String
12
+ attribute :th, Th, collection: true
13
+ attribute :td, Td, collection: true
14
+
15
+ xml do
16
+ root "tr"
17
+
18
+ map_attribute "align", to: :align
19
+ map_element "th", to: :th
20
+ map_element "td", to: :td
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,68 @@
1
+ require "shale"
2
+
3
+ require_relative "a"
4
+ require_relative "b"
5
+ require_relative "bold"
6
+ require_relative "bom_ref"
7
+ require_relative "express_extref"
8
+ require_relative "express_ref"
9
+ require_relative "i"
10
+ require_relative "module_ref"
11
+ require_relative "sub"
12
+ require_relative "sup"
13
+
14
+ module Stepmod
15
+ module Utils
16
+ module Parsers
17
+ module Models
18
+
19
+ # These are needed to resolve circular dependencies
20
+ # https://github.com/kgiszczak/shale/blob/master/spec/shale/schema/xml_generator_spec.rb#L108
21
+ class Italic < Shale::Mapper; end
22
+ class A < Shale::Mapper; end
23
+ class B < Shale::Mapper; end
24
+ class Bold < Shale::Mapper; end
25
+ class Sub < Shale::Mapper; end
26
+ class Sup < Shale::Mapper; end
27
+ class Li < Shale::Mapper; end
28
+ class Ol < Shale::Mapper; end
29
+ class Dl < Shale::Mapper; end
30
+ class Example < Shale::Mapper; end
31
+ class Note < Shale::Mapper; end
32
+ class Table < Shale::Mapper; end
33
+
34
+ class Tt < Shale::Mapper
35
+ attribute :content, Shale::Type::String
36
+ attribute :express_ref, ExpressRef, collection: true
37
+ attribute :express_extref, ExpressExtref, collection: true
38
+ attribute :module_ref, ModuleRef, collection: true
39
+ attribute :bom_ref, BomRef, collection: true
40
+ attribute :i, Italic, collection: true
41
+ attribute :b, B, collection: true
42
+ attribute :sub, Sub, collection: true
43
+ attribute :sup, Sup, collection: true
44
+ attribute :tt, Tt, collection: true
45
+ attribute :bold, Bold, collection: true
46
+ attribute :a, A, collection: true
47
+
48
+ xml do
49
+ root "tt"
50
+
51
+ map_content to: :content
52
+ map_element "express_ref", to: :express_ref
53
+ map_element "express_extref", to: :express_extref
54
+ map_element "module_ref", to: :module_ref
55
+ map_element "bom_ref", to: :bom_ref
56
+ map_element "i", to: :i
57
+ map_element "b", to: :b
58
+ map_element "sub", to: :sub
59
+ map_element "sup", to: :sup
60
+ map_element "tt", to: :tt
61
+ map_element "bold", to: :bold
62
+ map_element "a", to: :a
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,21 @@
1
+ require "shale"
2
+
3
+ require_relative "li"
4
+
5
+ module Stepmod
6
+ module Utils
7
+ module Parsers
8
+ module Models
9
+ class Ul < Shale::Mapper
10
+ attribute :li, Li, collection: true
11
+
12
+ xml do
13
+ root "ul"
14
+
15
+ map_element "li", to: :li
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
File without changes
@@ -0,0 +1,17 @@
1
+ # frozen_striing_literal: true
2
+
3
+ module Stepmod
4
+ module Utils
5
+ module Parsers
6
+ module Types
7
+ class StringWithoutIndent < Shale::Type::Value
8
+ def self.cast(value)
9
+ return unless value
10
+
11
+ value.split("\n").map(&:strip).join("\n")
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,4 @@
1
+ require "shale/adapter/nokogiri"
2
+ require_relative "parsers/mapping_table_parser"
3
+
4
+ Shale.xml_adapter = Shale::Adapter::Nokogiri
@@ -43,7 +43,8 @@ module Stepmod
43
43
  root || (return "")
44
44
 
45
45
  ReverseAdoc.config.with(options) do
46
- result = ReverseAdoc::Converters.lookup(root.name).convert(root, options)
46
+ result = ReverseAdoc::Converters.lookup(root.name).convert(root,
47
+ options)
47
48
  Stepmod::Utils::Cleaner.new.tidy(result)
48
49
  end
49
50
  end
@@ -60,7 +60,8 @@ module Stepmod
60
60
  root || (return "")
61
61
 
62
62
  ReverseAdoc.config.with(options) do
63
- result = ReverseAdoc::Converters.lookup(root.name).convert(root, options)
63
+ result = ReverseAdoc::Converters.lookup(root.name).convert(root,
64
+ options)
64
65
 
65
66
  Stepmod::Utils::Cleaner.new.tidy(result)
66
67
  end