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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Point references to prelude to correct documentation links #663

Closed

Conversation

vaidehijoshi
Copy link

I started learning Rust today and noticed that the references to prelude linking to the documentation in both editions of the book seem to be broken. My guess is that they should be pointing to https://doc.rust-lang.org.

(Please let me know if I haven't made this PR correctly鈥攖his is my first open source contribution, ever! Hopefully I did it right. 馃檲)

@carols10cents
Copy link
Member

carols10cents commented May 1, 2017

Hi @vaidehijoshi!!! I'm honored that we're your first PR :) Welcome!!!

Good news: the PR looks like it was created completely right :)
Bad news: the links are actually this way on purpose, sort of: the book is included with the documentation that comes with Rust installations so that you can read the book offline. That being said, we intended that the relative links SHOULD work ONline as well-- but only if you read the book from certain places :(

If you read the book from:

then the relative link to prelude is going to URLs like https://doc.rust-lang.org/nightly/std/prelude/ (with the corresponding stable/beta/nightly) for me.

I think it's only on the github pages at http://rust-lang.github.io/book/ that the relative links don't work. rust-lang.github.io/book used to be the only way people could read the second edition of the book, but we're now shipping the second edition in with the rest of the documentation too.

I'm guessing that you came in through the link in the github header-- because you pointed out this problem, I've changed the link in the header to go to https://doc.rust-lang.org/nightly/book/, which should be fairly up-to-date with what we have in the repo, and the links should work :) So you have helped make the project better!!

As you may have guessed by now, I'm going to close this PR without merging it. But please don't let this discourage you-- both my first PR and @steveklabnik's first PR to rust-lang/rust were closed without being merged too. Please send in PRs or issues for anything else you find while reading!! 鉂わ笍 鉂わ笍 鉂わ笍

@vaidehijoshi
Copy link
Author

@carols10cents Thank you for the clear explanation! That's good to know. I'll keep an eye out while reading and if I come upon anything, will definitely submit a PR. (Now I know how! 馃樃)

@ghost
Copy link

ghost commented Jan 13, 2018

While viewing the book offline, the std links are broken, however I'm using this local bash script workaround, to symlink to an existing std, assuming rustup(with rust-docs) is already installed:

std_basedir="${HOME}/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/share/doc/rust/html/"
files_or_dirs_to_symlink=(
  std/
  normalize.css
  rustdoc.css
  main.css
  main.js
  alloc/
  search-index.js
  FiraSans-Medium.woff
  FiraSans-Regular.woff
  Heuristica-Italic.woff
  SourceCodePro-Regular.woff
  SourceCodePro-Semibold.woff
  SourceSerifPro-Bold.woff
  SourceSerifPro-Regular.woff
)
for each in "${files_or_dirs_to_symlink[@]}"; do
  ln --force --no-dereference --relative --symbolic --no-target-directory --verbose -- "${std_basedir}/${each}" "${each%/}"
done

To test: backward-search for text The parse() method on strings parses a string from within the webpage file:///home/xftroxgpx/build/2nonpkgs/rust.stuff/book/first-edition/book/guessing-game.html#looping; that text has a link in it to file:///home/xftroxgpx/build/2nonpkgs/rust.stuff/book/std/primitive.str.html#method.parse
assuming the book dir is the result of git clone https://github.com/rust-lang/book.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants