I have a book that was written in Sweave and contains a lot of Latex that I am trying to convert to Rmarkdown. I have managed to write a script that converts most of the Latex to reasonable markdown but nested lists eludes me.
My idea so far is to detect when a list starts and ends and then pass it onto pandoc for conversion since I think making a parser would be make it unnecessarily difficult. The problem is detecting where the list starts and ends when the list is nested.
I found an example of matching bracketed tags here but I haven't been able to figure out how to convert it to match \begin and \end. (Regex match outer nested tags)
Example data:
meh meh
\begin{itemize}
\item something1
\begin{itemize}
\item something1.1
\item something1.2
\end{itemize}
\item something2
\begin{itemize}
\item something2.1
\item something2.2
\end{itemize}
\end{itemize}
blah blah
\begin{itemize}
\item somethingelse1
\item somethingelse2
\end{itemize}
the end.
There should be two matches above. One for the nested list and one for the below list. Can this be done with a regex or do you see some smarter way?