Skip to content

fix: don't drop attribute_definitions on self-closed SPEC-*-TYPE unparse#215

Merged
stanislaw merged 1 commit into
strictdoc-project:mainfrom
fNBU:fix/spec-types-self-closed-unparse
May 7, 2026
Merged

fix: don't drop attribute_definitions on self-closed SPEC-*-TYPE unparse#215
stanislaw merged 1 commit into
strictdoc-project:mainfrom
fNBU:fix/spec-types-self-closed-unparse

Conversation

@fNBU
Copy link
Copy Markdown
Contributor

@fNBU fNBU commented May 7, 2026

Symmetric to #214's parse-side fix. When a SPEC-RELATION-TYPE / RELATION-GROUP-TYPE / SPECIFICATION-TYPE IR object has is_self_closed=True but also carries attribute_definitions, the unparser's if is_self_closed: return "/>\n" short-circuit fires before the <SPEC-ATTRIBUTES> block emits, silently dropping the attributes.

Fix: gate the shortcut on the absence of attributes in all three unparsers. Should merge after #214.

@fNBU
Copy link
Copy Markdown
Contributor Author

fNBU commented May 7, 2026

@stanislaw contradicting my earlier statement, it would be good to get a release once this PR and #214 are on main.

@stanislaw
Copy link
Copy Markdown
Contributor

Hey @fNBU, I have merged the #214 and reviewing this one now. Moving forward, could I ask you to always rebase your branches on top of latest main, not merge the latest main? Also, please squash the related commits to just one per branch for these small changes, i.e.,

instead of git merge main or git merge origin/main, please do git fetch origin && git rebase origin/main --interfactive.

Bug C: when a SPEC-RELATION-TYPE / RELATION-GROUP-TYPE / SPECIFICATION-TYPE
is parsed from a self-closed source tag (or constructed with
is_self_closed=True) and then mutated to add attribute_definitions, the
unparse path's `if is_self_closed: return output + '/>\n'` short-circuit
fires before the SPEC-ATTRIBUTES block is emitted. Any attribute_definitions
on the IR object are silently dropped.

Fix: gate the self-closed shortcut on the absence of attributes. When
the IR has attributes to emit, force the open form regardless of how the
original source was shaped.

Symmetric to PR strictdoc-project#214's parse-side fix; the unparse-side shortcut was not
addressed there.
@fNBU fNBU force-pushed the fix/spec-types-self-closed-unparse branch from 75df2e0 to 2285999 Compare May 7, 2026 20:19
@fNBU
Copy link
Copy Markdown
Contributor Author

fNBU commented May 7, 2026

Sure, my bad. I also fixed up this branch.

@stanislaw stanislaw changed the title Fix/spec types self closed unparse fix: don't drop attribute_definitions on self-closed SPEC-*-TYPE unparse May 7, 2026
@stanislaw
Copy link
Copy Markdown
Contributor

Thanks!

@stanislaw stanislaw merged commit 542b51a into strictdoc-project:main May 7, 2026
9 checks passed
@stanislaw
Copy link
Copy Markdown
Contributor

@stanislaw contradicting my earlier statement, it would be good to get a release once this PR and #214 are on main.

I will release this tomorrow or on Saturday.

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