Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upSome love for the rustbook (engine) #26216
Conversation
rust-highfive
assigned
nikomatsakis
Jun 11, 2015
This comment has been minimized.
This comment has been minimized.
|
(rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
rust-highfive
assigned
steveklabnik
and unassigned
nikomatsakis
Jun 11, 2015
This comment has been minimized.
This comment has been minimized.
|
I want to add some icons. But eventually, more could be used: search, github link, ... They have a CDN so I don't need to include the icons in the rust repo, I can just link to their CDN (like I do for the Open Sans google font) |
This comment has been minimized.
This comment has been minimized.
|
it's important that docs render well when not-online, so I am tempted to say no to FontAwesome. There are some that already argue our existing fonts are too much... |
This comment has been minimized.
This comment has been minimized.
|
Nice improvements! A few thoughts:
|
This comment has been minimized.
This comment has been minimized.
|
Oh that's a pity, it would have added a nice touch instead of menus made of words. I don't see their point though, since everything is packed with the docs it doesn't matter much how much font's we use. The only argument I could understand is that it increases page load (but that's only relevant for the online version) and you can improve that by using CDN's + local fallback. Is there another argument against it? @alexcrichton I used Open Sans from google fonts so it's not added to the repo. It does show up when you browse locally and have a an internet connection. But if it doesn't load it's no problem at all because you fall back on the old font ;)
I think I can :) I will post a link when it's done |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton @steveklabnik here is the link: http://www.mathieudavid.org/test/rustbook/patch1/ I am working on a version to change font style at the moment I have included FontAwesome through CDN link I will add a local fallback to use words instead of icons when it doesn't load (for offline support). Once done I will put it online for you to review. Update: For the variable font-sizes, it's a little trickier than I thought. I have to convert all the font-size to What do you think? Update 2: Just to be clear, this is not in the PR (yet) |
This comment has been minimized.
This comment has been minimized.
|
I would need some help with separating the css and js from rust. At the moment it is hardcoded in a Rust string and not very maintainable. But I'm not sure what I have to modify. Also it would be super convenient to add a make target like |
This comment has been minimized.
This comment has been minimized.
|
I have effectively isolated the css and js from the rust code. I put them in a static folder. Since It seems to behave correctly but I would feel a hell of a lot more confident if you guys could double check it ;) Edit: This commit has a little downside: now when you change only the css or js, it doesn't rebuild because: |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
@steveklabnik @alexcrichton any update on this? :) |
nhowell
reviewed
Jun 24, 2015
| }); | ||
| </script> | ||
| <<<<<<< HEAD |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
azerupi
Jun 24, 2015
Author
Contributor
Oh, yes my bad. I completely overlooked that. Correcting it right away :)
nhowell
reviewed
Jun 24, 2015
| @@ -145,6 +145,8 @@ fn render(book: &Book, tgt: &Path) -> CliResult<()> { | |||
| format!("--html-after-content={}", postlude.display()), | |||
| format!("--markdown-playground-url=http://play.rust-lang.org"), | |||
| format!("--markdown-css={}", item.path_to_root.join("rust-book.css").display()), | |||
| format!("--markdown-css={}", | |||
| "http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700"), | |||
This comment has been minimized.
This comment has been minimized.
nhowell
reviewed
Jun 24, 2015
| @@ -1 +1 @@ | |||
| Subproject commit 8cbcdf1b72e1b23679646f6faca265f76b20d379 | |||
| Subproject commit bff69076975642c64e76dbeaa53476bfa7212086 | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
azerupi
Jun 24, 2015
Author
Contributor
I have no idea how this got modified, it probably got messed up when I merged the upstream branch to resolve the merge conflict. And I can't figure out how to revert it.. :(
This comment has been minimized.
This comment has been minimized.
nhowell
Jun 24, 2015
Contributor
Okay. Yeah... that merge commit is pretty nasty looking. I wonder if a rebase and squash would take care of it (and then revert the changes to "src/llvm" and "src/rust-installer")
This comment has been minimized.
This comment has been minimized.
azerupi
Jun 24, 2015
Author
Contributor
I have never done that, could you walk me through the procedure?
This comment has been minimized.
This comment has been minimized.
nhowell
Jun 24, 2015
Contributor
To rebase (I hope I have this correct):
$ git checkout doc-experiments
$ git fetch upstream
$ git rebase upstream/master
(Replace "upstream" with the name of your upstream remote if it's different.)
Let's see if that helps first. Squashing is a little more involved. (https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History)
This comment has been minimized.
This comment has been minimized.
azerupi
Jun 24, 2015
Author
Contributor
Thank you ! It looks ok, I will check further and do a test build to see if everything is still good before I upload this time ;)
nhowell
reviewed
Jun 24, 2015
| @@ -1 +1 @@ | |||
| Subproject commit 8e4f8ea581502a2edc8177a040300e05ff7f91e3 | |||
| Subproject commit e54d4823d26cdb3f98e5a1b17e1c257cd329aa61 | |||
This comment has been minimized.
This comment has been minimized.
azerupi
added some commits
Jun 11, 2015
This comment has been minimized.
This comment has been minimized.
|
@nhowell The rebase worked, I think it's all good now. Thanks for your help ! |
This comment has been minimized.
This comment has been minimized.
|
I think this change is overall good, but still am opposed to Yet More Web Fonts. We get a lot of complaints about our existing usage, I'd rather be conservative for now. Other than that, r=me |
This comment has been minimized.
This comment has been minimized.
|
@steveklabnik Ok, I will remove the font then :) But I would like to explain why (in my opinion) it has only advantages. Could this maybe be discussed on the internal forum, to see what others think about it?
And I think it's easier on the eye, but that's a matter of personal taste ;) Was there a change with |
This comment has been minimized.
This comment has been minimized.
A lot of people complain about our existing web font usage. I'd prefer to keep that usage level at about the same until we see if maybe someday we remove it entirely. We really need some help from some designer people :( I don't know about any changes to |
This comment has been minimized.
This comment has been minimized.
|
@bors: r+ |
This comment has been minimized.
This comment has been minimized.
|
|
bors
added a commit
that referenced
this pull request
Jul 10, 2015
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
Okay, I have no idea here. @alexcrichton @brson do either of you know why
this would start failing?
|
This comment has been minimized.
This comment has been minimized.
|
My guess is that this command to copy static assets from a relative directory of cwd is failing. Does this patch work with out-of-tree builds? |
This comment has been minimized.
This comment has been minimized.
|
Thanks for the rustbook love. It could be a swell tool. |
This comment has been minimized.
This comment has been minimized.
What would cause it to fail? It works fine on my machine.. |
This comment has been minimized.
This comment has been minimized.
|
It's creating a path from the current working directory to somewhere in the source directory. This should be fine if building from the source directory, but if building out of tree (running configure from somewhere other than the source directory) it will produce the wrong path. Again just a guess. |
This comment has been minimized.
This comment has been minimized.
|
That makes sense. Unfortunately I don't see any variable that points to the root directory and I cant use a relative path from Is there something I could use that will always point to the right directory? |
This comment has been minimized.
This comment has been minimized.
|
@azerupi I'd suggest following the example here and using |
brson
closed this
Jul 13, 2015
brson
reopened this
Jul 13, 2015
This comment has been minimized.
This comment has been minimized.
|
Sorry, didn't mean to close. |
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Jul 13, 2015
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
@azerupi what's your status? |
This comment has been minimized.
This comment has been minimized.
Yes sorry for the wait, I have been distracted by other things (studies). |
This comment has been minimized.
This comment has been minimized.
|
I think it's good now, can someone review it? |
This comment has been minimized.
This comment has been minimized.
|
@bors: r+ |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
Looks good, let's see what bors says :) |
bors
added a commit
that referenced
this pull request
Jul 27, 2015
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bors
merged commit f6e9240
into
rust-lang:master
Jul 27, 2015
This comment has been minimized.
This comment has been minimized.
|
Great ! Finally, thanks to everyone for your patience :) |
azerupi commentedJun 11, 2015
So I have tried to improve the rustbook engine:
I encountered 1 problem. In
build.rsI added this google font url (I commented out the non-relevant parts for clarity)As you can see, I had to escape
=with=because the string would get truncated if I didn't. Is that normal behaviour? Is that for security measures? If it is, isn't it a little weak if you can circumvent it by escaped characters? I don't know the reason behind, but I thought it was at least worth mentioning :)Take your time for this PR, I still want to add multiple improvements:
cssandjsin their respective files (not hardcoded in rust)So I'm not in a hurry to get this merged ;) But if you think it's good enough to be merged, go ahead. I will make another PR when I have other improvements.
In the image below is a screen of the improvements