summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorQrius <[email protected]>2024-09-26 00:11:05 +0200
committerQrius <[email protected]>2024-09-26 00:11:05 +0200
commit4b3670fc6b037911be8a1320b5994eb89886e41f (patch)
treea91e3c8672bc7430aca9151b7876a854c3369442 /src
parent1aa00ad16b140b93d893166ce1b7e93f3b847069 (diff)
downloadskaldpress-4b3670fc6b037911be8a1320b5994eb89886e41f.tar.gz
skaldpress-4b3670fc6b037911be8a1320b5994eb89886e41f.zip
Add man pages, add array function to SMP
Diffstat (limited to 'src')
-rw-r--r--src/macro_processor/macro_processor.rs12
-rw-r--r--src/skaldpress/parseopts.rs2
2 files changed, 13 insertions, 1 deletions
diff --git a/src/macro_processor/macro_processor.rs b/src/macro_processor/macro_processor.rs
index 85bf8e1..96d5471 100644
--- a/src/macro_processor/macro_processor.rs
+++ b/src/macro_processor/macro_processor.rs
@@ -246,6 +246,7 @@ pub enum MacroType {
),
/// Will be expanded in-place to the String
String(String),
+ Array(Vec<MacroType>),
}
/// Possible parser states
@@ -339,6 +340,17 @@ impl MacroProcessor {
self.macros.insert(name, macro_expansion);
}
+ pub fn array_push(&mut self, name: String, element: MacroType) -> Result<(), SMPError> {
+ let Some(macro_body) = self.macros.get_mut(&name) else {
+ return Err(SMPError::UnknownError(4, None));
+ };
+ let MacroType::Array(array) = macro_body else {
+ return Err(SMPError::UnknownError(5, None));
+ };
+ array.push(element);
+ Ok(())
+ }
+
/// This expands a macro definition, and it executes builtin functions, like define
///
/// # Arguments
diff --git a/src/skaldpress/parseopts.rs b/src/skaldpress/parseopts.rs
index 36fbf13..3985684 100644
--- a/src/skaldpress/parseopts.rs
+++ b/src/skaldpress/parseopts.rs
@@ -135,7 +135,7 @@ pub fn parseopts() -> OptsBuilder {
} else {
arg_name = arg.clone();
match arg_name.as_str() {
- "out" | "source" | "templates" => {
+ "out" | "source" | "templates" | "filter" => {
arg_value = it.next();
}
_ => (),