[][src]Function bloguen::util::parse_function_notation

pub fn parse_function_notation(from: &str) -> Option<(&str, Vec<&str>)>

Trivially parse a standard funxion invocation notation.

Return value is Some((name, arguments)), all trimmed, if a funxion is found, None otherwise.

Stolen and adapted from controller-display.

Examples

assert_eq!(parse_function_notation("post_date(rfc_2822)"),
           Some(("post_date", vec!["rfc_2822"])));
assert_eq!(parse_function_notation("date(post, \"%Y %B %d\")"),
           Some(("date", vec!["post", "\"%Y %B %d\""])));
assert_eq!(parse_function_notation("date()"),
           Some(("date", vec![])));

assert!(parse_function_notation("(post)").is_none());