Skip to content

Commit 918bae6

Browse files
committed
Merge pull request servo#53 from servo/rustdoc
Have Travis CI upload rustdoc-generated documentation to GitHub Pages.
2 parents 49613fd + b03c3f6 commit 918bae6

File tree

6 files changed

+45
-32
lines changed

6 files changed

+45
-32
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
*-test
1010
Makefile
1111
/target
12+
/doc

.travis.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,18 @@ install:
88
- sudo ./cargo-nightly/install.sh
99

1010
script:
11-
- cargo build --verbose
12-
- cargo test --verbose
11+
- cargo build
12+
- cargo test
13+
- rustdoc lib.rs -L target/deps
14+
15+
after_success: |
16+
[ $TRAVIS_BRANCH = master ] &&
17+
[ $TRAVIS_PULL_REQUEST = false ] &&
18+
echo '<meta http-equiv=refresh content=0;url=cssparser/index.html>' > doc/index.html &&
19+
sudo pip install ghp-import &&
20+
ghp-import -n doc &&
21+
git push -fq https://${TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages
22+
23+
env:
24+
- secure: TDTC2q5Trv22R1pXcMyi2mWToc201aJpCJgLlnwNzkT2bjpQj+0KQvBpI1gIoeQvSL9ud85187C0tdmR7zQmZjBt6mnNCs7EM7QDIPcUcrH0vz8v/RQ+VNxhRAeCwUP4uLEHtnvbi9Q0KXCI1cQivZuMspxVMwvajx/ylcPwb4k=
25+

Makefile.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ AR ?= ar
77
RUSTC ?= rustc
88
RUSTFLAGS ?=
99
EXT_DEPS ?=
10+
RUSTDOC ?= rustdoc
11+
RUSTDOC_FLAGS ?=
12+
RUSTDOC_TARGET ?= doc
1013

1114
RUST_SRC=$(shell find $(VPATH)/. -type f -name '*.rs')
1215

@@ -28,6 +31,12 @@ check: cssparser-test
2831
check-debug: cssparser-tests
2932
echo -e "start\n break upcall_fail\n continue\n where\n continue" | gdb -q ./cssparser-tests
3033

34+
.PHONY: doc
35+
doc: $(RUSTDOC_TARGET)/cssparser/index.html
36+
37+
$(RUSTDOC_TARGET)/cssparser/index.html: lib.rs $(RUST_SRC) $(EXT_DEPS)
38+
$(RUSTDOC) $(RUSTDOC_FLAGS) $< -o $(RUSTDOC_TARGET)
39+
3140
.PHONY: clean
3241
clean:
3342
rm -f *.o *.a *.so *.dylib *.rlib *.dll *.dummy *-test

from_bytes.rs

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,16 @@ use parser::{parse_stylesheet_rules, StylesheetParser};
1414

