diff --git a/rustex/src/commands.rs b/rustex/src/commands.rs index 52f34f6..caf80eb 100644 --- a/rustex/src/commands.rs +++ b/rustex/src/commands.rs @@ -42,6 +42,7 @@ pub fn register_primitives_postinit(engine:&mut DefaultEngine) { register_unexpandable(engine,"rustex@annotateTop",CommandScope::Any,annot_top); register_unexpandable(engine,"rustex@cssLink",CommandScope::Any,css_link); register_unexpandable(engine,"rustex@HTMLLiteral",CommandScope::Any,html_literal); + register_unexpandable(engine,"rustex@directHTML",CommandScope::Any,html_literal); // if@rustex // rustex@directHTML } @@ -69,11 +70,11 @@ fn namespace(engine:Refs,token:CompactToken) -> Res<()> { Ok(()) } -fn annot_top(engine:Refs,token:CompactToken) -> Res<()> { +fn meta(engine:Refs,token:CompactToken) -> Res<()> { + let mut attrs = VecMap::default(); let mut str = String::new(); engine.read_braced_string(true,true,&token,&mut str)?; let mut s = str[..].trim(); - let top = &mut engine.aux.extension.top; while !s.is_empty() { let key = if let Some(i) = s.find('=') { let (n,v) = s.split_at(i); @@ -92,16 +93,17 @@ fn annot_top(engine:Refs,token:CompactToken) -> Res<()> { s = r[1..].trim_start(); v.trim() } else { todo!() }; - top.insert(key.to_string(),val.to_string()); + attrs.insert(key.to_string(),val.to_string()); } + engine.aux.extension.metas.push(attrs); Ok(()) } -fn meta(engine:Refs,token:CompactToken) -> Res<()> { - let mut attrs = VecMap::default(); +fn annot_top(engine:Refs,token:CompactToken) -> Res<()> { let mut str = String::new(); engine.read_braced_string(true,true,&token,&mut str)?; let mut s = str[..].trim(); + let top = &mut engine.aux.extension.top; while !s.is_empty() { let key = if let Some(i) = s.find('=') { let (n,v) = s.split_at(i); @@ -120,9 +122,8 @@ fn meta(engine:Refs,token:CompactToken) -> Res<()> { s = r[1..].trim_start(); v.trim() } else { todo!() }; - attrs.insert(key.to_string(),val.to_string()); + top.insert(key.to_string(),val.to_string()); } - engine.aux.extension.metas.push(attrs); Ok(()) } diff --git a/rustex/src/main.rs b/rustex/src/main.rs index 3d897d9..a3fc8bf 100644 --- a/rustex/src/main.rs +++ b/rustex/src/main.rs @@ -27,9 +27,9 @@ profile 1:27 ==> 1:43 thesis 0:15 */ fn main() { - profile() + //profile() //thesis() - //run() + run() //test() //temp_test() //notes() @@ -163,7 +163,7 @@ fn temp_test() { //let ret = RusTeXEngine::do_file("/home/jazzpirate/work/Software/sTeX/RusTeXNew/test/numtest.tex",false,true,true); let ret = RusTeXEngine::do_file( //"/home/jazzpirate/work/MathHub/Papers/24-cicm-views-in-alea/source/ex/model-satisfies-formula-view-fol.en.tex", - "/home/jazzpirate/work/Software/sTeX/RusTeXNew/test/tmptest.tex", + "/home/jazzpirate/work/MathHub/sTeX/DemoExamples/source/quickstart.tex", true, true, true, @@ -171,7 +171,7 @@ fn temp_test() { //let ret = RusTeXEngine::do_file("/home/jazzpirate/work/LaTeX/Papers/17 - Alignment Translation/macros/kwarc/workplan/workplan-template.tex",true,true,true); //std::fs::write("/home/jazzpirate/work/Software/sTeX/RusTeXNew/test/numtest.html", &ret.out).unwrap(); std::fs::write( - "/home/jazzpirate/work/Software/sTeX/RusTeXNew/test/temp_test.html", + "/home/jazzpirate/work/MathHub/sTeX/DemoExamples/source/quickstart.tex.html", &ret.out, ) .unwrap(); diff --git a/rustex/src/shipout.rs b/rustex/src/shipout.rs index 7990eff..4ffdbe4 100644 --- a/rustex/src/shipout.rs +++ b/rustex/src/shipout.rs @@ -538,10 +538,10 @@ fn do_mathlist(engine:Refs, state:&mut ShipoutState, children:&mut MNodes) -> Re nodes::vrule(state,start,end,width.unwrap_or(Dim32(26214)),height,depth) } MathNode::Whatsit(wi) => wi.call(engine)?, - MathNode::Custom(RusTeXNode::FontChange(font,false)) => annotations::do_font(state,&engine.fontsystem.glyphmaps,font), - MathNode::Custom(RusTeXNode::FontChangeEnd) => annotations::close_font(state), - MathNode::Custom(RusTeXNode::AnnotBegin {start,attrs,styles,tag}) => annotations::do_annot(state,start,tag,attrs,styles), - MathNode::Custom(RusTeXNode::AnnotEnd(end)) => annotations::close_annot(state,end), + MathNode::Custom(RusTeXNode::FontChange(font,false)) => {flush!();annotations::do_font(state,&engine.fontsystem.glyphmaps,font)} + MathNode::Custom(RusTeXNode::FontChangeEnd) => {flush!();annotations::close_font(state)} + MathNode::Custom(RusTeXNode::AnnotBegin {start,attrs,styles,tag}) => {flush!();annotations::do_annot(state,start,tag,attrs,styles)} + MathNode::Custom(RusTeXNode::AnnotEnd(end)) => {flush!();annotations::close_annot(state,end)} MathNode::HFil | MathNode::HFill | MathNode::Hss | MathNode::HFilneg | MathNode::Penalty(_) => (), MathNode::Custom(RusTeXNode::PDFNode(PDFNode::PDFOutline(_) | PDFNode::PDFPageAttr(_) | PDFNode::PDFPagesAttr(_) | PDFNode::PDFCatalog(_) | PDFNode::PDFSave | PDFNode::PDFAnnot(_) | PDFNode::PDFLiteral(_) | PDFNode::XForm(_) | PDFNode::Obj(_))) => (), diff --git a/rustex/src/shipout/utils.rs b/rustex/src/shipout/utils.rs index 94ba48a..0f5ae5f 100644 --- a/rustex/src/shipout/utils.rs +++ b/rustex/src/shipout/utils.rs @@ -3,6 +3,7 @@ use tex_engine::prelude::{HNode, MathNode, VNode}; use tex_engine::tex::nodes::math::MathFontStyle; use crate::engine::Types; +#[derive(Debug)] pub(crate) struct ExtensibleIter { curr:IntoIter, next:Vec> diff --git a/rustex/src/stomach.rs b/rustex/src/stomach.rs index d53c8a3..463e0a9 100644 --- a/rustex/src/stomach.rs +++ b/rustex/src/stomach.rs @@ -222,7 +222,7 @@ pub fn vsplit(engine: Refs, mut nodes: Vec>, mut target: Dim32) -> let split_penalty = match rest.first() { Some(VNode::Penalty(p)) => { let p = *p; - rest.remove(0); + rest.drain(..1).next(); Some(p) } _ => None diff --git a/tex_engine/src/engine/gullet/methods.rs b/tex_engine/src/engine/gullet/methods.rs index 0996d1e..b96a611 100644 --- a/tex_engine/src/engine/gullet/methods.rs +++ b/tex_engine/src/engine/gullet/methods.rs @@ -108,7 +108,7 @@ fn read_delimited_argument(engine:&mut EngineReferences,arg: if let Some(Some(n)) = remove_braces { if arg.len() == n { arg.pop(); - arg.remove(0); + arg.drain(..1).next(); } } if ends_with_bgroup { diff --git a/tex_engine/src/engine/stomach/methods.rs b/tex_engine/src/engine/stomach/methods.rs index 5013293..32aa59e 100644 --- a/tex_engine/src/engine/stomach/methods.rs +++ b/tex_engine/src/engine/stomach/methods.rs @@ -767,7 +767,7 @@ pub fn vsplit_roughly(engine: &mut EngineReferences, mut nod let split_penalty = match rest.first() { Some(VNode::Penalty(p)) => { let p = *p; - rest.remove(0); + rest.drain(..1).next(); Some(p) } _ => None