Skip to content

Fix bare ALD references being left as literal text#8

Closed
PiotrCzapla wants to merge 1 commit into
mainfrom
claude/dreamy-swirles-83fd30
Closed

Fix bare ALD references being left as literal text#8
PiotrCzapla wants to merge 1 commit into
mainfrom
claude/dreamy-swirles-83fd30

Conversation

@PiotrCzapla

@PiotrCzapla PiotrCzapla commented Jul 5, 2026

Copy link
Copy Markdown

What changed

Named attribute-list references used alone in an IAL will resolve after this pr.

This wasn't working previously:

{:note: #id .class}

Some text
{:note}

but this was fine

{:note: #id .class}

Some text
{:note .some-class}

Fix:
looks_like_attrs in src/attrs.rs gates whether a trailing {...} is treated as an attribute list, it recognizes it only if it containing #, ., or =, so pure note {:note} was ignored.

{:note: #id .class} definitions were recognized, but a block or span
IAL consisting solely of the reference name ({:note} or {: note}) was
rejected by the looks_like_attrs gate, which only accepted bodies
containing '#', '.', or '='. Pass the ALD definitions map into the
gate so a token naming a defined attribute list also qualifies.
Undefined names still stay literal.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@PiotrCzapla PiotrCzapla requested a review from jph00 July 5, 2026 21:59
@jph00

jph00 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Thanks for the report and fix. looks_like_attrs was the right diagnosis. I ended up changing the rule instead of widening it: a braced group is an attribute list only when it starts with :, #, ., or a key=value pair. The colon form is always an attribute list, so {:note} and {: note} now resolve. Bare words like {note} stay literal even when defined, so an ALD name collision can't eat braced prose ({great note} would have silently dropped great). I modified your tests a bit based on these changes.
See #11

@jph00 jph00 closed this Jul 6, 2026
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.

2 participants