]> git.lizzy.rs Git - rust.git/blob - src/doc/README.md
auto merge of #12003 : bnoordhuis/rust/sizeof-epoll-event-fixup, r=brson
[rust.git] / src / doc / README.md
1 # Dependencies
2
3 [Pandoc](http://johnmacfarlane.net/pandoc/installing.html), a universal
4 document converter, is required to generate docs as HTML from Rust's
5 source code.
6
7 [Node.js](http://nodejs.org/) is also required for generating HTML from
8 the Markdown docs (reference manual, tutorials, etc.) distributed with
9 this git repository.
10
11 [po4a](http://po4a.alioth.debian.org/) is required for generating translated
12 docs from the master (English) docs.
13
14 [GNU gettext](http://www.gnu.org/software/gettext/) is required for managing
15 the translation data.
16
17 # Building
18
19 To generate all the docs, just run `make docs` from the root of the repository.
20 This will convert the distributed Markdown docs to HTML and generate HTML doc
21 for the 'std' and 'extra' libraries.
22
23 To generate HTML documentation from one source file/crate, do something like:
24
25 ~~~~
26 rustdoc --output-dir html-doc/ --output-format html ../src/libstd/path.rs
27 ~~~~
28
29 (This, of course, requires a working build of the `rustdoc` tool.)
30
31 # Additional notes
32
33 To generate an HTML version of a doc from Markdown without having Node.js
34 installed, you can do something like:
35
36 ~~~~
37 pandoc --from=markdown --to=html5 --number-sections -o rust.html rust.md
38 ~~~~
39
40 (rust.md being the Rust Reference Manual.)
41
42 The syntax for pandoc flavored markdown can be found at:
43 http://johnmacfarlane.net/pandoc/README.html#pandocs-markdown
44
45 A nice quick reference (for non-pandoc markdown) is at:
46 http://kramdown.rubyforge.org/quickref.html
47
48 # Notes for translators
49
50 Notice: The procedure described below is a work in progress. We are working on
51 translation system but the procedure contains some manual operations for now.
52
53 To start the translation for a new language, see po4a.conf at first.
54
55 To generate .pot and .po files, do something like:
56
57 ~~~~
58 po4a --copyright-holder="The Rust Project Developers" \
59     --package-name="Rust" \
60     --package-version="0.10-pre" \
61     -M UTF-8 -L UTF-8 \
62     src/doc/po4a.conf
63 ~~~~
64
65 (the version number must be changed if it is not 0.10-pre now.)
66
67 Now you can translate documents with .po files, commonly used with gettext. If
68 you are not familiar with gettext-based translation, please read the online
69 manual linked from http://www.gnu.org/software/gettext/ . We use UTF-8 as the
70 file encoding of .po files.
71
72 When you want to make a commit, do the command below before staging your
73 change:
74
75 ~~~~
76 for f in src/doc/po/**/*.po; do
77     msgattrib --translated $f -o $f.strip
78     if [ -e $f.strip ]; then
79        mv $f.strip $f
80     else
81        rm $f
82     fi
83 done
84 ~~~~
85
86 This removes untranslated entries from .po files to save disk space.