coradoc 1.1.6 → 1.1.7
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 +4 -4
- data/.envrc +1 -0
- data/.irbrc +1 -0
- data/.rspec +3 -0
- data/.rubocop.yml +5 -1
- data/.rubocop_todo.yml +179 -0
- data/README.adoc +5 -0
- data/coradoc.gemspec +5 -5
- data/exe/reverse_adoc +1 -1
- data/exe/w2a +1 -1
- data/flake.lock +114 -0
- data/flake.nix +135 -0
- data/lib/coradoc/cli.rb +1 -1
- data/lib/coradoc/converter.rb +4 -5
- data/lib/coradoc/element/attribute.rb +10 -1
- data/lib/coradoc/element/attribute_list.rb +4 -3
- data/lib/coradoc/element/audio.rb +1 -1
- data/lib/coradoc/element/author.rb +2 -2
- data/lib/coradoc/element/base.rb +14 -2
- data/lib/coradoc/element/bibliography.rb +1 -1
- data/lib/coradoc/element/bibliography_entry.rb +1 -1
- data/lib/coradoc/element/block/open.rb +1 -1
- data/lib/coradoc/element/block.rb +1 -1
- data/lib/coradoc/element/document_attributes.rb +8 -2
- data/lib/coradoc/element/image/block_image.rb +3 -2
- data/lib/coradoc/element/image/core.rb +5 -4
- data/lib/coradoc/element/inline/attribute_reference.rb +19 -0
- data/lib/coradoc/element/inline/cross_reference.rb +4 -3
- data/lib/coradoc/element/inline/footnote.rb +24 -0
- data/lib/coradoc/element/inline/small.rb +19 -0
- data/lib/coradoc/element/inline/span.rb +37 -0
- data/lib/coradoc/element/inline/underline.rb +19 -0
- data/lib/coradoc/element/inline.rb +5 -1
- data/lib/coradoc/element/list/core.rb +2 -2
- data/lib/coradoc/element/list/ordered.rb +1 -0
- data/lib/coradoc/element/list/unordered.rb +1 -0
- data/lib/coradoc/element/list_item.rb +19 -20
- data/lib/coradoc/element/table.rb +4 -2
- data/lib/coradoc/element/term.rb +1 -0
- data/lib/coradoc/element/text_element.rb +4 -1
- data/lib/coradoc/element/title.rb +1 -1
- data/lib/coradoc/element/video.rb +2 -2
- data/lib/coradoc/input/adoc.rb +20 -18
- data/lib/coradoc/input/docx.rb +25 -23
- data/lib/coradoc/input/html/README.adoc +1 -1
- data/lib/coradoc/input/html/cleaner.rb +121 -117
- data/lib/coradoc/input/html/config.rb +58 -56
- data/lib/coradoc/input/html/converters/a.rb +44 -39
- data/lib/coradoc/input/html/converters/aside.rb +12 -8
- data/lib/coradoc/input/html/converters/audio.rb +24 -20
- data/lib/coradoc/input/html/converters/base.rb +103 -99
- data/lib/coradoc/input/html/converters/blockquote.rb +18 -14
- data/lib/coradoc/input/html/converters/br.rb +11 -7
- data/lib/coradoc/input/html/converters/bypass.rb +77 -73
- data/lib/coradoc/input/html/converters/code.rb +18 -14
- data/lib/coradoc/input/html/converters/div.rb +15 -11
- data/lib/coradoc/input/html/converters/dl.rb +51 -44
- data/lib/coradoc/input/html/converters/drop.rb +21 -17
- data/lib/coradoc/input/html/converters/em.rb +16 -12
- data/lib/coradoc/input/html/converters/figure.rb +19 -15
- data/lib/coradoc/input/html/converters/h.rb +32 -30
- data/lib/coradoc/input/html/converters/head.rb +17 -13
- data/lib/coradoc/input/html/converters/hr.rb +11 -7
- data/lib/coradoc/input/html/converters/ignore.rb +15 -11
- data/lib/coradoc/input/html/converters/img.rb +98 -93
- data/lib/coradoc/input/html/converters/li.rb +13 -9
- data/lib/coradoc/input/html/converters/mark.rb +14 -10
- data/lib/coradoc/input/html/converters/markup.rb +22 -18
- data/lib/coradoc/input/html/converters/math.rb +24 -20
- data/lib/coradoc/input/html/converters/ol.rb +55 -50
- data/lib/coradoc/input/html/converters/p.rb +16 -12
- data/lib/coradoc/input/html/converters/pass_through.rb +12 -8
- data/lib/coradoc/input/html/converters/pre.rb +49 -45
- data/lib/coradoc/input/html/converters/q.rb +12 -8
- data/lib/coradoc/input/html/converters/strong.rb +15 -11
- data/lib/coradoc/input/html/converters/sub.rb +15 -11
- data/lib/coradoc/input/html/converters/sup.rb +15 -11
- data/lib/coradoc/input/html/converters/table.rb +21 -13
- data/lib/coradoc/input/html/converters/td.rb +64 -60
- data/lib/coradoc/input/html/converters/text.rb +24 -20
- data/lib/coradoc/input/html/converters/th.rb +13 -9
- data/lib/coradoc/input/html/converters/tr.rb +17 -13
- data/lib/coradoc/input/html/converters/video.rb +24 -20
- data/lib/coradoc/input/html/converters.rb +45 -43
- data/lib/coradoc/input/html/errors.rb +8 -6
- data/lib/coradoc/input/html/html_converter.rb +93 -90
- data/lib/coradoc/input/html/plugin.rb +104 -104
- data/lib/coradoc/input/html/plugins/plateau.rb +197 -190
- data/lib/coradoc/input/html/postprocessor.rb +188 -182
- data/lib/coradoc/input/html.rb +34 -32
- data/lib/coradoc/oscal.rb +18 -5
- data/lib/coradoc/output/adoc.rb +13 -11
- data/lib/coradoc/output/coradoc_tree_debug.rb +15 -13
- data/lib/coradoc/parser/asciidoc/admonition.rb +6 -6
- data/lib/coradoc/parser/asciidoc/attribute_list.rb +43 -27
- data/lib/coradoc/parser/asciidoc/base.rb +3 -6
- data/lib/coradoc/parser/asciidoc/bibliography.rb +5 -6
- data/lib/coradoc/parser/asciidoc/block.rb +30 -31
- data/lib/coradoc/parser/asciidoc/citation.rb +11 -29
- data/lib/coradoc/parser/asciidoc/content.rb +23 -33
- data/lib/coradoc/parser/asciidoc/document_attributes.rb +2 -3
- data/lib/coradoc/parser/asciidoc/header.rb +1 -2
- data/lib/coradoc/parser/asciidoc/inline.rb +165 -42
- data/lib/coradoc/parser/asciidoc/list.rb +27 -27
- data/lib/coradoc/parser/asciidoc/paragraph.rb +28 -19
- data/lib/coradoc/parser/asciidoc/section.rb +11 -17
- data/lib/coradoc/parser/asciidoc/table.rb +5 -5
- data/lib/coradoc/parser/asciidoc/term.rb +24 -8
- data/lib/coradoc/parser/asciidoc/text.rb +18 -21
- data/lib/coradoc/parser/base.rb +0 -3
- data/lib/coradoc/reverse_adoc.rb +3 -3
- data/lib/coradoc/transformer.rb +167 -137
- data/lib/coradoc/version.rb +1 -1
- data/lib/reverse_adoc.rb +1 -1
- data/utils/inspect_asciidoc.rb +29 -0
- data/utils/parser_analyzer.rb +14 -14
- data/utils/round_trip.rb +31 -15
- metadata +41 -31
- data/.hound.yml +0 -5
- data/lib/coradoc/element/inline/citation.rb +0 -24
@@ -2,71 +2,87 @@ module Coradoc
|
|
2
2
|
module Parser
|
3
3
|
module Asciidoc
|
4
4
|
module AttributeList
|
5
|
-
|
6
5
|
def named_attribute_name
|
7
6
|
attribute_name
|
8
7
|
end
|
9
8
|
|
10
|
-
def
|
9
|
+
def named_value_noquote
|
11
10
|
match('[^\],]').repeat(1)
|
12
11
|
end
|
13
12
|
|
13
|
+
def named_value_single_quote
|
14
|
+
str("'") >>
|
15
|
+
match("[^']").repeat(1) >>
|
16
|
+
str("'")
|
17
|
+
end
|
18
|
+
|
19
|
+
def named_value_double_quote
|
20
|
+
str('"') >>
|
21
|
+
match('[^"]').repeat(1) >>
|
22
|
+
str('"')
|
23
|
+
end
|
24
|
+
|
25
|
+
def named_value
|
26
|
+
(named_value_single_quote |
|
27
|
+
named_value_double_quote |
|
28
|
+
named_value_noquote
|
29
|
+
).as(:named_value)
|
30
|
+
end
|
31
|
+
|
14
32
|
def named_key
|
15
|
-
(
|
16
|
-
match('[a-zA-Z0-9_-]').repeat(1)).as(:named_key)
|
33
|
+
match("[a-zA-Z0-9_-]").repeat(1).as(:named_key)
|
17
34
|
end
|
18
35
|
|
19
36
|
def named_attribute
|
20
|
-
(
|
21
|
-
str(
|
22
|
-
|
23
|
-
|
24
|
-
|
37
|
+
(named_key >>
|
38
|
+
str(" ").maybe >> str("=") >> str(" ").maybe >>
|
39
|
+
named_value >>
|
40
|
+
str(" ").maybe
|
41
|
+
).as(:named)
|
25
42
|
end
|
26
43
|
|
27
44
|
def positional_attribute
|
28
|
-
(match['a-zA-Z0-9_
|
45
|
+
(match['a-zA-Z0-9_\-%.'].repeat(1) >>
|
29
46
|
str("=").absent?
|
30
|
-
|
47
|
+
).as(:positional)
|
31
48
|
end
|
32
49
|
|
33
50
|
def named_many
|
34
|
-
(named_attribute.repeat(1,1) >>
|
51
|
+
(named_attribute.repeat(1, 1) >>
|
35
52
|
(str(",") >> space.maybe >> named_attribute).repeat(0))
|
36
53
|
end
|
37
54
|
|
38
55
|
def positional_one_named_many
|
39
|
-
(positional_attribute.repeat(1,1) >>
|
56
|
+
(positional_attribute.repeat(1, 1) >>
|
40
57
|
(str(",") >> space.maybe >> named_attribute).repeat(1))
|
41
58
|
end
|
42
59
|
|
43
60
|
def positional_many_named_many
|
44
|
-
(positional_attribute.repeat(1,1) >>
|
61
|
+
(positional_attribute.repeat(1, 1) >>
|
45
62
|
(str(",") >> space.maybe >> positional_attribute).repeat(1) >>
|
46
|
-
(str(",") >> space.maybe>> named_attribute).repeat(1))
|
63
|
+
(str(",") >> space.maybe >> named_attribute).repeat(1))
|
47
64
|
end
|
48
65
|
|
49
66
|
def positional_many
|
50
|
-
(positional_attribute.repeat(1,1) >>
|
67
|
+
(positional_attribute.repeat(1, 1) >>
|
51
68
|
(str(",") >> space.maybe >> positional_attribute).repeat(0))
|
52
69
|
end
|
53
70
|
|
54
71
|
def positional_zero_or_one
|
55
|
-
positional_attribute.repeat(0,1)
|
72
|
+
positional_attribute.repeat(0, 1)
|
56
73
|
end
|
57
74
|
|
58
75
|
def attribute_list(name = :attribute_list)
|
59
|
-
str(
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
76
|
+
str("[").present? >>
|
77
|
+
str("[") >> str("[").absent? >>
|
78
|
+
(named_many |
|
79
|
+
positional_one_named_many |
|
80
|
+
positional_many_named_many |
|
81
|
+
positional_many |
|
82
|
+
positional_zero_or_one
|
83
|
+
).as(:attribute_array).as(name) >>
|
84
|
+
str("]")
|
68
85
|
end
|
69
|
-
|
70
86
|
end
|
71
87
|
end
|
72
88
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require "parslet"
|
2
2
|
require "parslet/convenience"
|
3
3
|
|
4
|
-
|
5
4
|
require_relative "admonition"
|
6
5
|
require_relative "attribute_list"
|
7
6
|
require_relative "bibliography"
|
@@ -39,7 +38,7 @@ module Coradoc
|
|
39
38
|
include Coradoc::Parser::Asciidoc::Text
|
40
39
|
|
41
40
|
def rule_dispatch(rule_name, *args, **kwargs)
|
42
|
-
@dispatch_data
|
41
|
+
@dispatch_data ||= {}
|
43
42
|
dispatch_key = [rule_name, args, kwargs.to_a.sort]
|
44
43
|
dispatch_hash = dispatch_key.hash.abs
|
45
44
|
unless @dispatch_data.has_key?(dispatch_hash)
|
@@ -58,9 +57,9 @@ module Coradoc
|
|
58
57
|
add_dispatch = true
|
59
58
|
with_params = true
|
60
59
|
|
61
|
-
parser_methods = (Coradoc::Parser::Asciidoc.constants - [:Base]).map
|
60
|
+
parser_methods = (Coradoc::Parser::Asciidoc.constants - [:Base]).map do |const|
|
62
61
|
Coradoc::Parser::Asciidoc.const_get(const).instance_methods
|
63
|
-
|
62
|
+
end.flatten.uniq
|
64
63
|
|
65
64
|
parser_methods.each do |rule_name|
|
66
65
|
params = Coradoc::Parser::Asciidoc::Base.instance_method(rule_name).parameters
|
@@ -79,11 +78,9 @@ module Coradoc
|
|
79
78
|
define_method(rule_name) do |*args, **kwargs|
|
80
79
|
rule_dispatch(alias_name, *args, **kwargs)
|
81
80
|
end
|
82
|
-
|
83
81
|
end
|
84
82
|
end
|
85
83
|
end
|
86
|
-
|
87
84
|
end
|
88
85
|
end
|
89
86
|
end
|
@@ -2,9 +2,8 @@ module Coradoc
|
|
2
2
|
module Parser
|
3
3
|
module Asciidoc
|
4
4
|
module Bibliography
|
5
|
-
|
6
5
|
def bibliography
|
7
|
-
(
|
6
|
+
(element_id.maybe >>
|
8
7
|
str("[bibliography]\n") >>
|
9
8
|
str("== ") >> match("[^\n]").repeat(1).as(:title) >> str("\n") >>
|
10
9
|
bib_entry.repeat(1).as(:entries)
|
@@ -12,13 +11,13 @@ module Coradoc
|
|
12
11
|
end
|
13
12
|
|
14
13
|
def bib_entry
|
15
|
-
(match("^*") >> str(
|
14
|
+
(match("^*") >> str(" [[[") >>
|
16
15
|
match('[^,\[\]\n]').repeat(1).as(:anchor_name) >>
|
17
|
-
(
|
16
|
+
(str(",") >>
|
18
17
|
match('[^\]\n]').repeat(1).as(:document_id)
|
19
|
-
|
18
|
+
).maybe >>
|
20
19
|
str("]]]") >>
|
21
|
-
(text_line.repeat(0,1) >>
|
20
|
+
(text_line.repeat(0, 1) >>
|
22
21
|
text_line.repeat(0)
|
23
22
|
).as(:ref_text).maybe >>
|
24
23
|
line_ending.repeat(1).as(:line_break).maybe
|
@@ -2,7 +2,6 @@ module Coradoc
|
|
2
2
|
module Parser
|
3
3
|
module Asciidoc
|
4
4
|
module Block
|
5
|
-
|
6
5
|
def block(n_deep = 3)
|
7
6
|
(example_block(n_deep) |
|
8
7
|
sidebar_block(n_deep) |
|
@@ -32,20 +31,13 @@ module Coradoc
|
|
32
31
|
end
|
33
32
|
|
34
33
|
def block_title
|
35
|
-
str(
|
34
|
+
str(".") >> space.absent? >> text.as(:title) >> newline
|
36
35
|
end
|
37
36
|
|
38
37
|
def block_type(type)
|
39
|
-
(str("[") >> str("[").absent? >>
|
38
|
+
(line_start? >> str("[") >> str("[").absent? >>
|
40
39
|
str(type).as(:type) >>
|
41
|
-
str("]")) |
|
42
|
-
(match('^\[') >> keyword.as(:type) >> str("]")) >> newline
|
43
|
-
end
|
44
|
-
|
45
|
-
def block_id
|
46
|
-
line_start? >>
|
47
|
-
(str("[[") >> str('[').absent? >> keyword.as(:id) >> str("]]") |
|
48
|
-
str("[#") >> keyword.as(:id) >> str("]")) >> newline
|
40
|
+
str("]")) >> newline # |
|
49
41
|
end
|
50
42
|
|
51
43
|
def block_content(n_deep = 3)
|
@@ -53,42 +45,49 @@ module Coradoc
|
|
53
45
|
list |
|
54
46
|
text_line |
|
55
47
|
empty_line.as(:line_break)
|
56
|
-
c = c | block(n_deep - 1) if
|
48
|
+
c = c | block(n_deep - 1) if n_deep.positive?
|
57
49
|
c.repeat(1)
|
58
50
|
end
|
59
51
|
|
60
52
|
def block_delimiter
|
61
|
-
line_start? >>
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
53
|
+
line_start? >>
|
54
|
+
((str("*") |
|
55
|
+
str("=") |
|
56
|
+
str("_") |
|
57
|
+
str("+") |
|
58
|
+
str("-")).repeat(4) |
|
59
|
+
str("-").repeat(2, 2)) >>
|
68
60
|
newline
|
69
61
|
end
|
70
62
|
|
71
|
-
def
|
72
|
-
block_title.maybe >>
|
73
|
-
block_id.maybe >>
|
74
|
-
(attribute_list >> newline ).maybe >>
|
63
|
+
def element_attributes
|
75
64
|
block_title.maybe >>
|
65
|
+
element_id.maybe >>
|
66
|
+
(attribute_list >> newline).maybe >>
|
67
|
+
block_title.maybe >>
|
76
68
|
newline.maybe >>
|
77
|
-
(
|
78
|
-
|
79
|
-
|
69
|
+
(attribute_list >> newline).maybe >>
|
70
|
+
element_id.maybe
|
71
|
+
end
|
72
|
+
|
73
|
+
def block_style(n_deep = 3, delimiter = "*", repeater = 4, type = nil)
|
74
|
+
current_delimiter = str(delimiter).repeat(repeater).capture(:delimit)
|
75
|
+
closing_delimiter = dynamic do |_s, c|
|
76
|
+
str(c.captures[:delimit].to_s.strip)
|
77
|
+
end
|
78
|
+
|
79
|
+
element_attributes >>
|
80
|
+
(line_start? >> attribute_list >> newline).maybe >>
|
80
81
|
line_start? >>
|
81
|
-
|
82
|
+
current_delimiter.as(:delimiter) >> newline >>
|
82
83
|
if type == :pass
|
83
84
|
(text_line | empty_line.as(:line_break)).repeat(1).as(:lines)
|
84
85
|
else
|
85
|
-
|
86
|
+
(closing_delimiter >> newline).absent? >> block_content(n_deep - 1).as(:lines)
|
86
87
|
end >>
|
87
88
|
line_start? >>
|
88
|
-
|
89
|
-
# str(delimiter).repeat(repeater) >> str(delimiter).absent? >> newline
|
89
|
+
closing_delimiter >> newline
|
90
90
|
end
|
91
|
-
|
92
91
|
end
|
93
92
|
end
|
94
93
|
end
|
@@ -3,44 +3,26 @@ module Coradoc
|
|
3
3
|
module Asciidoc
|
4
4
|
module Citation
|
5
5
|
def xref_anchor
|
6
|
-
match(
|
6
|
+
match("[^,>]").repeat(1).as(:href_arg).repeat(1, 1)
|
7
7
|
end
|
8
8
|
|
9
9
|
def xref_str
|
10
|
-
match(
|
10
|
+
match("[^,>]").repeat(1).as(:text)
|
11
11
|
end
|
12
12
|
|
13
13
|
def xref_arg
|
14
|
-
(str(
|
15
|
-
|
16
|
-
|
14
|
+
(str("section") | str("paragraph") | str("clause") | str("annex") | str("table")).as(:key) >>
|
15
|
+
match("[ =]").as(:delimiter) >>
|
16
|
+
match("[^,>=]").repeat(1).as(:value)
|
17
17
|
end
|
18
18
|
|
19
19
|
def cross_reference
|
20
|
-
str(
|
21
|
-
(
|
22
|
-
(str(
|
23
|
-
|
24
|
-
str(
|
25
|
-
|
26
|
-
|
27
|
-
def citation_xref
|
28
|
-
cross_reference.as(:cross_reference) >> newline |
|
29
|
-
cross_reference.as(:cross_reference) >>
|
30
|
-
(text_line.repeat(1)
|
31
|
-
).as(:comment).maybe
|
32
|
-
end
|
33
|
-
|
34
|
-
def citation_noxref
|
35
|
-
(text_line.repeat(1)
|
36
|
-
).as(:comment)
|
37
|
-
end
|
38
|
-
|
39
|
-
def citation
|
40
|
-
match('^[\[]') >> str(".source]\n") >>
|
41
|
-
( citation_xref |
|
42
|
-
citation_noxref
|
43
|
-
).as(:citation)
|
20
|
+
(str("<<") >> xref_anchor >>
|
21
|
+
((str(",") >> xref_arg).repeat(1) |
|
22
|
+
(str(",") >> xref_str).repeat(1)
|
23
|
+
).maybe >>
|
24
|
+
str(">>")
|
25
|
+
).as(:cross_reference)
|
44
26
|
end
|
45
27
|
end
|
46
28
|
end
|
@@ -2,20 +2,6 @@ module Coradoc
|
|
2
2
|
module Parser
|
3
3
|
module Asciidoc
|
4
4
|
module Content
|
5
|
-
|
6
|
-
def highlight
|
7
|
-
text_id >> newline >>
|
8
|
-
underline >> highlight_text >> newline
|
9
|
-
end
|
10
|
-
|
11
|
-
def underline
|
12
|
-
str("[underline]") | str("[.underline]")
|
13
|
-
end
|
14
|
-
|
15
|
-
def highlight_text
|
16
|
-
str("#") >> words.as(:text) >> str("#")
|
17
|
-
end
|
18
|
-
|
19
5
|
def literal_space
|
20
6
|
(match[" "] | match[' \t']).repeat(1)
|
21
7
|
end
|
@@ -26,24 +12,22 @@ module Coradoc
|
|
26
12
|
end
|
27
13
|
|
28
14
|
def list_prefix
|
29
|
-
(line_start? >>
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
(line_start? >> match('^[=]') >> str('=').repeat(0) >> match('[^\n]'))
|
15
|
+
(line_start? >>
|
16
|
+
(match("^[*]") >> str("*").repeat(1, 5) |
|
17
|
+
match('^[\.]') >> str(".").repeat(1, 5)) >>
|
18
|
+
str(" "))
|
34
19
|
end
|
35
20
|
|
36
21
|
# Text
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
22
|
+
# :zero :one :many
|
23
|
+
def text_line(many_breaks = false)
|
24
|
+
tl = (asciidoc_char_with_id.absent? | element_id_inline) >>
|
25
|
+
literal_space? >> text_any.as(:text)
|
26
|
+
if many_breaks
|
27
|
+
tl >> (line_ending.repeat(1).as(:line_break) | eof?)
|
28
|
+
else
|
29
|
+
tl >> (line_ending.as(:line_break) | eof?)
|
30
|
+
end
|
47
31
|
end
|
48
32
|
|
49
33
|
def asciidoc_char
|
@@ -51,11 +35,18 @@ module Coradoc
|
|
51
35
|
end
|
52
36
|
|
53
37
|
def asciidoc_char_with_id
|
54
|
-
asciidoc_char | str(
|
38
|
+
asciidoc_char | str("[#") | str("[[")
|
55
39
|
end
|
56
40
|
|
57
|
-
def
|
58
|
-
|
41
|
+
def element_id
|
42
|
+
line_start? >>
|
43
|
+
(str("[[") >> keyword.as(:id) >> str("]]") |
|
44
|
+
str("[#") >> keyword.as(:id) >> str("]")
|
45
|
+
) >> newline
|
46
|
+
end
|
47
|
+
|
48
|
+
def element_id_inline
|
49
|
+
str("[[") >> keyword.as(:id) >> str("]]") |
|
59
50
|
str("[#") >> keyword.as(:id) >> str("]")
|
60
51
|
end
|
61
52
|
|
@@ -67,7 +58,6 @@ module Coradoc
|
|
67
58
|
def glossaries
|
68
59
|
glossary.repeat(1)
|
69
60
|
end
|
70
|
-
|
71
61
|
end
|
72
62
|
end
|
73
63
|
end
|
@@ -2,7 +2,6 @@ module Coradoc
|
|
2
2
|
module Parser
|
3
3
|
module Asciidoc
|
4
4
|
module DocumentAttributes
|
5
|
-
|
6
5
|
def attribute_name
|
7
6
|
match("[a-zA-Z0-9_-]").repeat(1)
|
8
7
|
end
|
@@ -12,8 +11,8 @@ module Coradoc
|
|
12
11
|
end
|
13
12
|
|
14
13
|
def document_attributes
|
15
|
-
|
16
|
-
|
14
|
+
document_attribute.repeat(1)
|
15
|
+
.as(:document_attributes)
|
17
16
|
end
|
18
17
|
|
19
18
|
def document_attribute
|
@@ -2,7 +2,6 @@ module Coradoc
|
|
2
2
|
module Parser
|
3
3
|
module Asciidoc
|
4
4
|
module Header
|
5
|
-
|
6
5
|
def header
|
7
6
|
header_title >>
|
8
7
|
author.maybe.as(:author) >>
|
@@ -10,7 +9,7 @@ module Coradoc
|
|
10
9
|
end
|
11
10
|
|
12
11
|
def header_title
|
13
|
-
match("^=") >> str(
|
12
|
+
match("^=") >> str("=").absent? >> space? >> text.as(:title) >> newline
|
14
13
|
end
|
15
14
|
|
16
15
|
def author
|