mirror of
https://github.com/flynx/photobook.git
synced 2025-10-29 02:10:08 +00:00
now cls2doc.sh behaves as it should, and consequently the interface code now is about 10x the actual doc parser code =)
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
2faafc2509
commit
95c9f86892
4
Makefile
4
Makefile
@ -51,10 +51,10 @@ DOC := ./scripts/cls2tex.sh
|
||||
# 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
|
||||
$(DOC) $< $@ M
|
||||
$(DOC) -p M $< $@
|
||||
|
||||
%-meta.tex: %.cls
|
||||
$(DOC) $< $@ M
|
||||
$(DOC) -p M $< $@
|
||||
|
||||
|
||||
|
||||
|
||||
@ -151,9 +151,9 @@
|
||||
%% be aligned relative to a page, it can fill a page, a cell can even be
|
||||
%% horizontally split to fill several pages (how spreads are implemented).
|
||||
%%
|
||||
%% On top of the |cell|, page and spread concepts |photobook| also builds
|
||||
%% a set of configurable high level macros/templates for common use cases
|
||||
%% like full bleed image spreads, etc.
|
||||
%% On top of the |cell|, page, and spread concepts, |photobook| also builds
|
||||
%% a set of configurable high level macros and templates for common use
|
||||
%% cases like full bleed image spreads, etc.
|
||||
%
|
||||
%
|
||||
%%%% Usage
|
||||
|
||||
@ -1,16 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SCRIPT_NAME=$(basename $0)
|
||||
|
||||
printusage(){
|
||||
echo "Usage:"
|
||||
echo " $SCRIPT_NAME [OPTIONS] INPUT OUTPUT"
|
||||
}
|
||||
|
||||
printerror(){
|
||||
echo Error: $@
|
||||
echo
|
||||
printusage
|
||||
}
|
||||
|
||||
printhelp(){
|
||||
echo "Generate docs from latex package/class"
|
||||
echo
|
||||
echo "Usage: $(basename $0) [-h|--help] INPUT OUTPUT [PREFIX]"
|
||||
printusage
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " -h | --help Show this message and exit"
|
||||
echo " -p | --prefix PREFIX"
|
||||
echo " Set the doc comment PREFIX (default: \"%\")"
|
||||
echo
|
||||
echo "This will:"
|
||||
echo " - read the INPUT"
|
||||
echo " - keep lines starting with \\def\\<module-name>@[A-Z]\\+"
|
||||
echo " - keep lines starting with '%%'"
|
||||
echo " - %%%%% Text -> \\subsection(Text)"
|
||||
echo " - %%%% Text -> \\section(Text)"
|
||||
echo " - %% >> code -> \\begin{verbatim}code\\end{verbatim}"
|
||||
echo " - write the result to OUTPUT"
|
||||
echo
|
||||
echo "PREFIX can replace the second \"%\" in the above patterns to make it"
|
||||
echo "possible to integrate multiple layers of documentation in one file"
|
||||
@ -28,13 +48,29 @@ printhelp(){
|
||||
echo " in both the repo and in installed form, so .dtx is not used."
|
||||
}
|
||||
|
||||
# args/defaults...
|
||||
|
||||
# defaults...
|
||||
PREFIX=%
|
||||
|
||||
# args...
|
||||
while true ; do
|
||||
case $1 in
|
||||
-h|--help)
|
||||
printhelp
|
||||
exit
|
||||
;;
|
||||
-p|--prefix)
|
||||
shift
|
||||
PREFIX=$1
|
||||
shift
|
||||
continue
|
||||
;;
|
||||
|
||||
# handle unknown options...
|
||||
-*|--*)
|
||||
printerror "unknown option \"$1\""
|
||||
exit
|
||||
;;
|
||||
|
||||
*)
|
||||
break
|
||||
@ -46,11 +82,12 @@ INPUT=$1
|
||||
|
||||
OUTPUT=$2
|
||||
|
||||
PREFIX=$3
|
||||
if [ -z $PREFIX ] ; then
|
||||
PREFIX=%
|
||||
if [ -z $INPUT ] || [ -z $OUTPUT ] ; then
|
||||
printerror "need both INPUT and OUTPUT present."
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
# generate the module name...
|
||||
MODULE=$(basename "$INPUT")
|
||||
MODULE=${MODULE/.*/}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user