Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions acdc-parser/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Expand attributes inside `pass:a[]` content when macros disabled via `subs=-macros`,
matching asciidoctor behavior
- Fixed passthrough preprocessor bypassing `subs=-macros` gating — `pass:[]` macros and
inline passthrough syntax (`+...+`, `++...++`, `+++...+++`) are now treated as literal
text when macros are disabled, matching asciidoctor behavior
- Fixed non-monotonic inline positions for subscript/superscript text preceded by short plain text

### Added

- **`subs=macros` substitution type** — `[subs=-macros]` and explicit lists without `macros`
now gate macro grammar rules at parse time. When macros are disabled, inline macros
(links, xrefs, images, footnotes, index terms, etc.) are treated as plain text.
Requires the `pre-spec-subs` feature flag.
- **Include `indent` attribute** — `include::file.rb[indent=2]` now re-indents included content
to the specified level, matching asciidoctor behavior. Strips existing leading whitespace and
prepends the specified number of spaces. `indent=0` removes all leading whitespace.
Expand Down
2 changes: 2 additions & 0 deletions acdc-parser/fixtures/tests/subs_explicit_no_macros.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[subs=specialchars]
This has link:https://example.com[text] and macro text.
52 changes: 52 additions & 0 deletions acdc-parser/fixtures/tests/subs_explicit_no_macros.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "document",
"type": "block",
"blocks": [
{
"name": "paragraph",
"type": "block",
"inlines": [
{
"name": "text",
"type": "string",
"value": "This has link:https://example.com[text] and macro text.",
"location": [
{
"line": 2,
"col": 1
},
{
"line": 2,
"col": 55
}
]
}
],
"metadata": {
"substitutions": [
"special_chars"
]
},
"location": [
{
"line": 1,
"col": 1
},
{
"line": 2,
"col": 55
}
]
}
],
"location": [
{
"line": 1,
"col": 1
},
{
"line": 2,
"col": 55
}
]
}
2 changes: 2 additions & 0 deletions acdc-parser/fixtures/tests/subs_macros_disabled.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[subs=-macros]
This has link:https://example.com[a link] and xref:section[cross ref] and image:photo.png[alt] and footnote:[a note] and [[myanchor]]anchor and [[[bibref]]]biblio as plain text.
52 changes: 52 additions & 0 deletions acdc-parser/fixtures/tests/subs_macros_disabled.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "document",
"type": "block",
"blocks": [
{
"name": "paragraph",
"type": "block",
"inlines": [
{
"name": "text",
"type": "string",
"value": "This has link:https://example.com[a link] and xref:section[cross ref] and image:photo.png[alt] and footnote:[a note] and [[myanchor]]anchor and [[[bibref]]]biblio as plain text.",
"location": [
{
"line": 2,
"col": 1
},
{
"line": 2,
"col": 177
}
]
}
],
"metadata": {
"substitutions": [
"-macros"
]
},
"location": [
{
"line": 1,
"col": 1
},
{
"line": 2,
"col": 177
}
]
}
],
"location": [
{
"line": 1,
"col": 1
},
{
"line": 2,
"col": 177
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:version: 1.0.0

[subs=-macros]
Use pass:a[{version}] here.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "document",
"type": "block",
"attributes": {
"version": "1.0.0"
},
"blocks": [
{
"name": "paragraph",
"type": "block",
"inlines": [
{
"name": "text",
"type": "string",
"value": "Use pass:a[1.0.0] here.",
"location": [
{
"line": 4,
"col": 1
},
{
"line": 4,
"col": 27
}
]
}
],
"metadata": {
"substitutions": [
"-macros"
]
},
"location": [
{
"line": 3,
"col": 1
},
{
"line": 4,
"col": 27
}
]
}
],
"location": [
{
"line": 1,
"col": 1
},
{
"line": 4,
"col": 27
}
]
}
2 changes: 2 additions & 0 deletions acdc-parser/fixtures/tests/subs_pass_macros_disabled.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[subs=-macros]
Use pass:[<b>bold</b>] for raw HTML.
52 changes: 52 additions & 0 deletions acdc-parser/fixtures/tests/subs_pass_macros_disabled.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "document",
"type": "block",
"blocks": [
{
"name": "paragraph",
"type": "block",
"inlines": [
{
"name": "text",
"type": "string",
"value": "Use pass:[<b>bold</b>] for raw HTML.",
"location": [
{
"line": 2,
"col": 1
},
{
"line": 2,
"col": 36
}
]
}
],
"metadata": {
"substitutions": [
"-macros"
]
},
"location": [
{
"line": 1,
"col": 1
},
{
"line": 2,
"col": 36
}
]
}
],
"location": [
{
"line": 1,
"col": 1
},
{
"line": 2,
"col": 36
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:version: 1.0.0

[subs=specialchars]
The version is {version} here.
55 changes: 55 additions & 0 deletions acdc-parser/fixtures/tests/subs_specialchars_no_attributes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "document",
"type": "block",
"attributes": {
"version": "1.0.0"
},
"blocks": [
{
"name": "paragraph",
"type": "block",
"inlines": [
{
"name": "text",
"type": "string",
"value": "The version is {version} here.",
"location": [
{
"line": 4,
"col": 1
},
{
"line": 4,
"col": 30
}
]
}
],
"metadata": {
"substitutions": [
"special_chars"
]
},
"location": [
{
"line": 3,
"col": 1
},
{
"line": 4,
"col": 30
}
]
}
],
"location": [
{
"line": 1,
"col": 1
},
{
"line": 4,
"col": 30
}
]
}
Loading
Loading