Update md2tex format tests. Closes #107

pull/117/head
Matti Pastell 2018-01-03 19:07:14 +02:00
parent dc566fc69a
commit 15d4cdf512
3 changed files with 16 additions and 12 deletions

View File

@ -303,7 +303,7 @@ function parse_inline(text::AbstractString, inline_ex::Regex)
doc = InlineText(text[e:(s-1)], e, s-1, textno)
textno += 1
push!(res, doc)
e = s + length(ic.match)
e = s + endof(ic.match)
push!(res, InlineCode(ic.captures[1], s, e, codeno))
codeno += 1
end

View File

@ -1,21 +1,25 @@
\section{Header}
\begin{lstlisting}
(*@\HLJLk{using}@*) (*@\HLJLn{Plots}@*)
(*@\HLJLnf{gr}@*)(*@\HLJLp{()}@*)
(*@\HLJLnf{scatter}@*)(*@\HLJLp{(}@*)(*@\HLJLni{1}@*)(*@\HLJLoB{:}@*)(*@\HLJLni{10}@*)(*@\HLJLp{)}@*)
\end{lstlisting}
\begin{minted}[mathescape, fontsize=\small, xleftmargin=0.5em]{julia}
\includegraphics{figures/publish_test_1_1.pdf}
using Plots
gr()
scatter(1:10)
\begin{lstlisting}
(*@\HLJLnf{plot}@*)(*@\HLJLp{(}@*)(*@\HLJLni{1}@*)(*@\HLJLoB{:}@*)(*@\HLJLni{10}@*)(*@\HLJLp{)}@*)
\end{lstlisting}
\end{minted}
\includegraphics[width=\linewidth]{figures/publish_test_1_1.pdf}
\begin{minted}[mathescape, fontsize=\small, xleftmargin=0.5em]{julia}
plot(1:10)
\end{minted}
\begin{figure}[!h]
\center
\includegraphics{figures/publish_test_somefig_1.pdf}
\includegraphics[width=\linewidth]{figures/publish_test_somefig_1.pdf}
\caption{Hello}
\label{fig:somefig}
\end{figure}

View File

@ -41,7 +41,7 @@ rendered = Weave.render_doc("Hello", doc, doc.format)
parsed = Weave.read_doc("documents/chunk_options.noweb")
doc = Weave.run(parsed, doctype = "md2tex")
c_check = "\\begin{lstlisting}\n(*@\\HLJLnf{println}@*)(*@\\HLJLp{(}@*)(*@\\HLJLn{x}@*)(*@\\HLJLp{)}@*)\n\\end{lstlisting}\n"
c_check = "\\begin{minted}[mathescape, fontsize=\\small, xleftmargin=0.5em]{julia}\n\nprintln(x)\n\n\\end{minted}\n"
doc.format.formatdict[:theme] = doc.highlight_theme
c = Weave.format_code(doc.chunks[4].content, doc.format)
@test c_check == c