Skip to content

XRENDERING-766: Macros followed by an empty block with parameters gets wrapped in a span when converted to annotated html - #404

Open
michitux wants to merge 3 commits into
xwiki:masterfrom
michitux:XRENDERING-766
Open

XRENDERING-766: Macros followed by an empty block with parameters gets wrapped in a span when converted to annotated html#404
michitux wants to merge 3 commits into
xwiki:masterfrom
michitux:XRENDERING-766

Conversation

@michitux

Copy link
Copy Markdown
Contributor

Jira URL

Changes

Description

  • Properly discard macro syntax after a macro or verbatim block
  • Don't wrap a macro or verbatim inside the format that follows it

Clarifications

  • This is not actually fixing the original issue, but the problem the issue is about is also not actually an empty format, but a non-empty one (containing a space)
  • See https://forum.xwiki.org/t/fixing-format-syntax-after-macro-and-verbatim-syntax/18686 for the related forum discussion.
  • It turns out to be absolutely non-trivial to really keep all empty format, in particular with HTML and wiki syntax going through the same code but having completely different initial information, I think this needs a deeper change and a lot of thought how to treat different syntax combinations which is why I think removing/ignoring the format is the more consistent option for now.

Screenshots & Video

No direct UI changes.

Executed Tests

Built the whole xwiki-rendering project.

Expected merging strategy

  • Prefers squash: Yes
  • Backport on branches:
    • Would be nice but dangerous, not sure.

michitux and others added 3 commits July 20, 2026 15:20
…s wrapped in a span when converted to annotated html

* Add several failing test cases.
* Attempt fixing some of the identified issues - but it's far from complete.
…s wrapped in a span when converted to annotated html

* Keep empty syntax at the end of a block when the only other block content is a verbatim or macro syntax.
* Add a test for the original scenario of the issue.
* Adapt the paragraph test to expect the removal of the empty format.
* Add some currently failing XHTML roundtrip tests for the empty format.

Note: the behavior should probably be changed again, waiting for answers on forum proposal.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…s wrapped in a span when converted to annotated html

* Implement a less breaking option: continue discarding empty format at the end of blocks, still fix:
  * Format wrongly wraps the macro before it.
  * Empty format wraps the following paragraph

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@michitux michitux self-assigned this Aug 13, 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.

1 participant