Skip to content

Commit

Permalink
fix: fix bug of commands
Browse files Browse the repository at this point in the history
  • Loading branch information
OrangeX4 committed Apr 18, 2024
1 parent 4caae6c commit 7db8519
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion crates/mitex/src/converter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,8 @@ impl Converter {
self.exit_mode(prev_mode);
f.write_char(']')?;
}
f.write_char(';')?;
}
f.write_char(';')?;
}

// hack for \substack{abc \\ bcd}
Expand Down
3 changes: 1 addition & 2 deletions crates/mitex/tests/cvt/figure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ fn figure() {
\caption{This is an example image.}
\label{fig:example}
\end{figure}"###).unwrap(), @r###"
#figure(caption: [This is an example image.],)[
#miteximage[\[width=0.5 \]];[example-image];
#miteximage[\[width=0.5 \]][example-image];
];<fig:example>
Expand Down
12 changes: 6 additions & 6 deletions crates/mitex/tests/cvt/trivia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ use super::prelude::*;

#[test]
fn curly_group() {
assert_snapshot!(convert_text(r#"a \mathbf{strong} text"#).unwrap(), @"a mitexmathbf[strong]; text");
assert_snapshot!(convert_math(r#"a \mathbf{strong} text"#).unwrap(), @"a mitexmathbf(s t r o n g ) t e x t ");
}

#[test]
fn arguments() {
assert_snapshot!(convert_text(r#"\frac { 1 } { 2 }"#).unwrap(), @"frac[ 1 ];[ 2 ];");
assert_snapshot!(convert_math(r#"\frac { 1 } { 2 }"#).unwrap(), @"frac( 1 , 2 )");
}

#[test]
fn greedy_trivia() {
assert_snapshot!(convert_text(r#"a {\displaystyle text } b"#).unwrap(), @"a mitexdisplay( text ) b");
assert_snapshot!(convert_text(r#"\displaystyle text "#).unwrap(), @"mitexdisplay( text )");
assert_snapshot!(convert_text(r#"\displaystyle {text} "#).unwrap(), @"mitexdisplay( text, )");
assert_snapshot!(convert_text(r#"\displaystyle {\mathrm {text}} "#).unwrap(), @"mitexdisplay( upright[text];, )");
assert_snapshot!(convert_math(r#"a {\displaystyle text } b"#).unwrap(), @"a mitexdisplay( t e x t ) b ");
assert_snapshot!(convert_math(r#"\displaystyle text "#).unwrap(), @"mitexdisplay( t e x t )");
assert_snapshot!(convert_math(r#"\displaystyle {text} "#).unwrap(), @"mitexdisplay( t e x t , )");
assert_snapshot!(convert_math(r#"\displaystyle {\mathrm {text}} "#).unwrap(), @"mitexdisplay( upright(t e x t ), )");
}

0 comments on commit 7db8519

Please sign in to comment.