diff --git a/crates/config/src/make.rs b/crates/config/src/make.rs index 2c81156..4ef22f4 100644 --- a/crates/config/src/make.rs +++ b/crates/config/src/make.rs @@ -34,6 +34,8 @@ pub enum VerboseLevel { Error, /// Uncatchable errors Critical, + /// Interactive prompt context, only useful in interactive mode + InteractiveContext, /// Literrally uncatchable things Uncatchable, } diff --git a/crates/make/src/makepdf.rs b/crates/make/src/makepdf.rs index 6573b42..38096e1 100644 --- a/crates/make/src/makepdf.rs +++ b/crates/make/src/makepdf.rs @@ -32,13 +32,14 @@ use tokio::{ use anyhow::{Context, Result, anyhow}; -use crate::makepdf_functions::{ - BuilderParseResult, make_clean, make_file, make_glossaries, make_list, -}; use crate::makepdf_structs::{ BuildInfo, COL_INFO, COL_NORMAL, LineType, Status, TXT_BOXX, TXT_CNTX, TXT_CRIT, TXT_ERRR, TXT_INFO, TXT_MISC, TXT_UKNW, TXT_WARN, }; +use crate::{ + makepdf_functions::{BuilderParseResult, make_clean, make_file, make_glossaries, make_list}, + makepdf_structs::TXT_ICTX, +}; /// Make a pdf spawning a subprocess pub fn make_pdf(args: &MakeConfig, _config: &Config) -> Result<()> { @@ -284,6 +285,15 @@ fn checkline( *TXT_CNTX, COL_NORMAL.apply_to(final_line) )), // Context tends to be shit ))? + VerboseLevel::InteractiveContext => { + if !args.non_interactive { + pb.println(format!( + "{} {:?}", + *TXT_ICTX, + COL_NORMAL.apply_to(final_line) + )) + } + } VerboseLevel::Info => { status.info += 1; pb.println(format!( diff --git a/crates/make/src/makepdf_structs.rs b/crates/make/src/makepdf_structs.rs index f11bc83..7f802fc 100644 --- a/crates/make/src/makepdf_structs.rs +++ b/crates/make/src/makepdf_structs.rs @@ -46,6 +46,9 @@ pub(super) static TXT_BOXX: LazyLock = /// Filler box for the [CNTX] text box pub(super) static TXT_CNTX: LazyLock = LazyLock::new(|| format!("{}", COL_CONTEXT.apply_to(&"[CNTX]"))); +/// Filler box for the [CNTX] text box +pub(super) static TXT_ICTX: LazyLock = + LazyLock::new(|| format!("{}", COL_CONTEXT.apply_to(&"[ICTX]"))); /// Filler box for the [INFO] text box pub(super) static TXT_INFO: LazyLock = LazyLock::new(|| format!("{}", COL_INFO.apply_to(&"[INFO]"))); @@ -234,10 +237,10 @@ pub(super) enum LineType { /// Glossary will not be built #[token("This document will not have a glossary.")] - #[token("Remove \\makeglossaries if you don't want any glossaries.")] + #[token("Remove .makeglossaries if you don't want any glossaries.")] NoGlossary, - #[regex(r"No file [^$]\.gls\.", |_| "".to_string())] + #[regex(r"No file [^$]+\.gls\.", |lex| lex.slice().replace("No file ", ""))] /// The glossary file wasn't found NoGlossaryFile(String), @@ -262,6 +265,15 @@ pub(super) enum LineType { #[regex(r"\([A-z_-]+\) [^\n]+", |lex| split_by(")",&lex.slice()[1..]), allow_greedy=true)] PackageContext((String, String)), + /// You should read the LaTex manual + #[token("See the pdftex.def package documentation for explanation.", |lex| lex.slice().to_string())] + #[token("See the LaTeX manual or LaTeX Companion for explanation.", |lex| lex.slice().to_string())] + HelpGiven(String), + + /// Interactive prompt + #[token("Type H for immediate help.")] + Prompt, + /// Loading (Load something) #[regex(r"(\)+ )?\(/usr[^)]*", |lex| lex.slice().split("/").last().unwrap_or("").to_string())] Loading(String), @@ -284,9 +296,10 @@ pub(super) enum LineType { #[token("Transcript written on")] Log, - // /// Barely parsable data - // #[regex(r"\)+")] - // Garbage, + /// Useless help line + #[regex(r"\.\.\.")] + Garbage, + /// Empty line, to discard Empty, @@ -301,6 +314,10 @@ pub(super) enum LineType { /// Transcript #[token("(see the transcript file for additional information)")] Transcript, + /// Error Context + #[regex(r"l\.\d+ [^\n]+", |lex| split_by(" ",lex.slice()), allow_greedy=true) ] + // #[regex(r"\(\./[A-z/_-]+\.(gls|tex)", |lex| lex.slice().split("(").nth(1).unwrap_or("").to_string())] + ErrorContext((String, String)), } impl LineType { @@ -349,6 +366,10 @@ impl LineType { LineType::NoGlossary => VerboseLevel::Warning, LineType::FontAwesome => VerboseLevel::Info, LineType::NoGlossaryFile(_) => VerboseLevel::Warning, + LineType::HelpGiven(_) => VerboseLevel::Context, + LineType::Prompt => VerboseLevel::InteractiveContext, + LineType::Garbage => VerboseLevel::None, + LineType::ErrorContext(_) => VerboseLevel::Error, } } } diff --git a/crates/monsters/src/monster_export.rs b/crates/monsters/src/monster_export.rs index 0e5011b..51b8811 100644 --- a/crates/monsters/src/monster_export.rs +++ b/crates/monsters/src/monster_export.rs @@ -49,7 +49,6 @@ fn load_templates(config: &Config) -> Result> { template_load!(templates, &config.monster, resists_row); template_load!(templates, &config.monster, stats); template_load!(templates, &config.monster, phase_row); - // template_load!(templates, &config.monster, attack_color); template_load!(templates, &config.monster, attack_repeatable_row); template_load!(templates, &config.monster, attack_info_row); template_load!(templates, &config.monster, intent_table); @@ -253,11 +252,6 @@ fn number_of_description(monster_first_atk: &&MonsterSingleAttack) -> usize { } } #[derive(Serialize)] -struct Coloring<'a> { - color: &'a str, - // size: usize, -} -#[derive(Serialize)] struct PhaseName<'a> { phase_name: &'a String, }