Skip to content

Fix layer detection regex to handle any XML attribute order - #6

Open
its-luca wants to merge 1 commit into
mainfrom
fix/layer-regex-attribute-order
Open

Fix layer detection regex to handle any XML attribute order#6
its-luca wants to merge 1 commit into
mainfrom
fix/layer-regex-attribute-order

Conversation

@its-luca

@its-luca its-luca commented May 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • The layer-counting regex assumed drawio writes <mxCell> attributes in the order id, value, parent, but drawio actually writes them as id, parent, value
  • This caused layer_count to always be 0 (defaulting to 1), so only a single export step was produced even for files with multiple layers
  • New regex <mxCell\b[^>]*\bparent="."[^>]*/> matches any self-closing mxCell with a single-character parent regardless of attribute order

Test plan

  • Verify files with multiple layers now produce multiple output images
  • Verify single-layer files still work
  • cargo test passes

🤖 Generated with Claude Code

The old regex required drawio's mxCell attributes in a fixed order
(id, value, parent) but drawio writes them as (id, parent, value),
causing layer_count to always be 0 and default to 1.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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