Add test cases.

This commit is contained in:
Tom Alexander 2023-07-18 21:08:13 -04:00
parent 3ab0dd4531
commit 5ad8fdf4b2
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
4 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,7 @@
\begin{itemize}
\item foo \sqrt{x}
\end{itemize}
\begin{itemize}
\item bar \sqrt{y}
\end{itemize} % Need text on this line to prevent it from becoming a LaTeX environment org-mode element

View File

@ -0,0 +1 @@
tex can have math between dollar signs like $x^2=y$ and $$ x=+\sqrt{y} $$ but also braces and brackets like \( x=2 \) and \[ x=-\sqrt{2} \]

View File

@ -0,0 +1,4 @@
\begin{itemize}
% this would be a LaTeX comment if this was a LaTeX document
\item Heres some math \sqrt{y}
\end{itemize} % Need text on this line to prevent it from becoming a LaTeX environment org-mode element

View File

@ -12,6 +12,7 @@ use crate::error::Res;
use crate::parser::object::Entity; use crate::parser::object::Entity;
use crate::parser::parser_with_context::parser_with_context; use crate::parser::parser_with_context::parser_with_context;
use crate::parser::util::get_consumed; use crate::parser::util::get_consumed;
use crate::parser::util::not_yet_implemented;
use crate::parser::LatexFragment; use crate::parser::LatexFragment;
#[tracing::instrument(ret, level = "debug")] #[tracing::instrument(ret, level = "debug")]
@ -19,6 +20,7 @@ pub fn latex_fragment<'r, 's>(
context: Context<'r, 's>, context: Context<'r, 's>,
input: &'s str, input: &'s str,
) -> Res<&'s str, LatexFragment<'s>> { ) -> Res<&'s str, LatexFragment<'s>> {
not_yet_implemented()?;
let (remaining, _) = tag("\\")(input)?; let (remaining, _) = tag("\\")(input)?;
todo!() todo!()
// let (remaining, entity_name) = name(context, remaining)?; // let (remaining, entity_name) = name(context, remaining)?;