Menu

#133 Round brackets in named link urls causes parsing problems

_
open
nobody
None
6
2012-12-17
2012-12-14
Adam Clarke
No

The presence of round brackets () in urls for named links results in unexpected output.

For example, the following works as expected:
<the year 42 at http://en.wikipedia.org/wiki/42>

But the following does not:
<the number 42 at http://en.wikipedia.org/wiki/42_(number)>
instead we see something like:
<the number 42 at url target=”http://en.wikipedia.org/wiki/42_” name=”http://en.wikipedia.org/wiki/42_”(number)>

unnamed link urls also work as expected.
<http://en.wikipedia.org/wiki/42_(number)>

Really annoying for links to wikipedia which often contain round brackets for disambiguation.

Discussion

  • Greg Valure

    Greg Valure - 2012-12-17

    Open [ND Dir]\Modules\NaturalDocs\Parser\Native.pm

    Search for the string "acceptable URL characters".

    There will be three lines following it that look similar to this:

    [a-z0-9\-\=\~\@\#\%\&\_\+\/\;\:\?\*\.\,]
    

    On each of them, right before the closing square bracket add "\(\)", like so:

    [a-z0-9\-\=\~\@\#\%\&\_\+\/\;\:\?\*\.\,\(\)]
    

    Run Natural Docs once with -r to apply the changes everywhere.

     
  • Adam Clarke

    Adam Clarke - 2012-12-17

    That works very well, thank-you.

    FYI: on page 15 of http://www.w3.org/Addressing/URL/url-spec.txt,
    a path segment is defined (BNF) to include the following:
    safe: $ | - | _ | @ | . | & | + | -
    extra: ! | * | " | ' | ( | ) | ,

    so a patch should probably also add the dollar sign and exclamation mark.

     

    Last edit: Adam Clarke 2012-12-17

Log in to post a comment.