coradoc 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.pryrc.sample +1 -0
  3. data/lib/coradoc/document.rb +41 -23
  4. data/lib/coradoc/{document → element}/admonition.rb +1 -1
  5. data/lib/coradoc/{document → element}/attribute.rb +1 -1
  6. data/lib/coradoc/element/attribute_list.rb +46 -0
  7. data/lib/coradoc/element/audio.rb +22 -0
  8. data/lib/coradoc/element/author.rb +20 -0
  9. data/lib/coradoc/element/base.rb +17 -0
  10. data/lib/coradoc/element/block/core.rb +69 -0
  11. data/lib/coradoc/element/block/example.rb +22 -0
  12. data/lib/coradoc/element/block/literal.rb +19 -0
  13. data/lib/coradoc/element/block/quote.rb +19 -0
  14. data/lib/coradoc/element/block/side.rb +17 -0
  15. data/lib/coradoc/element/block/sourcecode.rb +20 -0
  16. data/lib/coradoc/element/block.rb +13 -0
  17. data/lib/coradoc/element/break.rb +11 -0
  18. data/lib/coradoc/{document/bibdata.rb → element/document_attributes.rb} +4 -8
  19. data/lib/coradoc/element/header.rb +20 -0
  20. data/lib/coradoc/element/image/block_image.rb +12 -0
  21. data/lib/coradoc/element/image/core.rb +24 -0
  22. data/lib/coradoc/element/image/inline_image.rb +12 -0
  23. data/lib/coradoc/element/image.rb +11 -0
  24. data/lib/coradoc/element/inline/anchor.rb +17 -0
  25. data/lib/coradoc/element/inline/bold.rb +19 -0
  26. data/lib/coradoc/element/inline/cross_reference.rb +22 -0
  27. data/lib/coradoc/element/inline/hard_line_break.rb +11 -0
  28. data/lib/coradoc/element/inline/highlight.rb +19 -0
  29. data/lib/coradoc/element/inline/image.rb +25 -0
  30. data/lib/coradoc/element/inline/italic.rb +19 -0
  31. data/lib/coradoc/element/inline/link.rb +26 -0
  32. data/lib/coradoc/element/inline/monospace.rb +19 -0
  33. data/lib/coradoc/element/inline/quotation.rb +17 -0
  34. data/lib/coradoc/element/inline/subscript.rb +17 -0
  35. data/lib/coradoc/element/inline/superscript.rb +17 -0
  36. data/lib/coradoc/element/inline.rb +19 -0
  37. data/lib/coradoc/element/list/core.rb +36 -0
  38. data/lib/coradoc/element/list/definition.rb +8 -0
  39. data/lib/coradoc/element/list/ordered.rb +15 -0
  40. data/lib/coradoc/element/list/unordered.rb +15 -0
  41. data/lib/coradoc/element/list.rb +13 -0
  42. data/lib/coradoc/element/list_item.rb +19 -0
  43. data/lib/coradoc/element/paragraph.rb +32 -0
  44. data/lib/coradoc/element/revision.rb +23 -0
  45. data/lib/coradoc/element/section.rb +37 -0
  46. data/lib/coradoc/element/table.rb +67 -0
  47. data/lib/coradoc/{document → element}/text_element.rb +8 -4
  48. data/lib/coradoc/element/title.rb +42 -0
  49. data/lib/coradoc/element/video.rb +23 -0
  50. data/lib/coradoc/generator.rb +17 -0
  51. data/lib/coradoc/legacy_parser.rb +8 -8
  52. data/lib/coradoc/oscal.rb +5 -2
  53. data/lib/coradoc/parser/asciidoc/base.rb +17 -17
  54. data/lib/coradoc/parser/asciidoc/content.rb +46 -20
  55. data/lib/coradoc/parser/asciidoc/{bibdata.rb → document_attributes.rb} +5 -5
  56. data/lib/coradoc/parser/asciidoc/header.rb +13 -10
  57. data/lib/coradoc/parser/asciidoc/section.rb +5 -5
  58. data/lib/coradoc/parser/base.rb +5 -5
  59. data/lib/coradoc/parser.rb +1 -1
  60. data/lib/coradoc/transformer.rb +39 -36
  61. data/lib/coradoc/version.rb +1 -1
  62. data/lib/coradoc.rb +6 -4
  63. metadata +55 -21
  64. data/lib/coradoc/document/author.rb +0 -11
  65. data/lib/coradoc/document/base.rb +0 -17
  66. data/lib/coradoc/document/block.rb +0 -34
  67. data/lib/coradoc/document/header.rb +0 -11
  68. data/lib/coradoc/document/list.rb +0 -14
  69. data/lib/coradoc/document/paragraph.rb +0 -19
  70. data/lib/coradoc/document/revision.rb +0 -11
  71. data/lib/coradoc/document/section.rb +0 -28
  72. data/lib/coradoc/document/table.rb +0 -20
  73. data/lib/coradoc/document/title.rb +0 -33
