Tholp's bespoke website generator

cut down console output

Tholp1 c33bb7c2 186d52d5

Changed files
+26 -12
src
+2 -2
src/macros/mod.rs
···
use super::types::Macro;
use insert::macro_insert;
-
use simple_blocks::{macro_comment, macro_null, macro_repeat};
+
use simple_blocks::{macro_comment, macro_section, macro_repeat};
use simple_macros::{macro_clear, macro_time};
use template::macro_template;
···
},
Macro {
symbol: "section",
-
expand: macro_null,
+
expand: macro_section,
has_scope: true,
},
Macro {
+13 -1
src/macros/simple_blocks.rs
···
return Vec::new();
}
-
pub fn macro_null(
+
pub fn macro_section(
_file: &mut InputFile,
_origin_index: usize,
_origin_line: usize,
···
tokens.push(tok.clone());
}
return tokens;
+
}
+
+
pub fn macro_preformatted(
+
_file: &mut InputFile,
+
_origin_index: usize,
+
_origin_line: usize,
+
_context: &mut ProjectContext,
+
_args: &Vec<String>,
+
scope: &[Token],
+
) -> Vec<Token> {
+
+
Vec::new()
}
pub fn macro_repeat(
+1 -1
src/macros/template.rs
···
args: &Vec<String>,
scope: &[Token],
) -> Vec<Token> {
-
println!("{:?}", args);
+
//println!("{:?}", args);
let mut output = self.tokens.clone();
+10 -8
src/main.rs
···
for m in &MACRO_LIST {
if &symbol[prefix_len..] == m.symbol {
matched_macro = true;
-
println!("Found a macro ({})", m.symbol);
+
//println!("Found a macro ({})", m.symbol);
let (args, args_tokcount) =
collect_arguments(&file.tokens[file.working_index..]);
···
let block_tokcount: usize;
if m.has_scope {
-
println!("is scoped.");
+
//println!("is scoped.");
let block: Vec<Token>;
(block, block_tokcount) =
collect_block(&file.tokens[(file.working_index + args_tokcount)..]);
···
}
}
-
// Make this less copied
// check for templates
+
// todo maybe deduplicate this
for m in &mut file.templates {
if &symbol[prefix_len..] == m.symbol {
matched_macro = true;
-
println!("Found a macro ({})", m.symbol);
+
//println!("Found a macro ({})", m.symbol);
let (args, args_tokcount) =
collect_arguments(&file.tokens[file.working_index..]);
···
let block_tokcount: usize;
if m.has_scope {
-
println!("is scoped.");
+
//println!("is scoped.");
let block: Vec<Token>;
(block, block_tokcount) =
collect_block(&file.tokens[(file.working_index + args_tokcount)..]);
···
}
if !matched_macro {
println!(
-
"Token written as a function but no such function exists \"{}\"",
+
"[WARN] {:?}:{}; Token written as a function but no such function exists \"{}\"",
+
file.file_input,
+
file.tokens[file.working_index].line_number,
file.tokens[file.working_index].contents.trim()
);
}
···
)
.unwrap();
fs::write(&file.file_htmlout, &html_output).expect("Couldn't write html to file");
-
println!(
-
"{} written.",
+
print!(
+
"{} written.\n\n",
file.file_htmlout
.to_str()
.unwrap_or("Couldnt Unwrap htmlout name")