Skip to content

xwiki writer produces wrong internal links #10711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
k-jell opened this issue Mar 20, 2025 · 4 comments
Open

xwiki writer produces wrong internal links #10711

k-jell opened this issue Mar 20, 2025 · 4 comments
Labels

Comments

@k-jell
Copy link

k-jell commented Mar 20, 2025

Explain the problem.

The xwiki writer produces internal links that have the wrong format: [[Some other place>>/abc/def/xyz]]. The correct syntax would be: [[Some other place>>abc.def.xyz]] as can be seen here.

The commands used were:
pandoc --from html --to xwiki --no-highlight
pandoc --from dokuwiki --to xwiki --no-highlight
in the online editor.

The way the conversion works right now leads to broken links in xwiki:

Image

Clicking the link will bring up the dialog to create a new file at the wrong location:

Image

Some lua filter can be used to hack around this:

function Link(el)
    local target = el.target

    if target:match("^https?://") then
        return el
    end

    target = target:gsub("^/", "")
    target = target:gsub("/", ".")

    return pandoc.Link(el.content, target)
end

But maybe it would be a good idea to fix this here:

_ -> return $ "[[" <> label <> ">>" <> src <> "]]" <> genAnchor id'

Pandoc version?
pandoc version 3.6.4 in the online try pandoc tool and pandoc 3.1.12.1 both show the described behaviour

@k-jell k-jell added the bug label Mar 20, 2025
@jgm
Copy link
Owner

jgm commented Mar 22, 2025

What's the input you are using to generate this xwiki output?

@k-jell
Copy link
Author

k-jell commented Mar 23, 2025

What's the input you are using to generate this xwiki output?

it's this for dokuwiki -> xwiki: [[abc:def:xyz|Some other place]]
and this for html -> xwiki: <p><a href="/abc/def/xyz">Some other place</a></p>

@jgm
Copy link
Owner

jgm commented Mar 23, 2025

href="/abc/def/xyz" might not point to an internal wiki page. It could point to anything on the same server....

@k-jell
Copy link
Author

k-jell commented Mar 23, 2025

The html comes from a wiki.js page. Apparently this is the only representation of an internal link that wiki.js uses:
https://docs.requarks.io/en/editors/markdown#links

But I understand. It's not possible to know that for the conversion. Still for the dokuwiki case it should always produce an internal link, shouldn't it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants