From e48d2870f91b769680b0cd12895066a94c4131aa Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 8 Jun 2015 13:48:12 +0200 Subject: [PATCH] initial commit --- .gitignore | 2 ++ Cargo.lock | 4 ++++ Cargo.toml | 4 ++++ pycco-rs | 21 +++++++++++++++++++++ src/main.rs | 25 +++++++++++++++++++++++++ src/part00.rs | 10 ++++++++++ src/part01.rs | 10 ++++++++++ 7 files changed, 76 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100755 pycco-rs create mode 100644 src/main.rs create mode 100644 src/part00.rs create mode 100644 src/part01.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7bac8aa --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +target +docs diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..b44a287 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,4 @@ +[root] +name = "rust-101" +version = "0.1.0" + diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..10572b4 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,4 @@ +[package] +name = "rust-101" +version = "0.1.0" +authors = ["Ralf Jung "] diff --git a/pycco-rs b/pycco-rs new file mode 100755 index 0000000..e6199d9 --- /dev/null +++ b/pycco-rs @@ -0,0 +1,21 @@ +#!/usr/bin/python +# A little wrapper around pycco, to add Rust support. +import pycco +from pygments import lexers, formatters +import re +pycco.main.languages[".rs"] = { "name": "rust", "symbol": "//"} + +# need to re-build this stuff... +for ext, l in pycco.main.languages.items(): + # Does the line begin with a comment? + l["comment_matcher"] = re.compile(r"^\s*" + l["symbol"] + "\s?") + # The dividing token we feed into Pygments, to delimit the boundaries between + # sections. + l["divider_text"] = "\n" + l["symbol"] + "DIVIDER\n" + # The mirror of `divider_text` that we expect Pygments to return. We can split + # on this to recover the original sections. + l["divider_html"] = re.compile(r'\n*' + l["symbol"] + 'DIVIDER\n*') + # Get the Pygments Lexer for this language. + l["lexer"] = lexers.get_lexer_by_name(l["name"]) + +pycco.main.main() diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e4108d4 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,25 @@ +// Welcome to Rust-101 +// =================== +// +// This is Rust-101, a small tutorial to the [Rust language](http://www.rust-lang.org/). +// This is intended to be an interactive, hands-on course: I believe the only way to +// *really* learn a language is to write code in it, so you should be coding during +// the course. These documents mainly serve as a guide to the teacher, reminding me +// what to explain in which order, and making sure I have sample code for all topics +// I plan to cover. They may also be helpful as an offline resource, but you're on your +// own then. + +// The actual course is in the partXX.rs files. I suggest you get started with +// [the first part](part00.html), or jump directly to where you left off: + +// * [Part 00](part00.html) +// * [Part 01](part01.html) +mod part00; +mod part01; + +// To actually run the code after filling in the blanks, simply edit the `main` +// function below. + +fn main() { + part00::part_main(); +} diff --git a/src/part00.rs b/src/part00.rs new file mode 100644 index 0000000..585df9b --- /dev/null +++ b/src/part00.rs @@ -0,0 +1,10 @@ +// [index](main.html) | previous | [next](part01.html) + +// Rust-101, Part 00 +// ================= + + + +pub fn part_main() { + +} \ No newline at end of file diff --git a/src/part01.rs b/src/part01.rs new file mode 100644 index 0000000..2e350bc --- /dev/null +++ b/src/part01.rs @@ -0,0 +1,10 @@ +// [index](main.html) | [previous](part00.html) | [next](part02.html) + +// Rust-101, Part 00 +// ================= + + + +pub fn part_main() { + +} \ No newline at end of file -- 2.30.2