Skip to content
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

mediawiki output corrupting links with same name #1825

Closed
KevinOConnor opened this issue Dec 18, 2014 · 3 comments
Closed

mediawiki output corrupting links with same name #1825

KevinOConnor opened this issue Dec 18, 2014 · 3 comments

Comments

@KevinOConnor
Copy link

If I translate the following text from markdown to mediawiki: try this text

I get the following translation: try this text

I expected to receive: try [[this]] text or: try [[this|this]] text

Note, that if I translate: try this text then I do receive a proper translation of: try [[that|this]] text

This is reproducible with the online pandoc processor at http://johnmacfarlane.net/pandoc/try/

@mpickering
Copy link
Collaborator

This appears to be intentional from the source.. This was introduced in 8c48bd8

inlineToMediaWiki (Link txt (src, _)) = do
  label <- inlineListToMediaWiki txt 
  case txt of
     [Str s] | escapeURI s == src -> return src 
     _  -> return $ if isURI src 
              then "[" ++ src ++ " " ++ label ++ "]" 
              else "[[" ++ src' ++ "|" ++ label ++ "]]"
                     where src' = case src of
                                     '/':xs -> xs  -- with leading / it's a
                                     _      -> src -- link to a help page

@KevinOConnor
Copy link
Author

It's definitely not correct. One can see this by translating the following from mediawiki to markdown and then from markdown back to mediawiki: try [[this]] text

The intermiediate markdown text properly contains the link, for example: try [this](this "wikilink") text but the final mediawiki syntax completely loses the link and the content reverts to just plain text.

My guess is that return src was meant to be return "[[" ++ src ++ "]]"

@jgm
Copy link
Owner

jgm commented Dec 19, 2014

The author's intent was to render autolinks (links whose link text == the URL) as bare URLs.
What the author left out was a test to see if the string is an absolute URL. I can fix this easily.

@jgm jgm closed this as completed in 005eda2 Dec 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants