Issue #13814 has been reported by aycabta (Code Ahss).

----------------------------------------
Misc #13814: URI::FTP documentation for RDoc is broken
https://bugs.ruby-lang.org/issues/13814

* Author: aycabta (Code Ahss)
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
This is related to #13813.

In lib/uri/ftp.rb, documentation for #path below:

```ruby
    # Returns the path from an FTP URI.
    #
    # RFC 1738 specifically states that the path for an FTP URI does not
    # include the / which separates the URI path from the URI host. Example:
    #
    #     ftp://ftp.example.com/pub/ruby
    #
    # The above URI indicates that the client should connect to
    # ftp.example.com then cd pub/ruby from the initial login directory.
    #
    # If you want to cd to an absolute directory, you must include an
    # escaped / (%2F) in the path. Example:
    #
    #     ftp://ftp.example.com/%2Fpub/ruby
    #
    # This method will then return "/pub/ruby"
    #
```

The URIs what are started with "ftp://" is indented,
and indented documentation is treated as Ruby code.
So this becomes strange documentation, it's highlighted as some Ruby tokens.

The screenshot below is rendered HTML of URI::FTP documentation on ruby-doc.org:
http://ruby-doc.org/stdlib-2.4.1/libdoc/uri/rdoc/URI/FTP.html

![URI of FTP as Ruby code](https://i.gyazo.com/ac8890e335466ce13ac43b0a01dc0ebf.png)

The second URI of FTP isn't highlighted,
because when a string is invalid as Ruby tokens in RDoc lexical analyser,
it's treated as plain text.
https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/59592/entry/lib/rdoc/markup/to_html.rb#L207

I think this should be fixed to correct documentation.
The patch what I attached on this issue fixes it like below:

```ruby
    # Returns the path from an FTP URI.
    #
    # RFC 1738 specifically states that the path for an FTP URI does not
    # include the / which separates the URI path from the URI host. Example:
    #
    # +ftp://ftp.example.com/pub/ruby+
    #
    # The above URI indicates that the client should connect to
    # ftp.example.com then cd pub/ruby from the initial login directory.
    #
    # If you want to cd to an absolute directory, you must include an
    # escaped / (%2F) in the path. Example:
    #
    # +ftp://ftp.example.com/%2Fpub/ruby+
    #
    # This method will then return "/pub/ruby"
    #
```

---Files--------------------------------
ftp-uri-documentation.patch (860 Bytes)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>