diff options
author | Lars Wirzenius <liw@liw.fi> | 2023-02-06 19:23:49 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2023-02-06 19:23:49 +0200 |
commit | 7be336721280075deff24831dc7e50809ef68561 (patch) | |
tree | 51f6b1da84acadf2722aecb3f9cc387e279b2a07 | |
parent | be91a614b07e1210153d350ee692ef57bf95b15b (diff) | |
download | riki-7be336721280075deff24831dc7e50809ef68561.tar.gz |
feat: placeholder for tagged() in pagespec
Sponsored-by: author
-rw-r--r-- | src/pagespec.lalrpop | 1 | ||||
-rw-r--r-- | src/pagespec.rs | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/pagespec.lalrpop b/src/pagespec.lalrpop index ccee2c4..191ff47 100644 --- a/src/pagespec.lalrpop +++ b/src/pagespec.lalrpop @@ -11,6 +11,7 @@ Term: Box<Expr> = { Glob => Box::new(Expr::Glob(<>)), "link" "(" <g:Glob> ")" => Box::new(Expr::LinksHereFunc(<>)), "page" "(" <g:Glob> ")" => Box::new(Expr::PageFunc(<>)), + "tagged" "(" <g:Glob> ")" => Box::new(Expr::TaggedFunc(<>)), "!" <t:Term> => Box::new(Expr::Negate(t)), "(" <e:Expr> ")" => e, } diff --git a/src/pagespec.rs b/src/pagespec.rs index 7af2acd..8d12440 100644 --- a/src/pagespec.rs +++ b/src/pagespec.rs @@ -66,6 +66,7 @@ pub enum Expr { Glob(String), LinksHereFunc(String), PageFunc(String), + TaggedFunc(String), Negate(Box<Expr>), Op(Box<Expr>, OpCode, Box<Expr>), } @@ -77,6 +78,7 @@ impl Expr { Self::Glob(glob) => glob_matches(glob, path), Self::LinksHereFunc(glob) => links_here(site, container, path, glob), Self::PageFunc(glob) => page_matches(site, container, glob, path), // FIXME: check its page + Self::TaggedFunc(glob) => tagged(site, container, glob, path), Self::Negate(expr) => !expr.matches(site, container, path), Self::Op(left, op, right) => match op { OpCode::And => { @@ -169,6 +171,11 @@ fn links_here(site: &Site, container: &Path, path: &str, _glob: &str) -> bool { false } +fn tagged(_site: &Site, container: &Path, path: &str, _glob: &str) -> bool { + trace!("tagged: container={} path={:?}", container.display(), path); + false +} + fn page_matches(site: &Site, container: &Path, glob: &str, path: &str) -> bool { if glob_matches(glob, path) { let full_path = container.join(path); |