Skip to content

Add a badge to the tutorial and reference docs indicating which Rust ver... #2944

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ ifneq ($(wildcard $(CFG_GIT)),)
ifneq ($(wildcard $(CFG_GIT_DIR)),)
CFG_VERSION += $(shell git --git-dir=$(CFG_GIT_DIR) log -1 \
--pretty=format:'(%h %ci)')
CFG_VER_HASH = $(shell git --git-dir=$(CFG_GIT_DIR) log -1 \
--pretty=format:'%H')
endif
endif

Expand Down
18 changes: 18 additions & 0 deletions doc/rust.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ body {
padding: 1em;
margin: 0;
font-family: "Helvetica Neue", Helvetica, sans-serif;
background-color: white;
color: black;
}

body {
Expand Down Expand Up @@ -58,6 +60,22 @@ h1.title {
background-position: right;
}

#versioninfo {
position: fixed;
bottom: 0px;
right: 0px;

background-color: white;
border-left: solid 1px black;
border-top: solid 1px black;
padding: 0.5em;
}

a.lessimportant {
color: gray;
font-size: 60%;
}

blockquote {
color: black;
border-left: solid 1px silver;
Expand Down
10 changes: 10 additions & 0 deletions doc/version_info_template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div id='versioninfo'>
<center>
<img src="http://www.rust-lang.org/logos/rust-logo-32x32-blk.png"> <br>
<a href="http://rust-lang.org">Rust</a> VERSION <br>
<a href="http://github.com/mozilla/rust/commit/STAMP"
class='lessimportant'>SHORT_HASH</a>
</center>

</div>

12 changes: 10 additions & 2 deletions mk/docs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ doc/rust.css: rust.css
$(Q)cp -a $< $@ 2> /dev/null

DOCS += doc/rust.html
doc/rust.html: rust.md doc/version.md doc/rust.css
doc/rust.html: rust.md doc/version_info.html doc/rust.css
@$(call E, pandoc: $@)
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
"$(CFG_PANDOC)" \
Expand All @@ -30,6 +30,7 @@ doc/rust.html: rust.md doc/version.md doc/rust.css
--number-sections \
--from=markdown --to=html \
--css=rust.css \
--include-before-body=doc/version_info.html \
--output=$@
endif

Expand Down Expand Up @@ -72,12 +73,13 @@ doc/rust.pdf: doc/rust.tex
else

DOCS += doc/tutorial.html
doc/tutorial.html: tutorial.md doc/rust.css
doc/tutorial.html: tutorial.md doc/version_info.html doc/rust.css
@$(call E, pandoc: $@)
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
$(CFG_PANDOC) --standalone --toc \
--section-divs --number-sections \
--from=markdown --to=html --css=rust.css \
--include-before-body=doc/version_info.html \
--output=$@

endif
Expand Down Expand Up @@ -145,6 +147,12 @@ doc/version.md: $(MKFILE_DEPS) rust.md
@$(call E, version-stamp: $@)
$(Q)echo "$(CFG_VERSION)" >$@

doc/version_info.html: version_info_template.html
@$(call E, version-info: $@)
sed -e "s/VERSION/$(CFG_RELEASE)/; s/SHORT_HASH/$(shell echo \
$(CFG_VER_HASH) | head --bytes=8)/;\
s/STAMP/$(CFG_VER_HASH)/;" $< >$@

GENERATED += doc/version.md

docs: $(DOCS)