@@ -5,7 +5,8 @@ module Coradoc
5
5
  include Coradoc::Parser::Asciidoc::Base
6
6
 
7
7
  def paragraph
8
- text_line.repeat(1)
8
+ paragraph_meta.as(:meta).maybe >>
9
+ text_line.repeat(1).as(:lines)
9
10
  end
10
11
 
11
12
  def glossaries
@@ -14,13 +15,13 @@ module Coradoc
14
15
 
15
16
  # List
16
17
  def list
17
- unnumbered_list.as(:unnumbered) |
18
- definition_list.as(:definition) | numbered_list.as(:numbered)
18
+ unordered_list.as(:unordered) |
19
+ definition_list.as(:definition) | ordered_list.as(:ordered)
19
20
  end
20
21
 
21
22
  def contents
22
23
  (
23
- example_block.as(:example) |
24
+ block.as(:block) |
24
25
  list.as(:list) |
25
26
  table.as(:table) |
26
27
  highlight.as(:highlight) |
@@ -29,13 +30,37 @@ module Coradoc
29
30
  ).repeat(1)
30
31
  end
31
32
 
33
+ def block
34
+ sidebar_block | example_block | source_block | quote_block
35
+ end
36
+
37
+ def source_block
38
+ block_style("-", 2)
39
+ end
40
+
41
+ def quote_block
42
+ block_style("_")
43
+ end
44
+
45
+ def sidebar_block
46
+ block_style("*")
47
+ end
48
+
32
49
  def example_block
33
- str("[example]") >> newline >>
34
- str("=").repeat(4).capture(:delimiter) >> newline >>
35
- dynamic do |source, context|
36
- (str(context.captures[:delimiter]).absent? >> text.as(:text) >> endline).repeat(1) >>
37
- str(context.captures[:delimiter]) >> endline
38
- end
50
+ block_style("=")
51
+ end
52
+
53
+ def block_style(delimiter="*", repeater = 4)
54
+ block_title.maybe >>
55
+ newline.maybe >>
56
+ block_type.maybe >>
57
+ str(delimiter).repeat(repeater).as(:delimiter) >> newline >>
58
+ text_line.repeat(1).as(:lines) >>
59
+ str(delimiter).repeat(repeater) >> newline
60
+ end
61
+
62
+ def block_type
63
+ str("[") >> keyword.as(:type) >> str("]") >> newline
39
64
  end
40
65
 
41
66
  def highlight
@@ -64,17 +89,12 @@ module Coradoc
64
89
  repeat(1).as(:cols) >> line_ending
65
90
  end
66
91
 
67
- # Extended
68
- def word
69
- (match("[a-zA-Z0-9_-]") | str(".") | str("*") | match("@")).repeat(1)
70
- end
71
-
72
92
  def empty_cell_content
73
93
  str("|").absent? >> literal_space.as(:text)
