coradoc-markdown 1.0.0 → 1.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e985a5efd633ee5e945c01d6f9465316f36ed682e8a65fa1c6c33304f8af453c
4
- data.tar.gz: ece9f3be5276f6ef0c1c325fa59a3f43452472b8aa5e2350ad690381b5b7a173
3
+ metadata.gz: 2f645b393312f1c1dac03f7986da00e8165c28a08fa10e656284dfd0fa8b024e
4
+ data.tar.gz: f90f52be5816d785860b14615ed5aff2588f6a061ed8006753adc030111f5c05
5
5
  SHA512:
6
- metadata.gz: 531bc6952f8a55ccbd3b86190ced905b60242bebe6dd65873fee5cc0715fcdaa802147473fb897fb818bdec611937e48eb3b995db4844cd4c7c08a4f575bdbf7
7
- data.tar.gz: 022055b32982e6a661bcbcca4e6044e8ccb4f36d265d7f4bbe1575c07e9a424acb711d8dc532a8ba49bc4afd2d56423f0c9be127bb9a996d1cdd5c9e1e738d26
6
+ metadata.gz: 29d1fa6b132ff28425d7ccfd7eeacfc782f9d648a07802fdbfb434134e13a2a0ee40489e207ca6ea4d1f92358feb0c94097dc168024339b833cf558e7e6bcab3
7
+ data.tar.gz: 92960c95e653cc2c0c16ccfb1e23563db3d1ebe7a931b4c3a28f88c8be87d922e604b6448c53d493661e42c1bbcdeb8b2b08ce0847300cee624948accebacc92
@@ -16,7 +16,7 @@ module Coradoc
16
16
  class AttributeList < Base
17
17
  attribute :id, :string
18
18
  attribute :classes, :string, collection: true, default: []
19
- attribute :attributes, :hash, default: {}
19
+ attribute :attributes, NamedValue, collection: true, default: []
20
20
  attribute :name, :string # For ALD - the reference name
21
21
 
22
22
  # Parse an IAL string into an AttributeList
@@ -50,7 +50,9 @@ module Coradoc
50
50
 
51
51
  self.id = other.id if other.id
52
52
  self.classes = (classes + other.classes).uniq
53
- self.attributes = attributes.merge(other.attributes)
53
+ merged = {}
54
+ (attributes + other.attributes).each { |nv| merged[nv.name] = nv }
55
+ self.attributes = merged.values
54
56
  self
55
57
  end
56
58
 
@@ -67,19 +69,6 @@ module Coradoc
67
69
  id.nil? && classes.empty? && attributes.empty?
68
70
  end
69
71
 
