rust/doc
bors 62f8661084 auto merge of #11486 : Matthias247/rust/doc, r=cmr
I wrote a chapter for the FFI tutorial that describes how to perform callbacks from C code to Rust and gives some hints about what to consider and synchronization.

I just needed that for my own wrapper and thought it would be helpful for others.
2014-01-20 18:31:38 -08:00
..
lib Remove fail keyword from lexer & parser and clean up remaining calls to 2013-02-01 00:15:42 -08:00
po/ja Update .po and strip down untranslated entries. 2014-01-14 21:19:16 +09:00
complement-bugreport.md Various READMEs and docs cleanup 2014-01-11 19:41:31 +01:00
complement-cheatsheet.md Tweak the interface of std::io 2014-01-17 10:00:47 -08:00
complement-lang-faq.md Various READMEs and docs cleanup 2014-01-11 19:41:31 +01:00
complement-project-faq.md Various READMEs and docs cleanup 2014-01-11 19:41:31 +01:00
complement-usage-faq.md Various READMEs and docs cleanup 2014-01-11 19:41:31 +01:00
favicon.inc doc: add favicon to tutorial/manual 2013-11-13 09:32:50 +01:00
full-toc.inc First phase of migrating the wiki to the internal docs #11078 2014-01-06 15:27:49 -06:00
guide-conditions.md Tweak the interface of std::io 2014-01-17 10:00:47 -08:00
guide-container.md Remove re-exports of std::io::stdio::{print, println} in the prelude. 2014-01-11 10:46:00 +11:00
guide-ffi.md Disabled the tests for the new code blocks 2014-01-20 21:44:41 +01:00
guide-lifetimes.md 'borrowed pointer' -> 'reference' 2014-01-07 18:49:13 -08:00
guide-macros.md doc: Title guides consistently 2014-01-07 17:01:06 -08:00
guide-pointers.md Remove re-exports of std::io::stdio::{print, println} in the prelude. 2014-01-11 10:46:00 +11:00
guide-runtime.md dox: Write a guide to the rust runtime 2014-01-13 23:22:07 -08:00
guide-rustpkg.md Remove re-exports of std::io::stdio::{print, println} in the prelude. 2014-01-11 10:46:00 +11:00
guide-tasks.md Add a generic power function 2014-01-17 15:41:26 +01:00
guide-testing.md Consistent formatting for args and attrs 2014-01-18 21:45:05 +01:00
index.md Update docs index to use lists 2014-01-15 20:54:34 -05:00
po4a.conf Update doc/po4a.conf for recent changes. 2014-01-10 07:21:32 +09:00
prep.js fix escape 2012-10-05 12:41:00 -07:00
README.md Note that translation workflow is WIP now. 2014-01-14 21:30:15 +09:00
rust.css First phase of migrating the wiki to the internal docs #11078 2014-01-06 15:27:49 -06:00
rust.md doc: fix dangling links in rust.md 2014-01-18 13:30:32 +01:00
rustdoc.md auto merge of #11185 : huonw/rust/doc-ignore, r=cmr 2013-12-30 05:51:51 -08:00
rustpkg.md Update Docs to use crateid 2013-12-29 15:25:43 -05:00
tutorial.md doc: add note below diagram about memory layout. 2014-01-15 22:02:48 -08:00
version_info.html.template doc/rust.HTML: proper version box 2013-10-19 20:31:53 +02:00

Dependencies

Pandoc, a universal document converter, is required to generate docs as HTML from Rust's source code.

Node.js is also required for generating HTML from the Markdown docs (reference manual, tutorials, etc.) distributed with this git repository.

po4a is required for generating translated docs from the master (English) docs.

GNU gettext is required for managing the translation data.

Building

To generate all the docs, just run make docs from the root of the repository. This will convert the distributed Markdown docs to HTML and generate HTML doc for the 'std' and 'extra' libraries.

To generate HTML documentation from one source file/crate, do something like:

rustdoc --output-dir html-doc/ --output-format html ../src/libstd/path.rs

(This, of course, requires a working build of the rustdoc tool.)

Additional notes

To generate an HTML version of a doc from Markdown without having Node.js installed, you can do something like:

pandoc --from=markdown --to=html5 --number-sections -o rust.html rust.md

(rust.md being the Rust Reference Manual.)

The syntax for pandoc flavored markdown can be found at: http://johnmacfarlane.net/pandoc/README.html#pandocs-markdown

A nice quick reference (for non-pandoc markdown) is at: http://kramdown.rubyforge.org/quickref.html

Notes for translators

Notice: The procedure described below is a work in progress. We are working on translation system but the procedure contains some manual operations for now.

To start the translation for a new language, see po4a.conf at first.

To generate .pot and .po files, do something like:

po4a --copyright-holder="The Rust Project Developers" \
    --package-name="Rust" \
    --package-version="0.10-pre" \
    -M UTF-8 -L UTF-8 \
    po4a.conf

(the version number must be changed if it is not 0.10-pre now.)

Now you can translate documents with .po files, commonly used with gettext. If you are not familiar with gettext-based translation, please read the online manual linked from http://www.gnu.org/software/gettext/ . We use UTF-8 as the file encoding of .po files.

When you want to make a commit, do the command below before staging your change:

for f in doc/po/**/*.po; do
    msgattrib --translated $f -o $f.strip
    if [ -e $f.strip ]; then
       mv $f.strip $f
    else
       rm $f
    fi
done

This removes untranslated entries from .po files to save disk space.