74
94
  end
75
95
 
76
96
  def cell_content
77
- str("|").absent? >> literal_space? >> words.as(:text)
97
+ str("|").absent? >> literal_space? >> rich_texts.as(:text)
78
98
  end
79
99
 
80
100
  def literal_space
@@ -109,16 +129,22 @@ module Coradoc
109
129
  str("[#") >> keyword.as(:id) >> str("]")
110
130
  end
111
131
 
132
+ def paragraph_meta
133
+ str("[") >>
134
+ keyword.as(:key) >> str("=") >>
135
+ word.as(:value) >> str("]") >> newline
136
+ end
137
+
112
138
  def glossary
113
139
  keyword.as(:key) >> str("::") >> space? >>
114
140
  text.as(:value) >> line_ending.as(:break)
115
141
  end
116
142
 
117
- def numbered_list
118
- nlist_item.repeat(1)
143
+ def ordered_list
144
+ olist_item.repeat(1)
119
145
  end
120
146
 
121
- def unnumbered_list
147
+ def unordered_list
122
148
  (ulist_item >> newline.maybe).repeat(1)
123
149
  end
124
150
 
@@ -126,7 +152,7 @@ module Coradoc
126
152
  dlist_item.repeat(1)
127
153
  end
128
154
 
129
- def nlist_item
155
+ def olist_item
130
156
  match("\.") >> space >> text_line
131
157
  end
132
158
 
@@ -1,15 +1,15 @@
1
1
  module Coradoc
2
2
  module Parser
3
3
  module Asciidoc
4
- module Bibdata
4
+ module DocumentAttributes
5
5
  include Coradoc::Parser::Asciidoc::Base
6
6
 
7
- # Bibdata
8
- def bibdatas
9
- bibdata.repeat(1)
7
+ # DocumentAttributes
8
+ def document_attributess
9
+ document_attributes.repeat(1)
10
10
  end
11
11
 
12
- def bibdata
12
+ def document_attributes
13
13
  str(":") >> attribute_name.as(:key) >> str(":") >>
14
14
  space? >> attribute_value.as(:value) >> line_ending
15
15
  end
@@ -1,4 +1,4 @@
1
- require "coradoc/parser/asciidoc/base"
1
+ require_relative "base"
2
2
 
3
3
  module Coradoc
4
4
  module Parser
@@ -6,23 +6,26 @@ module Coradoc
6
6
  module Header
7
7
  include Coradoc::Parser::Asciidoc::Base
8
8
 
9
- # Header
10
9
  def header
11
- match("=") >> space? >> text.as(:title) >> newline >>
12
- author.maybe.as(:author) >> revision.maybe.as(:revision)
10
+ header_title >>
11
+ author.maybe.as(:author) >>
12
+ revision.maybe.as(:revision) >> newline.maybe
13
+ end
14
+
15
+ def header_title
16
+ match("=") >> space? >> text.as(:title) >> newline
13
17
  end
14
18
 
15
- # Author
16
19
  def author
17
- words.as(:first_name) >> str(",") >> space? >> words.as(:last_name) >>
18
- space? >> str("<") >> email.as(:email) >> str(">") >> endline
20
+ words.as(:first_name) >> str(",") >>
21
+ space? >> words.as(:last_name) >>
22
+ space? >> str("<") >> email.as(:email) >> str(">") >> newline
19
23
  end
20
24
 
21
- # Revision
22
25
  def revision
23
26
  (word >> (str(".") >> word).maybe).as(:number) >>
24
- str(",") >> space? >> word.as(:date) >>
25
- str(":") >> space? >> words.as(:remark) >> newline
27
+ str(",") >> space? >> date.as(:date ) >> str(":") >>
28
+ space? >> words.as(:remark) >> newline
26
29
  end
27
30
  end
28
31
  end
