Skip to content

fix: preserve transcluded media paths in Markdown - #2339

Open
w3lld1 wants to merge 2 commits into
moinwiki:masterfrom
w3lld1:fix/markdown-media-paths
Open

fix: preserve transcluded media paths in Markdown#2339
w3lld1 wants to merge 2 commits into
moinwiki:masterfrom
w3lld1:fix/markdown-media-paths

Conversation

@w3lld1

@w3lld1 w3lld1 commented Jul 19, 2026

Copy link
Copy Markdown

Summary

  • I preserve the source item path when an expanded media transclusion points at a revisioned +get URL.
  • I remove the generated do=show query and leading slash before writing editable Markdown.
  • I added regression coverage for both audio and video transclusions.

Testing

  • pytest -q src/moin/converters/_tests/test_markdown_out.py src/moin/converters/_tests/test_markdown_in_out.py (141 passed)
  • pytest -q with the virtual environment on PATH (2031 passed, 17 skipped, 1 xpassed)
  • ruff check src/moin/converters/markdown_out.py src/moin/converters/_tests/test_markdown_out.py
  • black --check src/moin/converters/markdown_out.py src/moin/converters/_tests/test_markdown_out.py
  • git diff --check upstream/master...HEAD

Fixes #1298

@UlrichB22 UlrichB22 self-assigned this Jul 20, 2026
@UlrichB22

Copy link
Copy Markdown
Collaborator

The fix still generates a wrong URL in the example mentioned in #2310:

![Your Browser does not support HTML5 audio/video element.](audio.mp3){: page-href="wiki:///help-common/audio.mp3" lang="en" dir="ltr" data-href="/help-common/audio.mp3" class="moin-transclusion"}

The expected markdown is
![audio.mp3](help-common/audio.mp3){: page-href="wiki:///help-common/audio.mp3" lang="en" dir="ltr" data-href="/help-common/audio.mp3" class="moin-transclusion"}

@w3lld1

w3lld1 commented Jul 22, 2026

Copy link
Copy Markdown
Author

Thanks for the concrete example. I pushed 9b500dd5, which now prefers data-href for expanded transclusions even when an xinclude:href is present, and uses the source filename instead of the browser fallback text for expanded audio/video objects.

I added a regression case matching the reported audio shape. Fresh checks on the pushed commit:

  • focused Markdown converter suite: 71 passed
  • Ruff check on the changed files
  • git diff --check

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.

Converting markdown png to moinwiki fails

2 participants