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

Add selector argument to deploydocs #813

Merged
merged 1 commit into from
Aug 26, 2018
Merged

Add selector argument to deploydocs #813

merged 1 commit into from
Aug 26, 2018

Conversation

fredrikekre
Copy link
Member

@fredrikekre fredrikekre commented Aug 20, 2018

Add selector argument to makedocs. The selector argument decide the content, and order, of the version selector. The argument is a vector, defaulting to ["stable", "v#.#", devurl] where the entries
expand according to:

  • "stable" will point to the latest release.
  • "v#.#" expands to one doc per minor release.
  • devurl maps to the development docs (Rename latest to dev. #802).

The following arguments are also valid to selector:

  • "v#" expands to one doc per major release.
  • "v#.#.#" expands one doc per patch release.
  • A string which directly maps to a folder.
  • A pair, which will put p.first in the selector, and map it to p.second.

This lets users opt out of stable (#801) if they choose to.

@fredrikekre fredrikekre added this to the 0.20.0 milestone Aug 20, 2018
@fredrikekre fredrikekre changed the title Add selector argument to makedocs Add selector argument to deploydocs Aug 20, 2018
gitrm_copy(target_dir, stable_dir)
Writers.HTMLWriter.generate_siteinfo_file(stable_dir, "stable")
if version >= maxver && version.prerelease == () && in("stable", selector)
cd(dirname) do; symlink(tag, "stable"); end
Copy link
Member Author

Choose a reason for hiding this comment

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

Note to self: This should be removed.

@fredrikekre
Copy link
Member Author


# generate the symlinks
cd(dirname) do
foreach(kv -> symlink(kv.second, kv.first), symlinks)
Copy link
Member Author

Choose a reason for hiding this comment

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

Need to remove existing links here. And I guess error if what exist there is not an old symlink?

@fredrikekre fredrikekre force-pushed the fe/selector branch 2 times, most recently from 3da546e to 1a622e6 Compare August 21, 2018 07:16
@fredrikekre
Copy link
Member Author

Ok, things seem to work now, so this should be ready for review.

Copy link
Member

@mortenpi mortenpi left a comment

Choose a reason for hiding this comment

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

A few tiny things, but this looks great overall!


# write version file
function generate_version_file(dir::AbstractString, selector_entries)
Copy link
Member

Choose a reason for hiding this comment

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

Since we're not using the directory as such here anymore, maybe we should change the argument to be the filename?

- `"v#.#.#"`: expands to all released versions.
- A string which maps directly to an existing folder.
- A pair, e.g. `"first" => "second"`, which will put `"first"` in the selector, and point it
to the folder called `"second"`.
Copy link
Member

Choose a reason for hiding this comment

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

So it creates a symlink ln -s second/ first/? This might be a bit misleading, since the URL will still be first/. Might be better to say "has the same contents as "second"?

@@ -316,6 +317,16 @@ documentation. By default this value is set to `"master"`.
**`devurl`** the folder that in-development version of the docs will be deployed.
Defaults to `"dev"`.

**`selector`** determines content and order of the resulting version selector in
the generated html. The following entries are valied in the `selector` vector:
- `"stable"`: points to the latest released documentation.
Copy link
Member

Choose a reason for hiding this comment

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

How would you change the name of the stable/ directory? "new-name" => "stable"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, maybe introduce a token like "v^.^.^" to indicate maximum version, and the default here could be "stable" => "v^.^.^" ?

- `"stable"`: points to the latest released documentation.
- `"v#"`: expands to the latest documentation for each major release (i.e. `v1.1`, `v2.0`).
- `"v#.#"`: expands to the latest documentation for each minor release (i.e. `v1.0`, `v1.1`, `v2.0`).
- `"v#.#.#"`: expands to all released versions.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe better to say "includes links to the latest version for major/minor version"?

versions = ["stable", "dev",
"2.1.1", "v2.1.0", "v2.0.1", "v2.0.0",
"1.1.1", "v1.1.0", "v1.0.1", "v1.0.0",
"0.1.1", "v0.1.0"] # note no `v` on first ones
Copy link
Member

Choose a reason for hiding this comment

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

What is the difference of the directories with and without v?

Copy link
Member Author

Choose a reason for hiding this comment

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

0.1.1 is a valid tag so there might be folders in there with that naming convention. Just include that here to make sure we dont symlink to something v0.1.1 in this case, but to 0.1.1

@fredrikekre
Copy link
Member Author

Thanks for the review. I pushed a much simplified (?) version. Now only the following things are allowed:

  • "v#" one per major version
  • "v#.#" one per minor version
  • "v#.#.#" one per patch
  • "v^" the latest version
  • "first" => "second" mapping first to second, with special-casing when second is "v^", to be able to do e.g. "stable" => "v^"

Thus, removed the special casing of "stable", and also removed the string only (replacing "dev" with "dev" => "dev")

@@ -316,6 +317,18 @@ documentation. By default this value is set to `"master"`.
**`devurl`** the folder that in-development version of the docs will be deployed.
Defaults to `"dev"`.

**`selector`** determines content and order of the resulting version selector in
the generated html. The following entries are valied in the `selector` vector:
Copy link
Member

Choose a reason for hiding this comment

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

Just bikeshedding here now -- since the selector also defined which symlinks (i.e. which public URLs) get deployed, maybe it should be called something like versions? It's not only the selector.

I would also mention here that it creates the URLs the person reading the docs sees and should use.

Copy link
Member Author

Choose a reason for hiding this comment

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

I like versions.

- `"v#.#"`: includes links to the latest documentation for each minor release cycle
(i.e. `v1.0`, `v1.1`, `v2.0`).
- `"v#.#.#"`: includes links to all released versions.
- `"v^"`: includes a link to the maximum version.
Copy link
Member

Choose a reason for hiding this comment

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

What does it put in the selector though? Or can you just use this in a pair?

Copy link
Member Author

Choose a reason for hiding this comment

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

It will put vX.Y for latest X and Y, and symlink to vX.Y.Z for latest Z.

- `"v^"`: includes a link to the maximum version.
- A pair, e.g. `"first" => "second"`, which will put `"first"` in the selector,
with the same content as `"second"`. The second argument can be `"v^"`, to
point to the maximum version docs (as in e.g. `"stable" => "v^"`).
Copy link
Member

Choose a reason for hiding this comment

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

Ditto as above w.r.t. URLs. It not only puts something into the selector, but also defines the URL you can access "second" from.

@fredrikekre
Copy link
Member Author

I changed selector -> versions, and tried to explain a bit more with the links. However, I think that we should explain it better, but maybe in the manual and not the docstring, so could be part of a future doc-PR.

the content, and order, of the version selector. The argument is
a vector, defaulting to ["stable" => "v^", "v#.#", devurl => devurl].

Arguments to the selector can be:
 - "v^": expands to the latest release.
 - "v#": expands to latest doc per major release.
 - "v#.#": expands to latest doc per minor release.
 - "v#.#.#": expands to latest doc per patch release.
 - A pair p, which put p.first in the selector, and symlink it to p.second.
Copy link
Member

@mortenpi mortenpi left a comment

Choose a reason for hiding this comment

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

This looks great! I think we can merge this. If need be, we can always do some minor adjustments in future PRs.

@fredrikekre fredrikekre merged commit 332cd3f into master Aug 26, 2018
@fredrikekre fredrikekre deleted the fe/selector branch August 26, 2018 10:16
@fredrikekre
Copy link
Member Author

fredrikekre added a commit that referenced this pull request Aug 26, 2018
fredrikekre added a commit that referenced this pull request Aug 26, 2018
@fredrikekre fredrikekre mentioned this pull request Aug 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants