Skip to content

Fix Markdown syntax in doc comments #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 15 additions & 25 deletions from_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,16 @@ use parser::{parse_stylesheet_rules, StylesheetParser};

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

/// Parse stylesheet from bytes.
///
/// :param css_bytes: A byte string.
/// :param protocol_encoding:
/// The encoding label, if any, defined by HTTP or equivalent protocol.
/// * `css_bytes`: A byte string.
/// * `protocol_encoding`: The encoding label, if any, defined by HTTP or equivalent protocol.
/// (e.g. via the `charset` parameter of the `Content-Type` header.)
/// :param environment_encoding:
/// An optional `Encoding` object
/// for the `environment encoding
/// <http://www.w3.org/TR/css-syntax/#environment-encoding>`_,
/// if any.
/// :returns:
/// A 2-tuple of a Iterator<Result<Rule, SyntaxError>>
/// and the `Encoding` object that was used.
/// * `environment_encoding`: An optional `Encoding` object for the [environment encoding]
/// (http://www.w3.org/TR/css-syntax/#environment-encoding), if any.
///
/// Returns a 2-tuple of a `Iterator<Result<Rule, SyntaxError>>`
/// and the `Encoding` object that was used.
pub fn parse_stylesheet_rules_from_bytes(
css_bytes: &[u8], protocol_encoding_label: Option<&str>,
environment_encoding: Option<EncodingRef>)
Expand Down
8 changes: 4 additions & 4 deletions parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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

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

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


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

/// Parse a list of declarations and at-rules,
/// like @page in CSS 2.1, all declaration lists in level 3
/// Return a Iterator<Result<DeclarationListItem, SyntaxError>>
/// Return a `Iterator<Result<DeclarationListItem, SyntaxError>>`
#[inline]
pub fn parse_declaration_list<T: Iterator<Node>>(iter: T) -> DeclarationListParser<T> {
DeclarationListParser{ iter: iter }
Expand Down
2 changes: 1 addition & 1 deletion tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::ascii::StrAsciiExt;
use ast::*;


/// Returns a Iterator<(ComponentValue, SourceLocation)>
/// Returns a `Iterator<(ComponentValue, SourceLocation)>`
pub fn tokenize(input: &str) -> Tokenizer {
let input = preprocess(input);
Tokenizer {
Expand Down