Skip to content

Various fixes for passthroughs and substitutions#378

Merged
nlopes merged 5 commits intomainfrom
nlopes-passthroughs-substitutions
Mar 10, 2026
Merged

Various fixes for passthroughs and substitutions#378
nlopes merged 5 commits intomainfrom
nlopes-passthroughs-substitutions

Conversation

@nlopes
Copy link
Owner

@nlopes nlopes commented Mar 9, 2026

Best reviewed commit by commit.

nlopes and others added 5 commits March 9, 2026 12:22
Thread `macros_enabled` from `BlockParsingMetadata` through
`preprocess_inline_content` to `InlinePreprocessorParserState`.
When macros are disabled, `pass:[]` macros and inline passthrough
syntax (`+...+`, `++...++`, `+++...+++`) now return raw text
instead of extracting passthrough content, matching asciidoctor.

Closes SC-184

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a block has an explicit subs= list without 'attributes' (e.g.,
subs=specialchars), the inline preprocessor now leaves {attribute}
references unexpanded, matching asciidoctor behavior.

Mirrors the macros_enabled pattern from SC-184: adds attributes_enabled
flag threaded from BlockParsingMetadata through to the inline
preprocessor, gating the attribute_reference rule.

Closes SC-185

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When subs=-macros is set, pass:[] macros are treated as literal text.
However, if the macro's sub-spec includes attributes (a or n), we now
expand attribute references in the content before returning the literal
text, matching asciidoctor behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Collapse duplicated cfg! blocks for macros/attributes into a single tuple
- Extract shared pass macro parsing into parse_pass_macro_parts helper
- Add new_all_enabled constructor to eliminate bare true, true args
- Fix double format! allocation in triple_plus_passthrough disabled path
- Fix .len() vs .chars().count() inconsistency in source map replacement

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Passthrough blocks (+++) with a subs= attribute now apply the
specified substitutions to content instead of emitting it raw.

Extracts raw text from RawText nodes, applies attribute substitution
when enabled, then routes through quote parsing or plain text rendering
based on the effective subs list. Uses empty baseline for passthrough
blocks (matching asciidoctor's default of no subs for pass blocks).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@nlopes nlopes merged commit b0f1eb8 into main Mar 10, 2026
12 checks passed
@nlopes nlopes deleted the nlopes-passthroughs-substitutions branch March 10, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant