added meta docs collection...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2021-09-03 03:28:04 +03:00
parent 1786c2ac8a
commit 1d9d47f43d
3 changed files with 80 additions and 58 deletions

View File

@ -27,12 +27,12 @@ TEX := lualatex $(ARGS)
texToDoc = \ texToDoc = \
@echo "texToDoc: $1 -> $2"; \ @echo "texToDoc: $1 -> $2"; \
cat $1 \ cat $1 \
| egrep '(^%%|^\\\\edef\\\\$*@[A-Z][A-Z]+)' \ | egrep '(^%$3|^\\\\edef\\\\$*@[A-Z][A-Z]+)' \
| sed 's/^\(\\\\edef\\\\\)$*@/%%\\1/'\ | sed 's/^\(\\\\edef\\\\\)$*@/%$3\\1/'\
| sed 's/%%%%%% \(.*\)/%%\\\\subsubsection{\1}/' \ | sed 's/%$3%%%% \(.*\)/%$3\\\\subsubsection{\1}/' \
| sed 's/%%%%% \(.*\)/%%\\\\subsection{\1}/' \ | sed 's/%$3%%% \(.*\)/%$3\\\\subsection{\1}/' \
| sed 's/%%%% \(.*\)/%%\\\\section{\1}/' \ | sed 's/%$3%% \(.*\)/%$3\\\\section{\1}/' \
| sed 's/%%\s\+>>\s\+\(.*\)/%%\\\\begin{verbatim} \1 \\\\end{verbatim}/' \ | sed 's/%$3\s\+>>\s\+\(.*\)/%$3\\\\begin{verbatim} \1 \\\\end{verbatim}/' \
| cut -c 3- - > $2 | cut -c 3- - > $2
@ -45,11 +45,20 @@ texToDoc = \
# NOTE: .sty and .cls are essentially the same in terms of documentation # NOTE: .sty and .cls are essentially the same in terms of documentation
# generation... # generation...
%.tex: %.sty %.tex: %.sty %-meta.tex
$(call texToDoc,$<,$@) $(call texToDoc,$<,$@,%)
%.tex: %.cls %.tex: %.cls %-meta.tex
$(call texToDoc,$<,$@) $(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)

View File

