diff --git a/src/readers.jl b/src/readers.jl index 5a50063..2cc1bbd 100644 --- a/src/readers.jl +++ b/src/readers.jl @@ -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 diff --git a/test/documents/publish/publish_tex.tex.ref b/test/documents/publish/publish_tex.tex.ref index 991e9a0..032db3d 100644 --- a/test/documents/publish/publish_tex.tex.ref +++ b/test/documents/publish/publish_tex.tex.ref @@ -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} diff --git a/test/formatter_test.jl b/test/formatter_test.jl index 4d394a5..c6f08ea 100644 --- a/test/formatter_test.jl +++ b/test/formatter_test.jl @@ -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