@@ -1,5 +1,5 @@
1
- require "coradoc/parser/asciidoc/base"
2
- require "coradoc/parser/asciidoc/content"
1
+ require_relative "base"
2
+ require_relative "content"
3
3
 
4
4
  module Coradoc
5
5
  module Parser
@@ -10,14 +10,14 @@ module Coradoc
10
10
 
11
11
  def section_block(level = 2)
12
12
  section_id.maybe >>
13
- section_title(level).as(:title) >>
14
- contents.as(:contents).maybe
13
+ section_title(level).as(:title) >>
14
+ contents.as(:contents).maybe
15
15
  end
16
16
 
17
17
  # Section id
18
18
  def section_id
19
19
  (str("[[") >> keyword.as(:id) >> str("]]") |
20
- str("[#") >> keyword.as(:id) >> str("]")) >> newline
20
+ str("[#") >> keyword.as(:id) >> str("]")) >> newline
21
21
  end
22
22
 
23
23
  # Heading
@@ -1,21 +1,21 @@
1
1
  require "parslet"
2
2
  require "parslet/convenience"
3
3
 
4
- require "coradoc/parser/asciidoc/header"
5
- require "coradoc/parser/asciidoc/bibdata"
6
- require "coradoc/parser/asciidoc/section"
4
+ require_relative "asciidoc/header"
5
+ require_relative "asciidoc/document_attributes"
6
+ require_relative "asciidoc/section"
7
7
 
8
8
  module Coradoc
9
9
  module Parser
10
10
  class Base < Parslet::Parser
11
11
  include Coradoc::Parser::Asciidoc::Header
12
- include Coradoc::Parser::Asciidoc::Bibdata
12
+ include Coradoc::Parser::Asciidoc::DocumentAttributes
13
13
  include Coradoc::Parser::Asciidoc::Section
14
14
 
15
15
  root :document
16
16
  rule(:document) do
17
17
  (
18
- bibdatas.as(:bibdata) |
18
+ document_attributess.as(:document_attributes) |
19
19
  section.as(:section) |
20
20
  header.as(:header) |
21
21
  empty_line.as(:line_break) |
@@ -1,4 +1,4 @@
1
- require "coradoc/parser/base"
1
+ require_relative "parser/base"
2
2
 
3
3
  module Coradoc
4
4
  module Parser
@@ -8,7 +8,7 @@ module Coradoc
8
8
  title: simple(:title),
9
9
  author: simple(:author),
10
10
  revision: simple(:revision)) do
11
- Document::Header.new(title, author: author, revision: revision)
11
+ Element::Header.new(title, author: author, revision: revision)
12
12
  end
13
13
 
14
14
  # Author
@@ -16,35 +16,41 @@ module Coradoc
16
16
  first_name: simple(:first_name),
17
17
  last_name: simple(:last_name),
18
18
  email: simple(:email)) do
19
- Document::Author.new(first_name, last_name, email)
19
+ Element::Author.new(first_name, last_name, email)
20
20
  end
21
21
 
22
22
  # Revision
23
23
  rule(number: simple(:number), date: simple(:date), remark: simple(:remark)) do
24
- Document::Revision.new(number, date: date, remark: remark)
24
+ Element::Revision.new(number, date: date, remark: remark)
25
25
  end
26
26
 
27
27
  # Text Element
28
- rule(text: simple(:text)) { Document::TextElement.new(text) }
28
+ rule(text: simple(:text)) { Element::TextElement.new(text) }
29
29
  rule(id: simple(:id), text: simple(:text)) do
30
- Document::TextElement.new(text, id: id)
30
+ Element::TextElement.new(text, id: id)
31
31
  end
32
32
 
33
33
  rule(text: simple(:text), break: simple(:line_break)) do
34
- Document::TextElement.new(text, line_break: line_break)
34
+ Element::TextElement.new(text, line_break: line_break)
35
35
  end
36
36
 
37
37
  rule(id: simple(:id), text: simple(:text), break: simple(:line_break)) do
