diff --git a/Makefile b/Makefile index 1238380..8b2075b 100644 --- a/Makefile +++ b/Makefile @@ -27,12 +27,12 @@ TEX := lualatex $(ARGS) texToDoc = \ @echo "texToDoc: $1 -> $2"; \ cat $1 \ - | egrep '(^%%|^\\\\edef\\\\$*@[A-Z][A-Z]+)' \ - | sed 's/^\(\\\\edef\\\\\)$*@/%%\\1/'\ - | sed 's/%%%%%% \(.*\)/%%\\\\subsubsection{\1}/' \ - | sed 's/%%%%% \(.*\)/%%\\\\subsection{\1}/' \ - | sed 's/%%%% \(.*\)/%%\\\\section{\1}/' \ - | sed 's/%%\s\+>>\s\+\(.*\)/%%\\\\begin{verbatim} \1 \\\\end{verbatim}/' \ + | egrep '(^%$3|^\\\\edef\\\\$*@[A-Z][A-Z]+)' \ + | sed 's/^\(\\\\edef\\\\\)$*@/%$3\\1/'\ + | sed 's/%$3%%%% \(.*\)/%$3\\\\subsubsection{\1}/' \ + | sed 's/%$3%%% \(.*\)/%$3\\\\subsection{\1}/' \ + | sed 's/%$3%% \(.*\)/%$3\\\\section{\1}/' \ + | sed 's/%$3\s\+>>\s\+\(.*\)/%$3\\\\begin{verbatim} \1 \\\\end{verbatim}/' \ | cut -c 3- - > $2 @@ -45,11 +45,20 @@ texToDoc = \ # NOTE: .sty and .cls are essentially the same in terms of documentation # generation... -%.tex: %.sty - $(call texToDoc,$<,$@) +%.tex: %.sty %-meta.tex + $(call texToDoc,$<,$@,%) -%.tex: %.cls - $(call texToDoc,$<,$@) +%.tex: %.cls %-meta.tex + $(call texToDoc,$<,$@,%) + + +# NOTE: this is a bit ugly, but allot less so than trying to push \verb +# into a LaTeX macro/env and then getting it out again in one pice... +%-meta.tex: %.sty + $(call texToDoc,$<,$@,M) + +%-meta.tex: %.cls + $(call texToDoc,$<,$@,M) diff --git a/photobook.cls b/photobook.cls index 3ff0d16..6adc961 100644 --- a/photobook.cls +++ b/photobook.cls @@ -43,7 +43,7 @@ %% %% \def\MetaDoc{} %% \NewEnviron{MetaDocSection}{% -%% \edef\MetaDoc{% +%% \global\edef\MetaDoc{% %% \MetaDoc% %% %% \BODY}} @@ -933,24 +933,24 @@ \fi -%% \DescribeMacro{\ResettableMacro\{..\}} +%M \DescribeMacro{\ResettableMacro\{..\}} % -%% Create a resettable command. +%M Create a resettable command. % -%% >> \ResettableMacro{}{} -%% >> \ResettableMacro{}[]{} -%% >> \ResettableMacro{}[][]{} +%M >> \ResettableMacro{}{} +%M >> \ResettableMacro{}[]{} +%M >> \ResettableMacro{}[][]{} % -%% This is similar to |\newcommand{..}| but will define two commands: -%% -%% >> \{..} -%% -%% >> \reset -%% -%% |\{..}| can be freely redefined or undefined by user. -%% -%% |\reset| will reset |\{..}| to its original state. -%% +%M This is similar to |\newcommand{..}| but will define two commands: +%M +%M >> \{..} +%M +%M >> \reset +%M +%M |\{..}| can be freely redefined or undefined by user. +%M +%M |\reset| will reset |\{..}| to its original state. +%M % parse args... \def\ResettableMacro#1{% \@ifnextchar[{% @@ -1016,6 +1016,12 @@ % meta helpers... +%M \DescribeMacro{\CellContentOptions\{..\}} +% +%M \EXPERIMENTAL +%M +%M Define standard cell options. +%M % XXX figure out how to align and pad without messing with geometry... \newcommand\CellContentOptions[1]{% %% align... @@ -1036,9 +1042,19 @@ % \expandafter\edef\csname photobook@#1@padding\endcsname{##1}}% } +%M \DescribeEnv{CellContent} +%M \DescribeEnv{CellContent*} % -% >> \begin{CellContent}[]{} ... \end{CellContent} -% >> \begin{CellContent*}[]{}{}{} ... \end{CellContent} +%M \EXPERIMENTAL +%M +%M Standard cell content wrapper, used by |inlinecell|. +% +%M >> \begin{CellContent}[]{} ... \end{CellContent} +%M >> \begin{CellContent*}[]{}{}{} ... \end{CellContent} +% +%M The star version requires width/height to be manually passed while the +%M non-star version will get the values from |\cellwidth| and |\cellheight| +%M respectively. % % XXX TEST params... \newenvironment{CellContent}[2][t]{% @@ -1052,15 +1068,20 @@ valign=#1}% \ignorespaces% }{% - % prevent empty "minipage" from collapsing... - % XXX does this affect the height??? + % NOTE: prevent empty "minipage" from collapsing... \hspace{\fill}% \end{adjustbox}} +%M \DescribeEnv{CellContent} +%M \DescribeEnv{CellContent*} % -% >> \begin{MinipageCellContent}[]{} ... \end{MinipageCellContent} -% >> \begin{MinipageCellContent*}[]{}{}{} ... \end{MinipageCellContent} +%M \EXPERIMENTAL +%M +%M Like |CellContent| / |CellContent*| but will use |minipage| as the wrapper. +% +%M >> \begin{MinipageCellContent}[]{} ... \end{MinipageCellContent} +%M >> \begin{MinipageCellContent*}[]{}{}{} ... \end{MinipageCellContent} % % XXX TEST... % XXX doc... @@ -2722,19 +2743,18 @@ % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % meta-commands... -% \DescribeMacro{\ImagePageTemplate\{..\}} +%M \DescribeMacro{\ImagePageTemplate\{..\}} % -% >> \ImagePageTemplate{}{} +%M >> \ImagePageTemplate{}{} % -% This will define two commands: +%M This will define two commands: % -% >> \[]{}{} -% -% >> \*[]{}{} -% -% |\{..}| will use |\Caption{..}| template command to typeset -% the image caption while |\*{..}| will show the caption as-is. +%M >> \[]{}{} +%M >> \*[]{}{} % +%M |\{..}| will use |\Caption{..}| template command to typeset +%M the image caption while |\*{..}| will show the caption as-is. +%M \def\ImagePageTemplate#1#2{% % handle * version... \expandafter\def\csname #1\endcsname{\@ifstar{% @@ -3357,14 +3377,20 @@ %---------------------------------------------------------------------- -%%%% Meta macros +%%%% Meta macros and environments +% +%% These macros and environments are used internally to help define cells +%% and templates and thus can be useful when extending the functionality +%% of this class both when authoring styles and when creating user +%% macros/templates. %% -%% \MetaDoc +%% \input{photobook-meta} %% + %---------------------------------------------------------------------- -%%%% Miscellaneous macros +%%%% Miscellaneous % XXX should digits/rounding be configurable??? \newcommand\photobook@TemplateCell[2][mm]{ diff --git a/workflow/test.tex b/workflow/test.tex index 8c85486..7ba508d 100644 --- a/workflow/test.tex +++ b/workflow/test.tex @@ -16,6 +16,7 @@ \usepackage{lipsum} \usepackage{ragged2e} + \setlength\parindent{0pt} \edef\TestImage{DSC00403-2} @@ -23,26 +24,12 @@ % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\edef\addValue{} -\def\add#1{ - \edef\addValue{ - \addValue - #1 \\ }} % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \begin{document} -\add{abc} -\add{def} -\add{ghi} - ---- - -\addValue - - \end{document}