diff --git a/odsfile.sty b/odsfile.sty index 781a406..183f41b 100644 --- a/odsfile.sty +++ b/odsfile.sty @@ -40,6 +40,10 @@ rowseparator=[[\\n]] \luaexec{odssave="\luatexluaescapestring{#1}"}% } +\define@key{includespread}{debug}{% use either true or false + \luaexec{odsdebug=\luatexluaescapestring{#1}}% +} + \define@key{includespread}{coltypes}{% \luaexec{coltypes="\luatexluaescapestring{\unexpanded{#1}}"}% } @@ -70,6 +74,8 @@ columns = split(s,",") \luaexec{odslastnl="\luatexluaescapestring{\unexpanded{#1}}"}% } + + % Variable initialization and helper functions \begin{luacode*} odsreader = require("odsfile") @@ -80,6 +86,7 @@ columns = nil templates = {} row = {} odssave = nil +odsdebug = nil body = nil odsfilename = "" currenttemplate = nil @@ -126,6 +133,7 @@ odslastnl = "\\OdsLastNl" columns=nil currenttemplate = nil odssave = nil + odsdebug = false rowtemplate = nil celltpl = "-{value}" columnbreak = "\\linebreak{}" @@ -224,7 +232,9 @@ odslastnl = "\\OdsLastNl" end content = table.concat(content, odsnl .. " " ..rowseparator) .. odslastnl local result = odsreader.interp(templates[currenttemplate],{content=content,coltypes=coltypes,colheading=colheading,rowsep=rowseparator}) - print(result) + if odsdebug then + print(result) + end if odssave then odsreader.save(odssave, result) else @@ -238,7 +248,9 @@ odslastnl = "\\OdsLastNl" end content = table.concat(content,rowseparator) local result = odsreader.interp(templates[currenttemplate],{content=content,coltypes=coltypes,colheading=colheading,rowsep=rowseparator}) - print(result) + if odsdebug then + print(result) + end if odssave then odsreader.save(odssave, result) else diff --git a/odsfile.tex b/odsfile.tex index be7f3b8..98e9365 100644 --- a/odsfile.tex +++ b/odsfile.tex @@ -241,9 +241,14 @@ \subsection{Saving the generated table to a file} \begin{LTXexample} There should be no table listed -\includespread[sheet=List1,columns=head,escape=false,save=save-test.tex] +\includespread[sheet=List1,columns=head,escape=false,save=save-test.tex,debug=true] \end{LTXexample} +\subsection{Debugging} + +You can print the generated table to the terminal output of \LaTeX\ using the \texttt{debug} option. Possible values are +\texttt{true} and \texttt{false}. + \section{Templates}\label{sec:tpl} @@ -422,7 +427,7 @@ \section{Changes} \begin{description} \item [devel] \begin{itemize} - \item added the \texttt{save} option + \item added the \texttt{save} and \texttt{debug }options \item added support for multiple ranges in the \texttt{range} option \item added \texttt{newline} and \texttt{lastnewline} options \end{itemize}