38
- Document::TextElement.new(text, id: id, line_break: line_break)
38
+ Element::TextElement.new(text, id: id, line_break: line_break)
39
39
  end
40
40
 
41
+ # Paragraph
42
+ rule(paragraph: simple(:paragraph)) { paragraph }
43
+ rule(lines: sequence(:lines)) { Element::Paragraph.new(lines) }
44
+ rule(meta: simple(:meta), lines: sequence(:lines)) do
45
+ Element::Paragraph.new(lines, meta: meta)
46
+ end
41
47
 
42
48
  # Title Element
43
49
  rule(
44
50
  level: simple(:level),
45
51
  text: simple(:text),
46
52
  break: simple(:line_break)) do
47
- Document::Title.new(text, level, line_break: line_break)
53
+ Element::Title.new(text, level, line_break: line_break)
48
54
  end
49
55
 
50
56
  rule(
@@ -52,23 +58,19 @@ module Coradoc
52
58
  level: simple(:level),
53
59
  text: simple(:text),
54
60
  break: simple(:line_break)) do
55
- Document::Title.new(text, level, line_break: line_break, id: name)
61
+ Element::Title.new(text, level, line_break: line_break, id: name)
56
62
  end
57
63
 
58
- # Paragraph
59
- rule(paragraph: sequence(:paragraph)) do
60
- Document::Paragraph.new(paragraph)
61
- end
62
64
 
63
65
  # Section
64
- # rule(title: simple(:title)) { Document::Section.new(title) }
66
+ # rule(title: simple(:title)) { Element::Section.new(title) }
65
67
  #
66
68
  # rule(id: simple(:id), title: simple(:title), content:)
67
69
  rule(
68
70
  id: simple(:id),
69
71
  title: simple(:title),
70
72
  sections: sequence(:sections)) do
71
- Document::Section.new(title, id: id, sections: sections)
73
+ Element::Section.new(title, id: id, sections: sections)
72
74
  end
73
75
 
74
76
  rule(
@@ -76,7 +78,7 @@ module Coradoc
76
78
  title: simple(:title),
77
79
  contents: sequence(:contents),
78
80
  sections: simple(:sections)) do
79
- Document::Section.new(title, id: id, contents: contents, sections: sections)
81
+ Element::Section.new(title, id: id, contents: contents, sections: sections)
80
82
  end
81
83
 
82
84
  rule(
@@ -84,37 +86,37 @@ module Coradoc
84
86
  title: simple(:title),
85
87
  contents: sequence(:contents),
86
88
  sections: sequence(:sections)) do
87
- Document::Section.new(title, id: id, contents: contents, sections: sections)
89
+ Element::Section.new(title, id: id, contents: contents, sections: sections)
88
90
  end
89
91
 
90
92
  rule(example: sequence(:example)) do
91
- Document::Block.new("", type: "example", lines: example)
93
+ Element::Core.new("", type: "example", lines: example)
92
94
  end
93
95
 
94
96
  # rule(title: simple(:title), paragraphs: sequence(:paragraphs)) do
95
- # Document::Section.new(title, paragraphs: paragraphs)
97
+ # Element::Section.new(title, paragraphs: paragraphs)
96
98
  # end
97
99
  #
98
100
  # rule(title: simple(:title), blocks: sequence(:blocks)) do
99
- # Document::Section.new(title, blocks: blocks)
101
+ # Element::Section.new(title, blocks: blocks)
100
102
  # end
101
103
  #
102
104
  # # Admonition
103
105
  # rule(admonition: simple(:admonition)) { admonition }
104
106
  # rule(type: simple(:type), text: simple(:text), break: simple(:line_break)) do
105
- # Document::Admonition.new(text, type.to_s, line_break: line_break)
107
+ # Element::Admonition.new(text, type.to_s, line_break: line_break)
106
108
  # end
107
109
  #
108
110
  # # Block