1515
/// Determine the character encoding of a CSS stylesheet and decode it.
1616
///
17-
/// This is based on the presence of a :abbr:`BOM (Byte Order Mark)`,
18-
/// an `@charset` rule,
19-
/// and encoding meta-information.
17+
/// This is based on the presence of a BOM (Byte Order Mark), an `@charset` rule, and
18+
/// encoding meta-information.
2019
///
21-
/// :param css_bytes: A byte string.
22-
/// :param protocol_encoding:
23-
/// The encoding label, if any, defined by HTTP or equivalent protocol.
20+
/// * `css_bytes`: A byte string.
21+
/// * `protocol_encoding`: The encoding label, if any, defined by HTTP or equivalent protocol.
2422
/// (e.g. via the `charset` parameter of the `Content-Type` header.)
25-
/// :param environment_encoding:
26-
/// An optional `Encoding` object
27-
/// for the `environment encoding
28-
/// <http://www.w3.org/TR/css-syntax/#environment-encoding>`_,
29-
/// if any.
30-
/// :returns:
31-
/// A 2-tuple of a decoded Unicode string
32-
/// and the `Encoding` object that was used.
23+
/// * `environment_encoding`: An optional `Encoding` object for the [environment encoding]
24+
/// (http://www.w3.org/TR/css-syntax/#environment-encoding), if any.
25+
///
26+
/// Returns a 2-tuple of a decoded Unicode string and the `Encoding` object that was used.
3327
pub fn decode_stylesheet_bytes(css: &[u8], protocol_encoding_label: Option<&str>,
3428
environment_encoding: Option<EncodingRef>)
3529
-> (String, EncodingRef) {
@@ -78,18 +72,14 @@ fn decode_replace(input: &[u8], fallback_encoding: EncodingRef)-> (String, Encod
7872

7973
/// Parse stylesheet from bytes.
8074
///
81-
/// :param css_bytes: A byte string.
82-
/// :param protocol_encoding:
83-
/// The encoding label, if any, defined by HTTP or equivalent protocol.
75+
/// * `css_bytes`: A byte string.
76+
/// * `protocol_encoding`: The encoding label, if any, defined by HTTP or equivalent protocol.
8477
/// (e.g. via the `charset` parameter of the `Content-Type` header.)
85-
/// :param environment_encoding:
86-
/// An optional `Encoding` object
87-
/// for the `environment encoding
88-
/// <http://www.w3.org/TR/css-syntax/#environment-encoding>`_,
89-
/// if any.
90-
/// :returns:
91-
/// A 2-tuple of a Iterator<Result<Rule, SyntaxError>>
92-
/// and the `Encoding` object that was used.
78+
/// * `environment_encoding`: An optional `Encoding` object for the [environment encoding]
79+
/// (http://www.w3.org/TR/css-syntax/#environment-encoding), if any.
80+
///
81+
/// Returns a 2-tuple of a `Iterator<Result<Rule, SyntaxError>>`
82+
/// and the `Encoding` object that was used.
9383
pub fn parse_stylesheet_rules_from_bytes(
9484
css_bytes: &[u8], protocol_encoding_label: Option<&str>,
9585
environment_encoding: Option<EncodingRef>)

parser.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// http://dev.w3.org/csswg/css-syntax/#parsing
66

7-
/// The input to these functions needs to implement Iterator<(ComponentValue, SourceLocation)>.
7+
/// The input to these functions needs to implement `Iterator<(ComponentValue, SourceLocation)>`.
88
/// The input is consumed to avoid doing a lot of copying.
99
/// A conforming input can be obtained:
1010
///
@@ -25,15 +25,15 @@ pub struct RuleListParser<T>{ iter: T }
2525
pub struct DeclarationListParser<T>{ iter: T }
2626

2727
/// Parse top-level of a CSS stylesheet.
28-
/// Return a Iterator<Result<Rule, SyntaxError>>
28+
/// Return a `Iterator<Result<Rule, SyntaxError>>`
2929
#[inline]
3030
pub fn parse_stylesheet_rules<T: Iterator<Node>>(iter: T) -> StylesheetParser<T> {
3131
StylesheetParser{ iter: iter }
3232
}
3333

3434

3535
/// Parse a non-top level list of rules eg. the content of an @media rule.
36-
/// Return a Iterator<Result<Rule, SyntaxError>>
36+
/// Return a `Iterator<Result<Rule, SyntaxError>>`
3737
#[inline]
3838
pub fn parse_rule_list<T: Iterator<Node>>(iter: T) -> RuleListParser<T> {
3939
RuleListParser{ iter: iter }
@@ -42,7 +42,7 @@ pub fn parse_rule_list<T: Iterator<Node>>(iter: T) -> RuleListParser<T> {
4242

4343
/// Parse a list of declarations and at-rules,
4444
/// like @page in CSS 2.1, all declaration lists in level 3
45-
/// Return a Iterator<Result<DeclarationListItem, SyntaxError>>
45+
/// Return a `Iterator<Result<DeclarationListItem, SyntaxError>>`
4646
#[inline]
4747
pub fn parse_declaration_list<T: Iterator<Node>>(iter: T) -> DeclarationListParser<T> {
4848
DeclarationListParser{ iter: iter }

tokenizer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::ascii::StrAsciiExt;
1010
use ast::*;
1111

1212

13-
/// Returns a Iterator<(ComponentValue, SourceLocation)>
13+
/// Returns a `Iterator<(ComponentValue, SourceLocation)>`
1414
pub fn tokenize(input: &str) -> Tokenizer {
1515
let input = preprocess(input);
1616
Tokenizer {

0 commit comments

Comments
 (0)