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

Breakage with URLs with IP:port #164

Closed
ivilata opened this issue Jul 28, 2021 · 5 comments · Fixed by #165
Closed

Breakage with URLs with IP:port #164

ivilata opened this issue Jul 28, 2021 · 5 comments · Fixed by #165
Assignees
Labels
bug Something isn't working

Comments

@ivilata
Copy link

ivilata commented Jul 28, 2021

mdpo has issues handling some schema://ip:port/ links. For example, given this test.md:

A link to <http://127.0.0.1:8080/>.

A link to [http://127.0.0.1:8081/](http://127.0.0.1:8081/).

A link to [localhost][].

[localhost]: http://127.0.0.1:8082/

Running md2po test.md > test.po yields this (I added the translations manually, except for the fuzzy one):

#
msgid ""
msgstr ""

#: test.md:block 1 (paragraph)
msgid "A link to [http://127.0.0.1:8080/](http://127.0.0.1:8080/)."
msgstr "A0 link to [http://127.0.0.1:8080/](http://127.0.0.1:8080/)."

#: test.md:block 2 (paragraph)
msgid "A link to [http://127.0.0.1:8081/](http://127.0.0.1:8081/)."
msgstr "A1 link to [http://127.0.0.1:8081/](http://127.0.0.1:8081/)."

#: test.md:block 3 (paragraph)
msgid "A link to [localhost][localhost]."
msgstr "A2 link to [localhost][localhost]."

#: test.md:block 3 (paragraph)
#, fuzzy
msgid "[localhost]: http://127.0.0.1:8082/"
msgstr "[localhost]: http://127.0.0.1:8082/"

Then running po2md -p test.po -s /dev/stdout test.md shows:

A link to <http://127.0.0.1:8080/>.

A link to <http://127.0.0.1:8081/>.

A2 link to [localhost][localhost].

[localhost]: http://127.0.0.1:8082/

Only the link with textual tag is ok, for the other two it looks like po2md was unable to map the msgstr to some internal string which should have matched the msgstr.

Thanks a lot! 😃

@mondeja mondeja added the bug Something isn't working label Jul 28, 2021
@mondeja mondeja self-assigned this Aug 21, 2021
@mondeja
Copy link
Owner

mondeja commented Aug 30, 2021

First of all, thank you for the report. I've implemented a solution and is ready in v0.3.68 release.

Keep in mind that your example is partially unsupported by CommonMark specification, more specifically in A link to [localhost][] due to the rules of referenced link labels, I quote verbatim:

A link label begins with a left bracket ([) and ends with the first right bracket (]) that is not backslash-escaped. Between these brackets there must be at least one character that is not a space, tab, or line ending.

@ivilata
Copy link
Author

ivilata commented Feb 24, 2022

Thanks @mondeja for fixing this! And sorry for the late reply, I probably missed the notification. I checked it and it does indeed fix the issue for me.

Regarding [localhost][] syntax, thanks for the heads up, I didn't notice that CommonMark doesn't support MD's implicit link names, I'll change them to just [text]. 😄

@ivilata
Copy link
Author

ivilata commented Feb 24, 2022

@mondeja One moment, I read CommonMark link specs more carefully, and a collapsed reference link like [foo][] and a shortcut reference link like [foo] should both be valid and equivalent to [foo][foo].

Just saying because I noticed that mdpo 0.3.84 convers my [foo][] links in .md to [foo] links in .pot.

@mondeja
Copy link
Owner

mondeja commented Feb 24, 2022

Please, could you open another issue to track it showing a clear minimal example? Thanks

@ivilata
Copy link
Author

ivilata commented Feb 24, 2022

Please, could you open another issue to track it showing a clear minimal example? Thanks

Sure, I just wasn't sure if you considered this relevant enough. Opened #221. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants