Tholp's bespoke website generator
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

add `groupname` macro

Tholp 25daab7b 961cdff4

+23 -3
+7
src/macros/mod.rs
··· 55 55 min_args: 0, 56 56 max_args: 1, 57 57 }, 58 + Macro { 59 + symbol: "groupname", 60 + expansion: macro_groupname, 61 + takes_block: false, 62 + min_args: 0, 63 + max_args: 0, 64 + }, 58 65 // Scoped 59 66 Macro { 60 67 symbol: "comment", // Removes its block
+11
src/macros/simple_macros.rs
··· 120 120 reminder_skid(context, origin_index, origin_line, &args[0]); 121 121 Vec::new() 122 122 } 123 + 124 + pub fn macro_groupname( 125 + origin_index: usize, 126 + _origin_line: usize, 127 + context: &mut Project, 128 + skid_context: &mut SkidContext, 129 + _args: &Vec<String>, 130 + _scope: &[Token], 131 + ) -> Vec<Token> { 132 + split_to_tokens(context.filegroups[skid_context.group_id].name.clone(), origin_index) 133 + }
+1 -1
src/main.rs
··· 88 88 .expect("File unreadable or missing"); 89 89 let tokens = split_to_tokens(contents, project.index_of_file(&file_input)); 90 90 91 - let mut skid_context = SkidContext::new(project.index_of_file(&file_input)); 91 + let mut skid_context = SkidContext::new(project.index_of_file(&file_input), i); 92 92 write_file( 93 93 &project.filegroups[i].files[k].file_skidout.clone(), 94 94 &project.filegroups[i].files[k].file_out.clone(),
+1 -1
src/stringtools.rs
··· 294 294 if ret.is_err() { 295 295 error_skid( 296 296 proj_context, 297 - tokens[0].origin_index, 297 + tokens[0].template_origin, 298 298 tokens[0].origin_line, 299 299 &ret.err()?.to_string(), 300 300 );
+3 -1
src/types.rs
··· 33 33 pub struct SkidContext { 34 34 pub templates: Vec<SkidTemplate>, 35 35 pub file_id: usize, 36 + pub group_id: usize, 36 37 pub lua: Lua, 37 38 } 38 39 39 40 impl SkidContext { 40 - pub fn new(file_id: usize) -> SkidContext { 41 + pub fn new(file_id: usize, group_id: usize) -> SkidContext { 41 42 SkidContext { 42 43 templates: Vec::new(), 43 44 file_id, 45 + group_id, 44 46 lua: Lua::new(), 45 47 } 46 48 }