commit | fc65d078fa6b5626a64c5e9339cb02eb2a2d5913 | [log] [tgz] |
---|---|---|
author | Jorge Aparicio <japaric@linux.com> | Tue Jul 22 00:45:07 2014 -0500 |
committer | Jorge Aparicio <japaric@linux.com> | Tue Jul 22 00:45:07 2014 -0500 |
tree | 217045b1784ed3060a4fd01f70bb722b5fc0851c | |
parent | fb0b29b0cbd9439dec8f2e142b43f506206391c3 [diff] |
macros: rename some sections, cover macro expansion (WIP)
This is the source code of the Rust by example website!
See CONTRIBUTING.md.
We use these tools to generate the static site:
gitbook
will generate the site from markdown files (see details about how it works here).
Before running gitbook
, we do a preprocessing step using src/update.rs.
This preprocessing has two steps:
SUMMARY.md
SUMMARY.md
is generated from the examples/structure.json file. This JSON file contains a tree-like structure of “examples”.
Each example has:
hello
Hello World
null
examples
, e.g. examples/hello{ "id": "hello", "title": "Hello World", "children": null }
When dealing with a child example, the path will have to include the id of its ancestors; e.g. examples/variable/mut/input.md
, implies that a mut
example lives under the variable
example.
input.md
Instead of including the rust code directly in input.md
, the code lives in separate source files; and the preprocessing step will insert the source code in the markdown file.
For example, to insert the source code of the hello.rs
file, the following syntax is used in the markdown file:
{hello.play}
expands the source code embedded in a live code editor{hello.rs}
expands to static/plain source code.{hello.out}
expands to the output of executing the source code.The Makefile provides the following recipes:
make
: builds update.rs
and does the preprocessing stepmake book
: runs gitbook
to generate the bookmake serve
: runs gitbook --serve
to generate the book and publishes it under localhost:4000
make test
: will check all the rust source files for compilation errorsRust by example is dual licensed under the Apache 2.0 license and the MIT license.
See LICENSE-APACHE and LICENSE-MIT for more details.