mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
arranger: trying to fix conditional layers
This commit is contained in:
parent
9fcb5a08c6
commit
01db41b75d
5 changed files with 24 additions and 17 deletions
|
|
@ -435,7 +435,8 @@ impl Configuration {
|
|||
return Err(format!("(e4) unexpected non-symbol {next:?}").into())
|
||||
};
|
||||
|
||||
if let Some(Token { value: Value::Str(path), .. }) = exp.peek() {
|
||||
let token = exp.peek();
|
||||
if let Some(Token { value: Value::Str(path), .. }) = token {
|
||||
let path = base.as_ref().parent().unwrap().join(unquote(path));
|
||||
if !std::fs::exists(&path)? {
|
||||
return Err(format!("(e5) not found: {path:?}").into())
|
||||
|
|
@ -448,7 +449,11 @@ impl Configuration {
|
|||
map.add_layer_if(
|
||||
Box::new(move |state|{
|
||||
let mut exp = exp.clone();
|
||||
Context::get(state, &mut exp).unwrap_or(false)
|
||||
let value = Context::get(state, &mut format!(":{cond}").as_str().into()).unwrap_or(false);
|
||||
if value {
|
||||
panic!("layer-if cond={cond:?} exp={exp:?} value={value:?}");
|
||||
}
|
||||
value
|
||||
}),
|
||||
keys
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue