Commits

Martin Scharrer  committed 3e6e90b

Auto-quote feature corrected. Added test cases.

  • Participants
  • Parent commits 6cb6476

Comments (0)

Files changed (12)

-CONTRIBUTION  = standalone
+CONTRIBUTION  = $(shell basename ${PWD})
 NAME          = Martin Scharrer
 EMAIL         = martin@scharrer.me
 DIRECTORY     = /macros/latex/contrib/${CONTRIBUTION}
 
 ${CONTRIBUTION}.pdf: ${DTXFILES} README ${INSFILES} ${LTXFILES}
 	${MAKE} --no-print-directory build
-	${CP} "${BUILDDIR}/$@" "$@"
+	cp "${BUILDDIR}/$@" "$@"
 
 ifneq (${BUILDDIR},build)
 build: ${BUILDDIR}
 
 ${BUILDDIR}: ${MAINFILES}
 	-mkdir ${BUILDDIR} 2>/dev/null || true
-	${CP} ${MAINFILES} README ${BUILDDIR}/
+	cp ${MAINFILES} README ${BUILDDIR}/
 	$(foreach DTX,${DTXFILES}, tex '\input ydocincl\relax\includefiles{${DTX}}{${BUILDDIR}/${DTX}}' && rm -f ydocincl.log;)
 	cd ${BUILDDIR}; $(foreach INS, ${INSFILES}, tex ${INS};)
 	cd ${BUILDDIR}; $(foreach DTX, ${MAINDTX}, ${LATEXMK} ${DTX};)
 install: $(addprefix ${BUILDDIR}/,${TDSFILES})
 ifneq ($(strip $(LTXFILES)),)
 	test -d "${LTXDIR}" || mkdir -p "${LTXDIR}"
-	cd ${BUILDDIR} && ${CP} ${LTXFILES} "$(abspath ${LTXDIR})"
+	cd ${BUILDDIR} && cp ${LTXFILES} "$(abspath ${LTXDIR})"
 endif
 ifneq ($(strip $(LTXSRCFILES)),)
 	test -d "${LTXSRCDIR}" || mkdir -p "${LTXSRCDIR}"
-	cd ${BUILDDIR} && ${CP} ${LTXSRCFILES} "$(abspath ${LTXSRCDIR})"
+	cd ${BUILDDIR} && cp ${LTXSRCFILES} "$(abspath ${LTXSRCDIR})"
 endif
 ifneq ($(strip $(LTXDOCFILES)),)
 	test -d "${LTXDOCDIR}" || mkdir -p "${LTXDOCDIR}"
-	cd ${BUILDDIR} && ${CP} ${LTXDOCFILES} "$(abspath ${LTXDOCDIR})"
+	cd ${BUILDDIR} && cp ${LTXDOCFILES} "$(abspath ${LTXDOCDIR})"
 endif
 ifneq ($(strip $(GENERICFILES)),)
 	test -d "${GENERICDIR}" || mkdir -p "${GENERICDIR}"
-	cd ${BUILDDIR} && ${CP} ${GENERICFILES} "$(abspath ${GENERICDIR})"
+	cd ${BUILDDIR} && cp ${GENERICFILES} "$(abspath ${GENERICDIR})"
 endif
 ifneq ($(strip $(GENSRCFILES)),)
 	test -d "${GENSRCDIR}" || mkdir -p "${GENSRCDIR}"
-	cd ${BUILDDIR} && ${CP} ${GENSRCFILES} "$(abspath ${GENSRCDIR})"
+	cd ${BUILDDIR} && cp ${GENSRCFILES} "$(abspath ${GENSRCDIR})"
 endif
 ifneq ($(strip $(GENDOCFILES)),)
 	test -d "${GENDOCDIR}" || mkdir -p "${GENDOCDIR}"
-	cd ${BUILDDIR} && ${CP} ${GENDOCFILES} "$(abspath ${GENDOCDIR})"
+	cd ${BUILDDIR} && cp ${GENDOCFILES} "$(abspath ${GENDOCDIR})"
 endif
 ifneq ($(strip $(PLAINFILES)),)
 	test -d "${PLAINDIR}" || mkdir -p "${PLAINDIR}"
-	cd ${BUILDDIR} && ${CP} ${PLAINFILES} "$(abspath ${PLAINDIR})"
+	cd ${BUILDDIR} && cp ${PLAINFILES} "$(abspath ${PLAINDIR})"
 endif
 ifneq ($(strip $(PLAINSRCFILES)),)
 	test -d "${PLAINSRCDIR}" || mkdir -p "${PLAINSRCDIR}"
-	cd ${BUILDDIR} && ${CP} ${PLAINSRCFILES} "$(abspath ${PLAINSRCDIR})"
+	cd ${BUILDDIR} && cp ${PLAINSRCFILES} "$(abspath ${PLAINSRCDIR})"
 endif
 ifneq ($(strip $(PLAINDOCFILES)),)
 	test -d "${PLAINDOCDIR}" || mkdir -p "${PLAINDOCDIR}"
-	cd ${BUILDDIR} && ${CP} ${PLAINDOCFILES} "$(abspath ${PLAINDOCDIR})"
+	cd ${BUILDDIR} && cp ${PLAINDOCFILES} "$(abspath ${PLAINDOCDIR})"
 endif
 ifneq ($(strip $(SCRIPTFILES)),)
 	test -d "${SCRIPTDIR}" || mkdir -p "${SCRIPTDIR}"
-	cd ${BUILDDIR} && ${CP} ${SCRIPTFILES} "$(abspath ${SCRIPTDIR})"
+	cd ${BUILDDIR} && cp ${SCRIPTFILES} "$(abspath ${SCRIPTDIR})"
 endif
 ifneq ($(strip $(SCRDOCFILES)),)
 	test -d "${SCRDOCDIR}" || mkdir -p "${SCRDOCDIR}"
-	cd ${BUILDDIR} && ${CP} ${SCRDOCFILES} "$(abspath ${SCRDOCDIR})"
+	cd ${BUILDDIR} && cp ${SCRDOCFILES} "$(abspath ${SCRDOCDIR})"
 endif
 	touch ${TEXMF}
 	-test -f ${TEXMF}/ls-R && texhash ${TEXMF} || true

File standalone.dtx

 %  \toprule
 %  \multicolumn{1}{l}{Build setting} &  Description & Default value \\
 %  \midrule
-%   quote & Character to be used to quote file names & \texttt{'} for Linux\&Mac OS X, \texttt{"} for Windows \\
 %   latex & \LaTeX\ compiler to be used & Same as main compiler \\
-%   latexoptions & Command line options for compiler & \scriptsize\showbuildvar{latexoptions} \\
+%   latexoptions & Command line options for compiler & \tiny\showbuildvar{latexoptions} \\
 %   jobname & Jobname for build compiler run & \scriptsize\showbuildvar{jobname} \\
+%   quote & Character to be used to quote file names & \verb|'| for Linux\,\&\,Mac OS X, \verb|"| for Windows \\
 %   command & Full build shell command & \scriptsize\showbuildvar{command} \\
 %   postcommand & Command executed after main command, to produce final output file & \scriptsize\texttt{dvips -o '\textbackslash file.eps' '\textbackslash file.dvi'} \normalsize (DVI mode only)\\
 %  \bottomrule\noalign{\smallskip}

File standalone.sty

 %    \begin{macrocode}
     \def\MiKTeX{MiKTeX}
     \@onelevel@sanitize\MiKTeX
-    \expandafter\def\expandafter\testmiktex\expandafter#\expandafter1\MiKTeX#2\relax{%
-            \ifx\empty#2\empty
+    \expandafter\def\expandafter\testmiktex\expandafter##\expandafter1\MiKTeX##2\relax{%
+            \ifx\empty##2\empty
                 \@tempswafalse
             \else
                 \@tempswatrue
     }
     \expandafter\expandafter
     \expandafter\testmiktex\expandafter\pdftexbanner\MiKTeX\relax\relax
-
     \fi
     \expandafter
     \endgroup
     \else
     \def\sa@build@quote{'}
     \fi
-    \fi
     \else
     \let\sa@build@quote\sa@convert@quote
     \fi
+    \fi
 }
 %    \end{macrocode}
 %

File test/buildquotes/main.tex

+\documentclass{article}
+\usepackage[mode=buildnew]{standalone}
+\usepackage{tikz}
+
+\begin{document}
+\begin{figure}
+\includestandalone{test3}
+\caption{test}
+\end{figure}
+asdfasdf
+\end{document}

File test/buildquotes/main_linux.tex

+\documentclass{article}
+\usepackage[mode=build,build={quote='}]{standalone}
+\usepackage{tikz}
+
+\begin{document}
+\begin{figure}
+\includestandalone{test3}
+\caption{test}
+\end{figure}
+asdfasdf
+\begin{figure}
+\includestandalone{"test with spaces"}
+\caption{test}
+\end{figure}
+asdfasdf
+\end{document}

File test/buildquotes/main_windows.tex

+\documentclass{article}
+\usepackage[mode=buildnew,build={quote="}]{standalone}
+\usepackage{tikz}
+
+\begin{document}
+\begin{figure}
+\includestandalone{test3}
+\caption{test}
+\end{figure}
+asdfasdf
+\begin{figure}
+\includestandalone{"test with spaces"}
+\caption{test}
+\end{figure}
+asdfasdf
+\end{document}

File test/buildquotes/standalone.cfg

+../standalone.cfg

File test/buildquotes/standalone.cls

+../standalone.cls

File test/buildquotes/standalone.sty

+../standalone.sty

File test/buildquotes/standalone.tex

+../standalone.tex

File test/buildquotes/test with spaces.tex

+\documentclass[tikz]{standalone}
+
+\begin{document}
+
+\begin{tikzpicture}
+\draw (0,0) -- (1,1);
+\end{tikzpicture}
+
+\end{document}

File test/buildquotes/test3.tex

+\documentclass[tikz]{standalone}
+
+\begin{document}
+
+\begin{tikzpicture}
+\draw (0,0) -- (1,1);
+\end{tikzpicture}
+
+\end{document}