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) doc = InlineText(text[e:(s-1)], e, s-1, textno)
textno += 1 textno += 1
push!(res, doc) push!(res, doc)
e = s + length(ic.match) e = s + endof(ic.match)
push!(res, InlineCode(ic.captures[1], s, e, codeno)) push!(res, InlineCode(ic.captures[1], s, e, codeno))
codeno += 1 codeno += 1
end end

View File

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

View File

@ -41,7 +41,7 @@ rendered = Weave.render_doc("Hello", doc, doc.format)
parsed = Weave.read_doc("documents/chunk_options.noweb") parsed = Weave.read_doc("documents/chunk_options.noweb")
doc = Weave.run(parsed, doctype = "md2tex") 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 doc.format.formatdict[:theme] = doc.highlight_theme
c = Weave.format_code(doc.chunks[4].content, doc.format) c = Weave.format_code(doc.chunks[4].content, doc.format)
@test c_check == c @test c_check == c