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

doc: general improvements to url.md copy #6904

Closed
wants to merge 1 commit into from

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented May 20, 2016

Checklist
  • documentation is changed or added
  • the commit message follows commit guidelines
Affected core subsystem(s)

doc (url)

Description of change

General improvements to url.md copy

@nodejs/documentation @mscdex

@jasnell jasnell added doc Issues and PRs related to the documentations. url Issues and PRs related to the legacy built-in url module. labels May 20, 2016
`'http://user:pass@host.com:8080/p/a/t/h?query=string#hash'` is used to
illustrate each.

### `href`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious how those render in HTML. The GH markdown doesn't look pretty here, but I think there is no alternative. ff

@eljefedelrodeodeljefe
Copy link
Contributor

Semantically very good, with one big concern inline. Rubber stamp LGTM if there we don't have better ideas, since it's anyhow an improvement.

* A new empty string `result` is created.
* If `urlObj.protocol` is a string, it is appended as-is to `result`.
* Otherwise, if `urlObj.protocol` is not `undefined` and is not a string, an
[`Error`][] is thrown.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think the reference for [Error][] is defined yet

@addaleax
Copy link
Member

Bonus points if you or someone else manages to get the diagram from nodejs/node-v0.x-archive#8755 (comment) in here… I think someone said something about wanting to make an SVG out of it and including it here a few weeks ago. 😄

@jasnell
Copy link
Member Author

jasnell commented May 20, 2016

@addaleax ... who needs SVG!!
@eljefedelrodeodeljefe ... I'll see if I can work on it a bit more to make it easier to read.

@addaleax
Copy link
Member

LGTM

@jasnell
Copy link
Member Author

jasnell commented May 23, 2016

@eljefedelrodeodeljefe ... I'm thinking of going ahead with landing this and working on making additional improvements later on in another round. Would that work for you?

@eljefedelrodeodeljefe
Copy link
Contributor

Sure LGTM then

begins with one of `http`, `https`, `ftp`, `gopher`, or `file`, or
`urlObject.protocol` is `undefined`, the literal string `//` will be appended
to `result`.
* If the value of the `urlObject.auth` property is `truthy`, and either
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

truthy is not code component.

@thefourtheye
Copy link
Contributor

LGTM

@jasnell
Copy link
Member Author

jasnell commented May 23, 2016

@thefourtheye ... updated to address the truthy nit

@jasnell
Copy link
Member Author

jasnell commented May 23, 2016

@mscdex ... can I ask you to please double check this before I land?


`'http://user:pass@host.com:8080/p/a/t/h?query=string#hash'`
A URL String is a structured string containing multiple meaningful components.
When parsed, a URL Object is returned containing properties for each of these
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lowercase object here?

@jasnell
Copy link
Member Author

jasnell commented May 24, 2016

@mscdex ... updated! thank you for the review!

| || | hostname | port | pathname | search | |
| || | | | +-+------------+ |
| || | | | | | query | |
" http: // user:pass @ host.com : 8080 | /p/a/t/h |?query=string | #hash "
Copy link
Contributor

@mscdex mscdex May 24, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the | between the port and pathname should just be removed, same with the | between pathname and search, and with the | between search and hash.

Also placing query=string completely inside the query section is clearer.

Like this:

|          ||           |          |      |          | | query        |       |
" http:    // user:pass @ host.com : 8080   /p/a/t/h  ?  query=string   #hash "

@benjamingr
Copy link
Member

LGTM although I agree with @mscdex 's suggestions


The following methods are provided by the URL module:
No decoding of the query string is performed.
Copy link
Contributor

@mscdex mscdex May 24, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to clarified to say that this is only the case when the query string isn't parsed. When it is parsed, keys and values are decoded.

@jasnell
Copy link
Member Author

jasnell commented May 24, 2016

@mscdex ... updated!

be set to an object returned by the `querystring` module's `parse()` method.
If `false`, the `query` property on the returned URL object will be an
be set to an object returned by the [`querystring`][] module's `parse()`
method. If `false`, the `query` property on the returned URL object will be an
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nit: make "function"/"method" usage consistent

General cleanup and restructuring of the doc. Added
additional detail to how URLs are serialized.
@jasnell
Copy link
Member Author

jasnell commented May 25, 2016

@mscdex ... updated, simply did s/function/method.
Squashed the commits. Should be good to go.

@jasnell
Copy link
Member Author

jasnell commented May 26, 2016

@mscdex... LGTY?

@mscdex
Copy link
Contributor

mscdex commented May 26, 2016

LGTM

jasnell added a commit that referenced this pull request May 27, 2016
General cleanup and restructuring of the doc. Added
additional detail to how URLs are serialized.

PR-URL: #6904
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
@jasnell
Copy link
Member Author

jasnell commented May 27, 2016

Landed in dbdea02. Thanks all!

@jasnell jasnell closed this May 27, 2016
Fishrock123 pushed a commit to Fishrock123/node that referenced this pull request May 30, 2016
General cleanup and restructuring of the doc. Added
additional detail to how URLs are serialized.

PR-URL: nodejs#6904
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
rvagg pushed a commit that referenced this pull request Jun 2, 2016
General cleanup and restructuring of the doc. Added
additional detail to how URLs are serialized.

PR-URL: #6904
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
@MylesBorins
Copy link
Contributor

added don't land label for v4.x

Please feel free to backport

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. url Issues and PRs related to the legacy built-in url module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants