better handling of $module in get-function
This commit is contained in:
parent
065f6515e9
commit
943299de74
@ -143,9 +143,13 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
|
||||
v => return Err(format!("$name: {} is not a string.", v).into()),
|
||||
};
|
||||
let css = arg!(args, 1, "css" = Value::False).is_true()?;
|
||||
let module = arg!(args, 2, "module" = Value::Null);
|
||||
let module = match arg!(args, 2, "module" = Value::Null) {
|
||||
Value::Ident(s, ..) => Some(s),
|
||||
Value::Null => None,
|
||||
v => return Err(format!("$module: {} is not a string.", v).into())
|
||||
};
|
||||
|
||||
if !module.is_null() && css {
|
||||
if module.is_some() && css {
|
||||
return Err("$css and $module may not both be passed at once.".into());
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ impl Display for Value {
|
||||
.collect::<Vec<String>>()
|
||||
.join(", ")
|
||||
),
|
||||
Self::Function(..) => todo!("invalid CSS"),
|
||||
Self::Function(func) => write!(f, "get-function(\"{}\")", func.name()),
|
||||
Self::List(vals, sep, brackets) => match brackets {
|
||||
Brackets::None => write!(
|
||||
f,
|
||||
|
Loading…
x
Reference in New Issue
Block a user