Menu

#336 URL parsing problem when the path contains "_-"

closed-invalid
nobody
None
5
2020-03-03
2017-12-28
lazka
No

I was redirected here from https://github.com/sphinx-doc/sphinx/issues/4350

Given the following reST code:

http://example.com/a_-b

converting it to html results in a warning and the URL isn't converted to a link. The docs state that hyperlinks can't end with a "_", but this isn't the case here.

Discussion

  • jfbu

    jfbu - 2017-12-28

    added note:

    This link_ refers to a site whose URL uses an underscore.
    
    .. _link: http://example.com/a_-b
    

    does work ok, hence docs is fine for this "linkblock". But when handling Sphinx issue I did not find immediately docs for "inline" URI, not inside a linkblock.

     
  • jfbu

    jfbu - 2017-12-28

    ah, ok, docs is here and it says

    Punctuation at the end of a URI is not considered part of the URI, unless the URI is terminated by a closing angle bracket (">"). Backslashes may be used in URIs to escape markup characters, specifically asterisks ("*") and underscores ("_") which are vaid URI characters

    but it is not clear to me if that says that escaping is necessary if URI contains a non-letter after the underscore (as is possibly the case as reported here).

     
  • lazka

    lazka - 2017-12-28

    It seemed weird to me that "a_b" and "a-b" works, but "a_-b" doesn't.

     
  • Günter Milde

    Günter Milde - 2017-12-29
    • status: open --> closed-invalid
     
  • lazka

    lazka - 2017-12-29

    Ah, I see. Thanks!

     

Log in to post a comment.