From 3f98f1308b769b5d61efc6c133ac520df2b074ac Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Sun, 7 Dec 2014 21:23:44 -0800 Subject: [PATCH] Export `parse_color_keyword` for use in legacy HTML color parsing. I could have gotten around the privacy restriction by synthesizing a fake CSS AST and parsing that, but that would have been less efficient. --- src/color.rs | 2 +- src/lib.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/color.rs b/src/color.rs index b921a042..ff015783 100644 --- a/src/color.rs +++ b/src/color.rs @@ -60,7 +60,7 @@ impl Color { #[inline] -fn parse_color_keyword(value: &str) -> Result { +pub fn parse_color_keyword(value: &str) -> Result { let lower_value = value.to_ascii_lower(); let (r, g, b) = match lower_value.as_slice() { "black" => (0., 0., 0.), diff --git a/src/lib.rs b/src/lib.rs index 9da2632d..9e0c5b4c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,6 +15,7 @@ extern crate test; #[cfg(test)] extern crate serialize; +pub use color::{parse_color_keyword}; pub use tokenizer::{tokenize, Tokenizer}; pub use parser::{parse_stylesheet_rules, StylesheetParser, parse_rule_list, RuleListParser,