@ -43,7 +43,7 @@
%% %%
%% \def\MetaDoc{} %% \def\MetaDoc{}
%% \NewEnviron{MetaDocSection}{% %% \NewEnviron{MetaDocSection}{%
%% \edef\MetaDoc{% %% \global\edef\MetaDoc{%
%% \MetaDoc% %% \MetaDoc%
%% %%
%% \BODY}} %% \BODY}}
@ -933,24 +933,24 @@
\fi \fi
%% \DescribeMacro{\ResettableMacro\{..\}} %M \DescribeMacro{\ResettableMacro\{..\}}
% %
%% Create a resettable command. %M Create a resettable command.
% %
%% >> \ResettableMacro{<name>}{<code>} %M >> \ResettableMacro{<name>}{<code>}
%% >> \ResettableMacro{<name>}[<arg-count>]{<code>} %M >> \ResettableMacro{<name>}[<arg-count>]{<code>}
%% >> \ResettableMacro{<name>}[<arg-count>][<default>]{<code>} %M >> \ResettableMacro{<name>}[<arg-count>][<default>]{<code>}
% %
%% This is similar to |\newcommand{..}| but will define two commands: %M This is similar to |\newcommand{..}| but will define two commands:
%% %M
%% >> \<name>{..} %M >> \<name>{..}
%% %M
%% >> \reset<name> %M >> \reset<name>
%% %M
%% |\<name>{..}| can be freely redefined or undefined by user. %M |\<name>{..}| can be freely redefined or undefined by user.
%% %M
%% |\reset<name>| will reset |\<name>{..}| to its original state. %M |\reset<name>| will reset |\<name>{..}| to its original state.
%% %M
% parse args... % parse args...
\def\ResettableMacro#1{% \def\ResettableMacro#1{%
\@ifnextchar[{% \@ifnextchar[{%
@ -1016,6 +1016,12 @@
% meta helpers... % 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... % XXX figure out how to align and pad without messing with geometry...
\newcommand\CellContentOptions[1]{% \newcommand\CellContentOptions[1]{%
%% align... %% align...
@ -1036,9 +1042,19 @@
% \expandafter\edef\csname photobook@#1@padding\endcsname{##1}}% % \expandafter\edef\csname photobook@#1@padding\endcsname{##1}}%
} }
%M \DescribeEnv{CellContent}
%M \DescribeEnv{CellContent*}
% %
% >> \begin{CellContent}[<parent-align>]{<name>} ... \end{CellContent} %M \EXPERIMENTAL
% >> \begin{CellContent*}[<parent-align>]{<name>}{<width>}{<height>} ... \end{CellContent} %M
%M Standard cell content wrapper, used by |inlinecell|.
%
%M >> \begin{CellContent}[<parent-align>]{<name>} ... \end{CellContent}
%M >> \begin{CellContent*}[<parent-align>]{<name>}{<width>}{<height>} ... \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... % XXX TEST params...
\newenvironment{CellContent}[2][t]{% \newenvironment{CellContent}[2][t]{%
@ -1052,15 +1068,20 @@
valign=#1}% valign=#1}%
\ignorespaces% \ignorespaces%
}{% }{%
% prevent empty "minipage" from collapsing... % NOTE: prevent empty "minipage" from collapsing...
% XXX does this affect the height???
\hspace{\fill}% \hspace{\fill}%
\end{adjustbox}} \end{adjustbox}}
%M \DescribeEnv{CellContent}
%M \DescribeEnv{CellContent*}
% %
% >> \begin{MinipageCellContent}[<parent-align>]{<name>} ... \end{MinipageCellContent} %M \EXPERIMENTAL
% >> \begin{MinipageCellContent*}[<parent-align>]{<name>}{<width>}{<height>} ... \end{MinipageCellContent} %M
%M Like |CellContent| / |CellContent*| but will use |minipage| as the wrapper.
%
%M >> \begin{MinipageCellContent}[<parent-align>]{<name>} ... \end{MinipageCellContent}
%M >> \begin{MinipageCellContent*}[<parent-align>]{<name>}{<width>}{<height>} ... \end{MinipageCellContent}
% %
% XXX TEST... % XXX TEST...
% XXX doc... % XXX doc...
@ -2722,19 +2743,18 @@
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% meta-commands... % meta-commands...
% \DescribeMacro{\ImagePageTemplate\{..\}} %M \DescribeMacro{\ImagePageTemplate\{..\}}
% %
% >> \ImagePageTemplate{<name>}{<code>} %M >> \ImagePageTemplate{<name>}{<code>}
% %
% This will define two commands: %M This will define two commands:
% %
% >> \<name>[<options>]{<caption>}{<code>} %M >> \<name>[<options>]{<caption>}{<code>}
% %M >> \<name>*[<options>]{<caption>}{<code>}
% >> \<name>*[<options>]{<caption>}{<code>}
%
% |\<name>{..}| will use |\<name>Caption{..}| template command to typeset
% the image caption while |\<name>*{..}| will show the caption as-is.
% %
%M |\<name>{..}| will use |\<name>Caption{..}| template command to typeset
%M the image caption while |\<name>*{..}| will show the caption as-is.
%M
\def\ImagePageTemplate#1#2{% \def\ImagePageTemplate#1#2{%
% handle <macro>* version... % handle <macro>* version...
\expandafter\def\csname #1\endcsname{\@ifstar{% \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??? % XXX should digits/rounding be configurable???
\newcommand\photobook@TemplateCell[2][mm]{ \newcommand\photobook@TemplateCell[2][mm]{

View File

@ -16,6 +16,7 @@
\usepackage{lipsum} \usepackage{lipsum}
\usepackage{ragged2e} \usepackage{ragged2e}
\setlength\parindent{0pt} \setlength\parindent{0pt}
\edef\TestImage{DSC00403-2} \edef\TestImage{DSC00403-2}
@ -23,26 +24,12 @@
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\edef\addValue{}
\def\add#1{
\edef\addValue{
\addValue
#1 \\ }}
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\begin{document} \begin{document}
\add{abc}
\add{def}
\add{ghi}
---
\addValue
\end{document} \end{document}