109
111
  # rule(title: simple(:title), lines: sequence(:lines)) do
110
- # Document::Block.new(title, lines: lines)
112
+ # Element::Block.new(title, lines: lines)
111
113
  # end
112
114
  #
113
115
  # rule(
114
116
  # title: simple(:title),
115
117
  # delimiter: simple(:delimiter),
116
118
  # lines: sequence(:lines)) do
117
- # Document::Block.new(title, lines: lines, delimiter: delimiter)
119
+ # Element::Block.new(title, lines: lines, delimiter: delimiter)
118
120
  # end
119
121
  #
120
122
  # rule(
@@ -122,51 +124,52 @@ module Coradoc
122
124
  # title: simple(:title),
123
125
  # delimiter: simple(:delimiter),
124
126
  # lines: sequence(:lines)) do
125
- # Document::Block.new(title, lines: lines, delimiter: delimiter, type: type)
127
+ # Element::Block.new(title, lines: lines, delimiter: delimiter, type: type)
126
128
  # end
127
129
  #
128
130
  # rule(attributes: simple(:attributes), lines: sequence(:lines)) do
129
- # Document::Block.new(nil, lines: lines, attributes: attributes)
131
+ # Element::Block.new(nil, lines: lines, attributes: attributes)
130
132
  # end
131
133
  #
132
134
  # Attribute
133
135
  rule(key: simple(:key), value: simple(:value)) do
134
- Document::Attribute.new(key, value)
136
+ Element::Attribute.new(key, value)
135
137
  end
136
138
 
137
139
  rule(key: simple(:key), value: simple(:value), break: simple(:line_break)) do
138
- Document::Attribute.new(key, value, line_break: line_break)
140
+ Element::Attribute.new(key, value, line_break: line_break)
139
141
  end
140
142
 
141
- rule(line_break: simple(:line_break)) { Document::LineBreak.new(line_break) }
143
+ rule(line_break: simple(:line_break)) { Element::LineBreak.new(line_break) }
142
144
 
143
- rule(bibdata: sequence(:bibdata)) do
144
- Document::Bibdata.new(bibdata)
145
+ rule(document_attributes: sequence(:document_attributes)) do
146
+ Element::DocumentAttributes.new(document_attributes)
145
147
  end
146
148
 
147
149
  # Table
148
150
  rule(table: simple(:table)) { table }
149
- rule(cols: sequence(:cols)) { Document::Table::Row.new(cols) }
151
+ rule(cols: sequence(:cols)) { Element::Table::Row.new(cols) }
150
152
  rule(title: simple(:title), rows: sequence(:rows)) do
151
- Document::Table.new(title, rows)
153
+ Element::Table.new(title, rows)
152
154
  end
153
155
 
154
156
  # List
155
157
  rule(list: simple(:list)) { list }
156
- rule(unnumbered: sequence(:list_items)) do
157
- Document::List::Unnumbered.new(list_items)
158
+ rule(unordered: sequence(:list_items)) do
159
+ Element::List::Unordered.new(list_items)
158
160
  end
159
161
 
160
162
  # Highlight
161
- rule(highlight: simple(:text)) { Document::Highlight.new(text) }
163
+ rule(highlight: simple(:text)) { Element::Highlight.new(text) }
162
164
 
163
165
  # Glossaries
164
166
  rule(glossaries: sequence(:glossaries)) do
165
- Document::Glossaries.new(glossaries)
167
+ Element::Glossaries.new(glossaries)
166
168
  end
167
169
 
168
170
  rule(header: simple(:header)) { header }
169
171
  rule(section: simple(:section)) { section }
172
+
170
173
  rule(document: sequence(:elements)) do
171
174
  Document.from_ast(elements)
172
175
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Coradoc
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/coradoc.rb CHANGED
@@ -1,10 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "parslet"
4
- require "coradoc/version"
3
+ require "pathname"
5
4
 
