coradoc-adoc 2.0.26 → 2.0.27
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ac328212768fb69c29726e260db2af252ebb60fff81682bb7eed8ad9984bee1a
|
|
4
|
+
data.tar.gz: 4b5af72762fcbf96fe40594cd4b849e328b2fe03cc027aa37e08435869656c1c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 26ad434a7f144350750011ccca8a932c193ed9687c001080ce6549edcbdb1c16f2d072eb3d62dd0fa825eb744707beae7cb24be4876e03ac1054b2dffa2eaecf
|
|
7
|
+
data.tar.gz: bf54821072c38fc983b68be86fca0d0cd46b6358b6b2239d84697cff44aadf3ab4cc5cc88a03760b29d78929568c874367a90cb9ad9c0d3c6405fa512795ea05
|
|
@@ -3,19 +3,29 @@
|
|
|
3
3
|
module Coradoc
|
|
4
4
|
module AsciiDoc
|
|
5
5
|
module Parser
|
|
6
|
-
# Single Responsibility: parse the optional header that precedes a
|
|
6
|
+
# Single Responsibility: parse the optional header that precedes a
|
|
7
|
+
# structural element (block or section).
|
|
7
8
|
#
|
|
8
|
-
# Encapsulates the canonical AsciiDoc
|
|
9
|
-
# (DRY, MECE, single source of truth).
|
|
10
|
-
#
|
|
11
|
-
# its own header rule with subtly different slot orderings — and several
|
|
12
|
-
# of them captured the same Parslet key more than once in a single
|
|
13
|
-
# sequence, which triggered Parslet's "Duplicate subtrees while merging
|
|
14
|
-
# result" warning and silently discarded one of the captured values.
|
|
9
|
+
# Encapsulates the canonical AsciiDoc header grammar in one place
|
|
10
|
+
# (DRY, MECE, single source of truth). Two flavours live here because
|
|
11
|
+
# blocks and sections have different header grammars:
|
|
15
12
|
#
|
|
16
|
-
#
|
|
13
|
+
# block_header = block_title? >> element_id? >> attribute_blocks?
|
|
14
|
+
# section_header = element_id? >> attribute_blocks?
|
|
17
15
|
#
|
|
18
|
-
#
|
|
16
|
+
# Asciidoctor does NOT permit `.Title` to apply to a section — sections
|
|
17
|
+
# accept `[role]` attribute lists and `[[id]]` anchors but not block
|
|
18
|
+
# titles. The section's heading IS its title. Mixing the two shapes
|
|
19
|
+
# into one rule caused `section_block` to admit `.Foo` lines that
|
|
20
|
+
# collided with `section_title`'s `:title` capture, triggering
|
|
21
|
+
# Parslet's "Duplicate subtrees while merging result … (keys:
|
|
22
|
+
# [:title])" warning and silently dropping the block title.
|
|
23
|
+
#
|
|
24
|
+
# Before this module existed, every block-like rule inlined its own
|
|
25
|
+
# header rule with subtly different slot orderings — and several
|
|
26
|
+
# captured the same Parslet key more than once in a single sequence,
|
|
27
|
+
# which triggered Parslet's "Duplicate subtrees" warning and silently
|
|
28
|
+
# discarded one of the captured values.
|
|
19
29
|
#
|
|
20
30
|
# `attribute_blocks` accepts one or more consecutive `[...]` attribute
|
|
21
31
|
# lists, captured as a Parslet sequence under the :attribute_list key.
|
|
@@ -31,8 +41,11 @@ module Coradoc
|
|
|
31
41
|
# every attribute and lets the transformer merge them into a single
|
|
32
42
|
# Coradoc::AsciiDoc::Model::AttributeList downstream.
|
|
33
43
|
module BlockHeader
|
|
34
|
-
# Canonical block header rule.
|
|
35
|
-
#
|
|
44
|
+
# Canonical block header rule. Includes the block title — every
|
|
45
|
+
# real block (delimited block, table, paragraph, image) accepts
|
|
46
|
+
# an optional `.Title` line before its body. Single canonical
|
|
47
|
+
# order; each of title, id, and attribute_blocks is optional and
|
|
48
|
+
# matched at most once.
|
|
36
49
|
# @return [Parslet::Atoms::Base]
|
|
37
50
|
def block_header
|
|
38
51
|
block_title.maybe >>
|
|
@@ -40,6 +53,16 @@ module Coradoc
|
|
|
40
53
|
attribute_blocks.maybe
|
|
41
54
|
end
|
|
42
55
|
|
|
56
|
+
# Section header rule. Asciidoctor does not permit `.Title` on
|
|
57
|
+
# sections — the section heading itself is the title. Sections
|
|
58
|
+
# still accept the same element_id and attribute_blocks slots
|
|
59
|
+
# that blocks do (`[[anchor]]`, `[appendix]`, `[role=x]`, etc.).
|
|
60
|
+
# @return [Parslet::Atoms::Base]
|
|
61
|
+
def section_header
|
|
62
|
+
element_id.maybe >>
|
|
63
|
+
attribute_blocks.maybe
|
|
64
|
+
end
|
|
65
|
+
|
|
43
66
|
# One or more consecutive attribute_list + newline sequences, captured
|
|
44
67
|
# as a Parslet sequence under :attribute_list. When multiple `[...]`
|
|
45
68
|
# blocks precede a delimiter, all of them reach the transformer; when
|