70
- # Convert to Markdown IAL syntax
71
- # @return [String]
72
- def to_md
73
- return '' if empty?
74
-
75
- parts = []
76
- parts << "##{id}" if id
77
- parts += classes.map { |c| ".#{c}" }
78
- parts += attributes.map { |k, v| %(#{k}="#{v}") }
79
-
80
- "{:#{parts.join(' ')}}"
81
- end
82
-
83
72
  def self.parse_attributes(content, attr_list)
84
73
  # Use shared IalParser for consistent parsing
85
74
  ParserUtil::IalParser.tokenize(content).each do |token|
@@ -89,7 +78,7 @@ module Coradoc
89
78
  when :id
90
79
  attr_list.id = token[:value]
91
80
  when :attribute
92
- attr_list.attributes[token[:key]] = token[:value]
81
+ attr_list.attributes << NamedValue.new(name: token[:key], value: token[:value])
93
82
  end
94
83
  end
95
84
  end
@@ -18,8 +18,8 @@ module Coradoc
18
18
  # Classes from IAL (for convenience)
19
19
  attribute :classes, :string, collection: true
20
20
 
21
- # Additional attributes from IAL
22
- attribute :attributes, :hash, default: {}
21
+ # Additional attributes from IAL (typed key-value pairs)
22
+ attribute :attributes, NamedValue, collection: true, default: []
23
23
 
24
24
  # Visit pattern for traversing the document tree
25
25
  def self.visit(element, &block)
@@ -49,38 +49,6 @@ module Coradoc
49
49
  end
50
50
  self
51
51
  end
52
-
53
- # Serialize polymorphic content to Markdown string
54
- def serialize_content(content)
55
- case content
56
- when Array
57
- content.map { |elem| serialize_content(elem) }.join
58
- when String
59
- content
60
- when nil
61
- ''
62
- else
63
- if content.is_a?(Base)
64
- content.to_md
65
- else
66
- raise ArgumentError,
67
- "Cannot serialize #{content.class.name} to Markdown. " \
68
- 'Expected String or Base subclass.'
69
- end
70
- end
71
- end
72
-
73
- # Does a shallow attribute dump of the object
74
- def to_h
75
- self.class.attributes.keys.each_with_object({}) do |attribute, acc|
76
- acc[attribute] = public_send(attribute)
77
- end
78
- end
79
-
80
- # Serialize this model element to Markdown
81
- def to_md
82
- Coradoc::Markdown::Serializer.serialize(self)
83
- end
84
52
  end
85
53
  end
86
54
  end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Coradoc
4
+ module Markdown
5
+ class CrossReference < Base
6
+ attribute :text, :string
7
+ attribute :target, :string
8
+ end
9
+ end
10
+ end
@@ -30,18 +30,6 @@ module Coradoc
30
30
  class DefinitionList < Base
31
31
  # Terms with their definitions
32
32
  attribute :items, Coradoc::Markdown::DefinitionTerm, collection: true
33
-
34
- # Serialize to Markdown
35
- def to_md
36
- items.map do |term|
37
- term_text = term.text.to_s
38
- defs = term.definitions.map do |defn|
39
- content = defn.content.to_s
40
- ": #{content}"
41
- end.join("\n")
42
- "#{term_text}\n#{defs}"
43
- end.join("\n\n")
44
- end
45
33
  end
46
34
  end
47
35
  end
@@ -13,7 +13,7 @@ module Coradoc
13
13
  #
14
14
  class Extension < Base
15
15
  attribute :name, :string
16
- attribute :options, :hash, default: {}
16
+ attribute :options, NamedValue, collection: true, default: []
17
17
  attribute :content, :string # For block extensions with content
18
18
  attribute :body, :string # Alias for content
19
19
 
@@ -32,14 +32,14 @@ module Coradoc
32
32
  # @param options [Hash] TOC options (levels, etc.)
33
33
  # @return [Extension]
34
34
  def self.toc(options = {})
35
- new(name: :toc, options: options)
35
+ new(name: :toc, options: hash_to_named(options))
36
36
  end
37
37
 
38
38
  # Create an options extension
39
39
  # @param options [Hash] Parser options
40
40
  # @return [Extension]
41
41
  def self.options(options = {})
42
- new(name: :options, options: options)
42
+ new(name: :options, options: hash_to_named(options))
43
43
  end
44
44
 
45
45
  # Create a comment extension
@@ -69,23 +69,14 @@ module Coradoc
69
69
  content.nil? || content.empty?
70
70
  end
71
71
 
72
- # Convert to Markdown
73
- # @return [String]
74
- def to_md
75
- opts = options.empty? ? '' : " #{options_to_s}"
76
- if self_closing?
77
- "{::#{name}#{opts} /}"
78
- else
79
- "{::#{name}#{opts}}#{content}{:/}"
80
- end
81
- end
72
+ class << self
73
+ private
82
74
 
83
- private
75
+ def hash_to_named(hash)
76
+ return [] if hash.nil? || hash.empty?
84
77
 
85
- def options_to_s
86
- options.map do |k, v|
87
- %(#{k}="#{v}")
88
- end.join(' ')
78
+ hash.map { |k, v| NamedValue.new(name: k.to_s, value: v.to_s) }
79
+ end
89
80
  end
90
81
  end
91
82
  end
@@ -12,11 +12,6 @@ module Coradoc
12
12
  class FootnoteReference < Base
13
13
  # The footnote identifier
14
14
  attribute :id, :string
15
-
16
- # Serialize to Markdown
17
- def to_md
18
- "[^#{id}]"
19
- end
20
15
  end
21
16
  end
22
17
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
-
4
3
  module Coradoc
5
4
  module Markdown
6
5
  # Represents highlighted text using == syntax (extended Markdown).
@@ -9,10 +8,6 @@ module Coradoc
9
8
  #
10
9
  class Highlight < Base
11
10
  attribute :text, :string
12
-
13
- def to_md
14
- "==#{text}=="
15
- end
16
11
  end
17
12
  end
18
13
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
-
4
3
  module Coradoc
5
4
  module Markdown
6
5
  # Represents a math block (block or inline)
@@ -29,22 +28,9 @@ module Coradoc
29
28
  new(content: content, inline: true)
30
29
  end
31
30
 
32
- # Create a block math element
33
- # @param content [String] The math content
34
- # @return [Math]
35
31
  def self.block(content)
36
32
  new(content: content, inline: false)
37
33
  end
38
-
39
- # Convert to Markdown
40
- # @return [String]
41
- def to_md
42
- if inline?
43
- "$$#{content}$$"
44
- else
45
- "$$\n#{content}\n$$"
46
- end
47
- end
48
34
  end
49
35
  end
50
36
  end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Coradoc
4
+ module Markdown
5
+ # A typed key-value pair used wherever Markdown models need arbitrary
6
+ # attributes (IAL key="value" pairs, extension options, etc.).
7
+ #
8
+ # Replaces raw Hash attributes so that every attribute on a model is
9
+ # a typed lutaml-model declaration.
10
+ #
11
+ # @example
12
+ # NamedValue.new(name: "data-role", value: "main")
13
+ class NamedValue < Base
14
+ attribute :name, :string
15
+ attribute :value, :string
16
+ end
17
+ end
18
+ end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
-
4
3
  module Coradoc
5
4
  module Markdown
6
5
  # Represents strikethrough text using GFM ~~ syntax.
@@ -9,10 +8,6 @@ module Coradoc
9
8
  #
10
9
  class Strikethrough < Base
11
10
  attribute :text, :string
12
-
13
- def to_md
14
- "~~#{text}~~"
15
- end
16
11
  end
17
12
  end
18
13
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Coradoc
4
+ module Markdown
5
+ class Subscript < Base
6
+ attribute :text, :string
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Coradoc
4
+ module Markdown
5
+ class Superscript < Base
6
+ attribute :text, :string
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Coradoc
4
+ module Markdown
5
+ class Underline < Base
6
+ attribute :text, :string
7
+ end
8
+ end
9
+ end
@@ -59,15 +59,23 @@ module Coradoc
59
59
  when Abbreviation
60
60
  serialize_abbreviation(element)
61
61
  when Strikethrough
62
- element.to_md
62
+ serialize_strikethrough(element)
63
63
  when Highlight
64
- element.to_md
64
+ serialize_highlight(element)
65
+ when Subscript
66
+ serialize_subscript(element)
67
+ when Superscript
68
+ serialize_superscript(element)
69
+ when Underline
70
+ serialize_underline(element)
71
+ when CrossReference
72
+ serialize_cross_reference(element)
65
73
  when AttributeList
66
- element.to_md
74
+ serialize_attribute_list(element)
67
75
  when Math
68
- element.to_md
76
+ serialize_math(element)
69
77
  when Extension
70
- element.to_md
78
+ serialize_extension(element)
71
79
  when String
72
80
  element
73
81
  else
@@ -99,16 +107,16 @@ module Coradoc
99
107
  case element
100
108
  when String
101
109
  element
102
- when Emphasis, Strong, Code, Link, Image, FootnoteReference, Math, Extension, Strikethrough, Highlight
110
+ when Emphasis, Strong, Code, Link, Image, FootnoteReference, Math, Extension,
111
+ Strikethrough, Highlight, Subscript, Superscript, Underline, CrossReference,
112
+ AttributeList, DefinitionList
113
+ serialize(element)
114
+ when Base
103
115
  serialize(element)
104
116
  else
105
- if element.is_a?(Base)
106
- element.to_md
107
- else
108
- raise ArgumentError,
109
- "Cannot serialize inline content of type #{element.class}. " \
110
- 'Expected String, known inline model, or Base subclass.'
111
- end
117
+ raise ArgumentError,
118
+ "Cannot serialize inline content of type #{element.class}. " \
119
+ 'Expected String, known inline model, or Base subclass.'
112
120
  end
113
121
  end
114
122
 
@@ -194,6 +202,61 @@ module Coradoc
194
202
  def serialize_abbreviation(abbr)
195
203
  "*[#{abbr.term}]: #{abbr.definition}"
196
204
  end
205
+
206
+ def serialize_strikethrough(elem)
207
+ "~~#{elem.text}~~"
208
+ end
209
+
210
+ def serialize_highlight(elem)
211
+ "==#{elem.text}=="
212
+ end
213
+
214
+ def serialize_subscript(elem)
215
+ "<sub>#{elem.text}</sub>"
216
+ end
217
+
218
+ def serialize_superscript(elem)
219
+ "<sup>#{elem.text}</sup>"
220
+ end
221
+
222
+ def serialize_underline(elem)
223
+ "<u>#{elem.text}</u>"
224
+ end
225
+
226
+ def serialize_cross_reference(elem)
227
+ "[#{elem.text}](##{elem.target})"
228
+ end
229
+
230
+ def serialize_attribute_list(elem)
231
+ return '' if elem.empty?
232
+
233
+ parts = []
234
+ parts << "##{elem.id}" if elem.id
235
+ parts += elem.classes.map { |c| ".#{c}" }
236
+ parts += elem.attributes.map { |nv| %(#{nv.name}="#{nv.value}") }
237
+ "{:#{parts.join(' ')}}"
238
+ end
239
+
240
+ def serialize_math(elem)
241
+ if elem.inline?
242
+ "$$#{elem.content}$$"
243
+ else
244
+ "$$\n#{elem.content}\n$$"
245
+ end
246
+ end
247
+
248
+ def serialize_extension(elem)
249
+ opts = elem.options.empty? ? '' : " #{extension_options_to_s(elem.options)}"
250
+ if elem.self_closing?
251
+ "{::#{elem.name}#{opts} /}"
252
+ else
253
+ "{::#{elem.name}#{opts}}#{elem.content}{:/}"
254
+ end
255
+ end
256
+
257
+ def extension_options_to_s(options)
258
+ options.map { |nv| %(#{nv.name}="#{nv.value}") }.join(' ')
259
+ end
197
260
  end
198
261
  end
199
262
  end
@@ -2,12 +2,6 @@
2
2
 
3
3
  module Coradoc
4
4
  module Markdown
5
- module Model
6
- autoload :Base, "#{__dir__}/model/base"
7
- autoload :Heading, "#{__dir__}/model/heading"
8
- autoload :Document, "#{__dir__}/model/document"
9
- end
10
-
11
5
  # Table of Contents Generator
12
6
  #
13
7
  # Generates a table of contents from document headings.
@@ -58,10 +58,10 @@ module Coradoc
58
58
  private
59
59
 
60
60
  def transform_structural_element(element)
61
- case element.element_type
62
- when 'document'
61
+ case element
62
+ when CoreModel::DocumentElement
63
63
  transform_document(element)
64
- when 'section'
64
+ when CoreModel::SectionElement
65
65
  transform_section(element)
66
66
  else
67
67
  transform_generic_element(element)
@@ -94,10 +94,11 @@ module Coradoc
94
94
  end
95
95
 
96
96
  def transform_block(block)
97
- case block.element_type
98
- when 'paragraph'
97
+ semantic = block.resolve_semantic_type
98
+ case semantic
99
+ when :paragraph
99
100
  transform_paragraph(block)
100
- when 'comment'
101
+ when :comment
101
102
  Coradoc::Markdown::Extension.comment(block.content.to_s)
102
103
  else
103
104
  transform_delimited_block(block)
@@ -106,8 +107,8 @@ module Coradoc
106
107
 
107
108
  def transform_paragraph(block)
108
109
  content = block.renderable_content
109
- if content.is_a?(Array) && content.any? { |c| !c.is_a?(String) }
110
- # Mixed content with inline elements
110
+ has_structured = content.is_a?(Array) && content.any? { |c| !c.is_a?(CoreModel::TextContent) }
111
+ if has_structured
111
112
  children = content.map { |c| transform_inline_content(c) }
112
113
  Coradoc::Markdown::Paragraph.new(text: block.flat_text, children: children)
113
114
  else
@@ -119,6 +120,8 @@ module Coradoc
119
120
  case element
120
121
  when Coradoc::CoreModel::InlineElement
121
122
  transform_inline(element)
123
+ when CoreModel::TextContent
124
+ element.text
122
125
  when String
123
126
  element
124
127
  else
@@ -160,7 +163,6 @@ module Coradoc
160
163
  when '>' then :quote
161
164
  when '---', '***', '___' then :horizontal_rule
162
165
  when '++++' then :pass
163
- else nil
164
166
  end
165
167
  end
166
168
 
@@ -184,7 +186,8 @@ module Coradoc
184
186
  def transform_list(list)
185
187
  items = Array(list.items).map do |item|
186
188
  content = item.renderable_content
187
- if content.is_a?(Array) && content.any? { |c| !c.is_a?(String) }
189
+ has_structured = content.is_a?(Array) && content.any? { |c| !c.is_a?(CoreModel::TextContent) }
190
+ if has_structured
188
191
  children = content.map { |c| transform_inline_content(c) }
189
192
  Coradoc::Markdown::ListItem.new(text: item.flat_text, children: children)
190
193
  else
@@ -234,7 +237,7 @@ module Coradoc
234
237
  end
235
238
 
236
239
  def transform_inline(element)
237
- case element.format_type
240
+ case element.resolve_format_type
238
241
  when 'bold'
239
242
  Coradoc::Markdown::Strong.new(text: element.content.to_s)
240
243
  when 'italic'
@@ -255,13 +258,16 @@ module Coradoc
255
258
  when 'strikethrough'
256
259
  Coradoc::Markdown::Strikethrough.new(text: element.content.to_s)
257
260
  when 'subscript'
258
- "<sub>#{element.content}</sub>"
261
+ Coradoc::Markdown::Subscript.new(text: element.content.to_s)
259
262
  when 'superscript'
260
- "<sup>#{element.content}</sup>"
263
+ Coradoc::Markdown::Superscript.new(text: element.content.to_s)
261
264
  when 'underline'
262
- "<u>#{element.content}</u>"
265
+ Coradoc::Markdown::Underline.new(text: element.content.to_s)
263
266
  when 'xref'
264
- "[#{element.content}](##{element.target})"
267
+ Coradoc::Markdown::CrossReference.new(
268
+ text: element.content.to_s,
269
+ target: element.target.to_s
270
+ )
265
271
  else
266
272
  element.content.to_s
267
273
  end
@@ -76,8 +76,7 @@ module Coradoc
76
76
  def transform_document(doc)
77
77
  children = Array(doc.blocks).map { |block| transform(block) }
78
78
 
79
- Coradoc::CoreModel::StructuralElement.new(
80
- element_type: 'document',
79
+ Coradoc::CoreModel::DocumentElement.new(
81
80
  id: doc.id,
82
81
  title: extract_title(doc),
83
82
  children: children
@@ -85,8 +84,7 @@ module Coradoc
85
84
  end
86
85
 
87
86
  def transform_heading(heading)
88
- Coradoc::CoreModel::StructuralElement.new(
89
- element_type: 'section',
87
+ Coradoc::CoreModel::SectionElement.new(
90
88
  level: heading.level,
91
89
  title: extract_text(heading.text),
92
90
  children: []
@@ -96,15 +94,13 @@ module Coradoc
96
94
  def transform_paragraph(para)
97
95
  content = extract_text(para.text)
98
96
 
99
- Coradoc::CoreModel::Block.new(
100
- element_type: 'paragraph',
97
+ Coradoc::CoreModel::ParagraphBlock.new(
101
98
  content: content
102
99
  )
103
100
  end
104
101
 
105
102
  def transform_code_block(block)
106
103
  Coradoc::CoreModel::SourceBlock.new(
107
- element_type: 'block',
108
104
  content: block.code.to_s,
109
105
  language: block.language
110
106
  )
@@ -112,7 +108,6 @@ module Coradoc
112
108
 
113
109
  def transform_blockquote(blockquote)
114
110
  Coradoc::CoreModel::QuoteBlock.new(
115
- element_type: 'block',
116
111
  content: blockquote.content.to_s
117
112
  )
118
113
  end
@@ -165,25 +160,21 @@ module Coradoc
165
160
  end
166
161
 
167
162
  def transform_link(link)
168
- Coradoc::CoreModel::InlineElement.new(
169
- format_type: 'link',
163
+ Coradoc::CoreModel::LinkElement.new(
170
164
  target: link.url,
171
165
  content: extract_text(link.text)
172
166
  )
173
167
  end
174
168
 
175
169
  def transform_inline(inline, format_type)
176
- Coradoc::CoreModel::InlineElement.new(
177
- format_type: format_type,
170
+ klass = Coradoc::CoreModel::InlineElement.format_type_class(format_type)
171
+ klass.new(
178
172
  content: extract_text(inline.text)
179
173
  )
180
174
  end
181
175
 
182
176
  def transform_horizontal_rule(_rule)
183
- Coradoc::CoreModel::Block.new(
184
- element_type: 'block',
185
- block_semantic_type: :horizontal_rule
186
- )
177
+ Coradoc::CoreModel::HorizontalRuleBlock.new
187
178
  end
188
179
 
189
180
  def transform_definition_list(dl)
@@ -221,13 +212,11 @@ module Coradoc
221
212
 
222
213
  def transform_math(math)
223
214
  if math.inline?
224
- Coradoc::CoreModel::InlineElement.new(
225
- format_type: 'stem',
215
+ Coradoc::CoreModel::StemElement.new(
226
216
  content: math.content.to_s
227
217
  )
228
218
  else
229
219
  Coradoc::CoreModel::PassBlock.new(
230
- element_type: 'block',
231
220
  content: math.content.to_s,
232
221
  language: 'latexmath'
233
222
  )
@@ -239,19 +228,16 @@ module Coradoc
239
228
  when :toc
240
229
  Coradoc::CoreModel::Toc.new
241
230
  when :comment
242
- Coradoc::CoreModel::Block.new(
243
- element_type: 'comment',
231
+ Coradoc::CoreModel::CommentBlock.new(
244
232
  content: ext.content.to_s
245
233
  )
246
234
  when :nomarkdown
247
235
  Coradoc::CoreModel::PassBlock.new(
248
- element_type: 'block',
249
236
  content: ext.content.to_s
250
237
  )
251
238
  else
252
239
  # Unknown extensions: preserve content as a generic block
253
- Coradoc::CoreModel::Block.new(
254
- element_type: 'paragraph',
240
+ Coradoc::CoreModel::ParagraphBlock.new(
255
241
  content: ext.content.to_s
256
242
  )
257
243
  end
@@ -263,12 +249,11 @@ module Coradoc
263
249
  attr_list.classes.each do |cls|
264
250
  attrs << Coradoc::CoreModel::ElementAttribute.new(name: 'class', value: cls.to_s)
265
251
  end
266
- attr_list.attributes.each do |k, v|
267
- attrs << Coradoc::CoreModel::ElementAttribute.new(name: k.to_s, value: v.to_s)
252
+ attr_list.attributes.each do |nv|
253
+ attrs << Coradoc::CoreModel::ElementAttribute.new(name: nv.name, value: nv.value)
268
254
  end
269
255
 
270
256
  Coradoc::CoreModel::StructuralElement.new(
271
- element_type: 'attribute_list',
272
257
  children: attrs
273
258
  )
274
259
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Coradoc
4
4
  module Markdown
5
- VERSION = '1.0.0'
5
+ VERSION = '1.0.2'
6
6
  end
7
7
  end
@@ -21,7 +21,9 @@
21
21
  require 'parslet'
22
22
  require 'lutaml/model'
23
23
 
24
+ # Coradoc document transformation library.
24
25
  module Coradoc
26
+ # Markdown document model, parser, and serializer.
25
27
  module Markdown
26
28
  # Error classes
27
29
  autoload :Errors, 'coradoc/markdown/errors'
@@ -54,6 +56,11 @@ module Coradoc
54
56
  autoload :Extension, 'coradoc/markdown/model/extension'
55
57
  autoload :Strikethrough, 'coradoc/markdown/model/strikethrough'
56
58
  autoload :Highlight, 'coradoc/markdown/model/highlight'
59
+ autoload :Subscript, 'coradoc/markdown/model/subscript'
60
+ autoload :Superscript, 'coradoc/markdown/model/superscript'
61
+ autoload :Underline, 'coradoc/markdown/model/underline'
62
+ autoload :CrossReference, 'coradoc/markdown/model/cross_reference'
63
+ autoload :NamedValue, 'coradoc/markdown/model/named_value'
57
64
 
58
65
  # Serializer
59
66
  autoload :Serializer, 'coradoc/markdown/serializer'
@@ -83,24 +90,6 @@ module Coradoc
83
90
  # Shared parser utilities
84
91
  autoload :ParserUtil, 'coradoc/markdown/parser_util'
85
92
 
86
- # Convenience accessors for kramdown extension models
87
- class << self
88
- # Access AttributeList class
89
- def AttributeList
90
- @AttributeList ||= const_get(:AttributeList)
91
- end
92
-
93
- # Access Math class
94
- def Math
95
- @Math ||= const_get(:Math)
96
- end
97
-
98
- # Access Extension class
99
- def Extension
100
- @Extension ||= const_get(:Extension)
101
- end
102
- end
103
-
104
93
  class << self
105
94
  # Parse Markdown content into a Document model
106
95
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coradoc-markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
@@ -13,30 +13,30 @@ dependencies:
13
13
  name: coradoc
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - ">="
16
+ - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: '0'
18
+ version: '2.0'
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
- - - ">="
23
+ - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: '0'
25
+ version: '2.0'
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: lutaml-model
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
- - - ">="
30
+ - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: '0'
32
+ version: 0.8.0
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ">="
37
+ - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0'
39
+ version: 0.8.0
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: parslet
42
42
  requirement: !ruby/object:Gem::Requirement
@@ -111,6 +111,7 @@ files:
111
111
  - lib/coradoc/markdown/model/blockquote.rb
112
112
  - lib/coradoc/markdown/model/code.rb
113
113
  - lib/coradoc/markdown/model/code_block.rb
114
+ - lib/coradoc/markdown/model/cross_reference.rb
114
115
  - lib/coradoc/markdown/model/definition_item.rb
115
116
  - lib/coradoc/markdown/model/definition_list.rb
116
117
  - lib/coradoc/markdown/model/definition_term.rb
@@ -127,11 +128,15 @@ files:
127
128
  - lib/coradoc/markdown/model/list.rb
128
129
  - lib/coradoc/markdown/model/list_item.rb
129
130
  - lib/coradoc/markdown/model/math.rb
131
+ - lib/coradoc/markdown/model/named_value.rb
130
132
  - lib/coradoc/markdown/model/paragraph.rb
131
133
  - lib/coradoc/markdown/model/strikethrough.rb
132
134
  - lib/coradoc/markdown/model/strong.rb
135
+ - lib/coradoc/markdown/model/subscript.rb
136
+ - lib/coradoc/markdown/model/superscript.rb
133
137
  - lib/coradoc/markdown/model/table.rb
134
138
  - lib/coradoc/markdown/model/text.rb
139
+ - lib/coradoc/markdown/model/underline.rb
135
140
  - lib/coradoc/markdown/parser.rb
136
141
  - lib/coradoc/markdown/parser/ast_processor.rb
137
142
  - lib/coradoc/markdown/parser/block_parser.rb
@@ -160,7 +165,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
165
  requirements:
161
166
  - - ">="
162
167
  - !ruby/object:Gem::Version
163
- version: 3.1.0
168
+ version: 3.3.0
164
169
  required_rubygems_version: !ruby/object:Gem::Requirement
165
170
  requirements:
166
171
  - - ">="