6
- require "coradoc/parser"
7
- require "coradoc/transformer"
5
+ require "parslet"
6
+ require_relative "coradoc/version"
7
+ require_relative "coradoc/parser"
8
+ require_relative "coradoc/transformer"
9
+ require_relative "coradoc/generator"
8
10
 
9
11
  module Coradoc
10
12
  class Error < StandardError; end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coradoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  - Abu Nashir
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-06-23 00:00:00.000000000 Z
12
+ date: 2024-04-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: parslet
@@ -108,6 +108,7 @@ files:
108
108
  - ".docker/docker-compose.yml"
109
109
  - ".docker/readme.md"
110
110
  - ".hound.yml"
111
+ - ".pryrc.sample"
111
112
  - ".rubocop.yml"
112
113
  - CHANGELOG.md
113
114
  - CODE_OF_CONDUCT.md
@@ -120,26 +121,59 @@ files:
120
121
  - docker-compose.yml
121
122
  - lib/coradoc.rb
122
123
  - lib/coradoc/document.rb
123
- - lib/coradoc/document/admonition.rb
124
- - lib/coradoc/document/attribute.rb
125
- - lib/coradoc/document/author.rb
126
- - lib/coradoc/document/base.rb
127
- - lib/coradoc/document/bibdata.rb
128
- - lib/coradoc/document/block.rb
129
- - lib/coradoc/document/header.rb
130
- - lib/coradoc/document/list.rb
131
- - lib/coradoc/document/paragraph.rb
132
- - lib/coradoc/document/revision.rb
133
- - lib/coradoc/document/section.rb
134
- - lib/coradoc/document/table.rb
135
- - lib/coradoc/document/text_element.rb
136
- - lib/coradoc/document/title.rb
124
+ - lib/coradoc/element/admonition.rb
125
+ - lib/coradoc/element/attribute.rb
126
+ - lib/coradoc/element/attribute_list.rb
127
+ - lib/coradoc/element/audio.rb
128
+ - lib/coradoc/element/author.rb
129
+ - lib/coradoc/element/base.rb
130
+ - lib/coradoc/element/block.rb
131
+ - lib/coradoc/element/block/core.rb
132
+ - lib/coradoc/element/block/example.rb
133
+ - lib/coradoc/element/block/literal.rb
134
+ - lib/coradoc/element/block/quote.rb
135
+ - lib/coradoc/element/block/side.rb
136
+ - lib/coradoc/element/block/sourcecode.rb
137
+ - lib/coradoc/element/break.rb
138
+ - lib/coradoc/element/document_attributes.rb
139
+ - lib/coradoc/element/header.rb
140
+ - lib/coradoc/element/image.rb
141
+ - lib/coradoc/element/image/block_image.rb
142
+ - lib/coradoc/element/image/core.rb
143
+ - lib/coradoc/element/image/inline_image.rb
144
+ - lib/coradoc/element/inline.rb
145
+ - lib/coradoc/element/inline/anchor.rb
146
+ - lib/coradoc/element/inline/bold.rb
147
+ - lib/coradoc/element/inline/cross_reference.rb
148
+ - lib/coradoc/element/inline/hard_line_break.rb
149
+ - lib/coradoc/element/inline/highlight.rb
150
+ - lib/coradoc/element/inline/image.rb
151
+ - lib/coradoc/element/inline/italic.rb
152
+ - lib/coradoc/element/inline/link.rb
153
+ - lib/coradoc/element/inline/monospace.rb
154
+ - lib/coradoc/element/inline/quotation.rb
155
+ - lib/coradoc/element/inline/subscript.rb
156
+ - lib/coradoc/element/inline/superscript.rb
157
+ - lib/coradoc/element/list.rb
158
+ - lib/coradoc/element/list/core.rb
159
+ - lib/coradoc/element/list/definition.rb
160
+ - lib/coradoc/element/list/ordered.rb
161
+ - lib/coradoc/element/list/unordered.rb
162
+ - lib/coradoc/element/list_item.rb
163
+ - lib/coradoc/element/paragraph.rb
164
+ - lib/coradoc/element/revision.rb
165
+ - lib/coradoc/element/section.rb
166
+ - lib/coradoc/element/table.rb
167
+ - lib/coradoc/element/text_element.rb
168
+ - lib/coradoc/element/title.rb
169
+ - lib/coradoc/element/video.rb
170
+ - lib/coradoc/generator.rb
137
171
  - lib/coradoc/legacy_parser.rb
