mirror of
https://github.com/flynx/photobook.git
synced 2025-10-28 18:00:10 +00:00
better doc of workflow...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
6d6eaf579d
commit
1d1a22f19c
@ -24,6 +24,12 @@
|
||||
% $ make doc
|
||||
%
|
||||
%
|
||||
% NOTE: in a stripped code install this file may contain only code and
|
||||
% code comments, in this case, to see the docs refer to either the
|
||||
% source or the actual documentation/pdf.
|
||||
% NOTE: the stripped code file is auto-generated, it is not recommended
|
||||
% to edit it directly, edit the source instead.
|
||||
%
|
||||
%
|
||||
% XXX Q: do we add the pdf to the repo and if so, should it be
|
||||
% compressed (diff-able) or uncompressed (blob)??
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
CMD="$0 $@"
|
||||
|
||||
SCRIPT_NAME=$(basename $0)
|
||||
|
||||
printusage(){
|
||||
@ -18,6 +20,7 @@ printhelp(){
|
||||
echo " -p | --prefix PREFIX"
|
||||
echo " Set the doc comment PREFIX (default: \"%\")"
|
||||
echo " -s | --strip Strip docs out"
|
||||
echo " -n | --no-msg Don't add the \"generated with\" message to output"
|
||||
echo
|
||||
echo "This will:"
|
||||
echo " - read the INPUT"
|
||||
@ -57,6 +60,17 @@ printerror(){
|
||||
printusage
|
||||
}
|
||||
|
||||
printmsg(){
|
||||
# print message...
|
||||
if [ -z $NO_MSG ] ; then
|
||||
echo "%----------------------------------------------------------------------"
|
||||
echo "% $1 file generated by:"
|
||||
echo "% $CMD"
|
||||
echo "% NOTE: multiple messages indicate multiple runs."
|
||||
echo "%----------------------------------------------------------------------"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@ -79,6 +93,10 @@ while true ; do
|
||||
STRIP_DOC=1
|
||||
shift
|
||||
;;
|
||||
-n|--no-msg)
|
||||
NO_MSG=1
|
||||
shift
|
||||
;;
|
||||
|
||||
# handle unknown options...
|
||||
-*|--*)
|
||||
@ -108,6 +126,8 @@ MODULE=${MODULE/.*/}
|
||||
|
||||
# make docs...
|
||||
if [ -z $STRIP_DOC ] ; then
|
||||
printmsg "Documentation" \
|
||||
> "$OUTPUT"
|
||||
cat "$INPUT" \
|
||||
| egrep '(^%'$PREFIX'|^\\edef\\'$MODULE'@[A-Z][A-Z]+)' \
|
||||
| sed 's/^\(\\edef\\\)'$MODULE'@/%'$PREFIX'\1/' \
|
||||
@ -116,14 +136,16 @@ if [ -z $STRIP_DOC ] ; then
|
||||
| sed 's/%'$PREFIX'%% \(.*\)/%'$PREFIX'\\section{\1}\\label{sec:\1}/' \
|
||||
| sed 's/%'$PREFIX'\s\+>>\s\+\(.*\)/%'$PREFIX'\\begin{verbatim} \1 \\end{verbatim}/' \
|
||||
| cut -c 3- - \
|
||||
> "$OUTPUT"
|
||||
>> "$OUTPUT"
|
||||
|
||||
# make stripped code...
|
||||
else
|
||||
printmsg "Stripped code" \
|
||||
> "$OUTPUT"
|
||||
cat "$INPUT" \
|
||||
| egrep -v '%'$PREFIX'' \
|
||||
| egrep -v '^(\s*%)?\s*$' \
|
||||
> "$OUTPUT"
|
||||
>> "$OUTPUT"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user