Skip to content

Commit fa882d4

Browse files
paulstansifercatamorphism
authored andcommitted
Add a badge to the tutorial and reference docs indicating which Rust version they pertain to.
1 parent 1e13626 commit fa882d4

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

Makefile.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ ifneq ($(wildcard $(CFG_GIT)),)
136136
ifneq ($(wildcard $(CFG_GIT_DIR)),)
137137
CFG_VERSION += $(shell git --git-dir=$(CFG_GIT_DIR) log -1 \
138138
--pretty=format:'(%h %ci)')
139+
CFG_VER_HASH = $(shell git --git-dir=$(CFG_GIT_DIR) log -1 \
140+
--pretty=format:'%H')
139141
endif
140142
endif
141143

doc/rust.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ body {
22
padding: 1em;
33
margin: 0;
44
font-family: "Helvetica Neue", Helvetica, sans-serif;
5+
background-color: white;
6+
color: black;
57
}
68

79
body {
@@ -58,6 +60,22 @@ h1.title {
5860
background-position: right;
5961
}
6062

63+
#versioninfo {
64+
position: fixed;
65+
bottom: 0px;
66+
right: 0px;
67+
68+
background-color: white;
69+
border-left: solid 1px black;
70+
border-top: solid 1px black;
71+
padding: 0.5em;
72+
}
73+
74+
a.lessimportant {
75+
color: gray;
76+
font-size: 60%;
77+
}
78+
6179
blockquote {
6280
color: black;
6381
border-left: solid 1px silver;

doc/version_info_template.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<div id='versioninfo'>
2+
<center>
3+
<img src="http://www.rust-lang.org/logos/rust-logo-32x32-blk.png"> <br>
4+
<a href="http://rust-lang.org">Rust</a> VERSION <br>
5+
<a href="http://github.com/mozilla/rust/commit/STAMP"
6+
class='lessimportant'>SHORT_HASH</a>
7+
</center>
8+
9+
</div>
10+

mk/docs.mk

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ doc/rust.css: rust.css
2121
$(Q)cp -a $< $@ 2> /dev/null
2222

2323
DOCS += doc/rust.html
24-
doc/rust.html: rust.md doc/version.md doc/rust.css
24+
doc/rust.html: rust.md doc/version_info.html doc/rust.css
2525
@$(call E, pandoc: $@)
2626
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
2727
"$(CFG_PANDOC)" \
@@ -30,6 +30,7 @@ doc/rust.html: rust.md doc/version.md doc/rust.css
3030
--number-sections \
3131
--from=markdown --to=html \
3232
--css=rust.css \
33+
--include-before-body=doc/version_info.html \
3334
--output=$@
3435
endif
3536

@@ -72,12 +73,13 @@ doc/rust.pdf: doc/rust.tex
7273
else
7374

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

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

150+
doc/version_info.html: version_info_template.html
151+
@$(call E, version-info: $@)
152+
sed -e "s/VERSION/$(CFG_RELEASE)/; s/SHORT_HASH/$(shell echo \
153+
$(CFG_VER_HASH) | head -c 8)/;\
154+
s/STAMP/$(CFG_VER_HASH)/;" $< >$@
155+
148156
GENERATED += doc/version.md
149157

150158
docs: $(DOCS)

0 commit comments

Comments
 (0)