138
172
  - lib/coradoc/oscal.rb
139
173
  - lib/coradoc/parser.rb
140
174
  - lib/coradoc/parser/asciidoc/base.rb
141
- - lib/coradoc/parser/asciidoc/bibdata.rb
142
175
  - lib/coradoc/parser/asciidoc/content.rb
176
+ - lib/coradoc/parser/asciidoc/document_attributes.rb
143
177
  - lib/coradoc/parser/asciidoc/header.rb
144
178
  - lib/coradoc/parser/asciidoc/section.rb
145
179
  - lib/coradoc/parser/base.rb
@@ -152,7 +186,7 @@ licenses:
152
186
  metadata:
153
187
  homepage_uri: https://www.metanorma.org
154
188
  source_code_uri: https://github.com/metanorma/coradoc
155
- post_install_message:
189
+ post_install_message:
156
190
  rdoc_options: []
157
191
  require_paths:
158
192
  - lib
@@ -167,8 +201,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
201
  - !ruby/object:Gem::Version
168
202
  version: '0'
169
203
  requirements: []
170
- rubygems_version: 3.3.7
171
- signing_key:
204
+ rubygems_version: 3.3.27
205
+ signing_key:
172
206
  specification_version: 4
173
207
  summary: AsciiDoc parser for metanorma
174
208
  test_files: []
@@ -1,11 +0,0 @@
1
- module Coradoc
2
- class Document::Author
3
- attr_reader :email, :last_name, :first_name
4
-
5
- def initialize(first_name, last_name, email)
6
- @email = email
7
- @last_name = last_name
8
- @first_name = first_name
9
- end
10
- end
11
- end
@@ -1,17 +0,0 @@
1
- module Coradoc
2
- module Document
3
- class Base
4
- attr_reader :bibdata
5
-
6
- def initialize(asciidoc)
7
- @bibdata = extract_bibdata(asciidoc)
8
- end
9
-
10
- private
11
-
12
- def extract_bibdata(asciidoc)
13
- @bibdata ||= BibData.new(asciidoc.attributes)
14
- end
15
- end
16
- end
17
- end
@@ -1,34 +0,0 @@
1
- module Coradoc
2
- class Document::Block
3
- attr_reader :title, :lines, :attributes
4
-
5
- def initialize(title, options = {})
6
- @title = title
7
- @lines = options.fetch(:lines, [])
8
- @type_str = options.fetch(:type, nil)
9
- @delimiter = options.fetch(:delimiter, "")
10
- @attributes = options.fetch(:attributes, {})
11
- end
12
-
13
- def type
14
- @type ||= defined_type || type_from_delimiter
15
- end
16
-
17
- private
18
-
19
- def defined_type
20
- if @type_str
21
- @type_str.to_s.to_sym
22
- end
23
- end
24
-
25
- def type_from_delimiter
26
- case @delimiter
27
- when "____" then :quote
28
- when "****" then :side
29
- when "----" then :source
30
- when "====" then :example
31
- else nil end
32
- end
33
- end
34
- end
@@ -1,11 +0,0 @@
1
- module Coradoc
2
- class Document::Header
3
- attr_reader :title, :author, :revision
4
-
5
- def initialize(title, options = {})
6
- @title = title
7
- @author = options.fetch(:author, nil)
8
- @revision = options.fetch(:revision, nil)
9
- end
10
- end
11
- end