mirror of
https://github.com/flynx/photobook.git
synced 2025-10-29 10:20:08 +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
|
% $ 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
|
% XXX Q: do we add the pdf to the repo and if so, should it be
|
||||||
% compressed (diff-able) or uncompressed (blob)??
|
% compressed (diff-able) or uncompressed (blob)??
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
CMD="$0 $@"
|
||||||
|
|
||||||
SCRIPT_NAME=$(basename $0)
|
SCRIPT_NAME=$(basename $0)
|
||||||
|
|
||||||
printusage(){
|
printusage(){
|
||||||
@ -18,6 +20,7 @@ printhelp(){
|
|||||||
echo " -p | --prefix PREFIX"
|
echo " -p | --prefix PREFIX"
|
||||||
echo " Set the doc comment PREFIX (default: \"%\")"
|
echo " Set the doc comment PREFIX (default: \"%\")"
|
||||||
echo " -s | --strip Strip docs out"
|
echo " -s | --strip Strip docs out"
|
||||||
|
echo " -n | --no-msg Don't add the \"generated with\" message to output"
|
||||||
echo
|
echo
|
||||||
echo "This will:"
|
echo "This will:"
|
||||||
echo " - read the INPUT"
|
echo " - read the INPUT"
|
||||||
@ -57,6 +60,17 @@ printerror(){
|
|||||||
printusage
|
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
|
STRIP_DOC=1
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-n|--no-msg)
|
||||||
|
NO_MSG=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
# handle unknown options...
|
# handle unknown options...
|
||||||
-*|--*)
|
-*|--*)
|
||||||
@ -108,6 +126,8 @@ MODULE=${MODULE/.*/}
|
|||||||
|
|
||||||
# make docs...
|
# make docs...
|
||||||
if [ -z $STRIP_DOC ] ; then
|
if [ -z $STRIP_DOC ] ; then
|
||||||
|
printmsg "Documentation" \
|
||||||
|
> "$OUTPUT"
|
||||||
cat "$INPUT" \
|
cat "$INPUT" \
|
||||||
| egrep '(^%'$PREFIX'|^\\edef\\'$MODULE'@[A-Z][A-Z]+)' \
|
| egrep '(^%'$PREFIX'|^\\edef\\'$MODULE'@[A-Z][A-Z]+)' \
|
||||||
| sed 's/^\(\\edef\\\)'$MODULE'@/%'$PREFIX'\1/' \
|
| 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'%% \(.*\)/%'$PREFIX'\\section{\1}\\label{sec:\1}/' \
|
||||||
| sed 's/%'$PREFIX'\s\+>>\s\+\(.*\)/%'$PREFIX'\\begin{verbatim} \1 \\end{verbatim}/' \
|
| sed 's/%'$PREFIX'\s\+>>\s\+\(.*\)/%'$PREFIX'\\begin{verbatim} \1 \\end{verbatim}/' \
|
||||||
| cut -c 3- - \
|
| cut -c 3- - \
|
||||||
> "$OUTPUT"
|
>> "$OUTPUT"
|
||||||
|
|
||||||
# make stripped code...
|
# make stripped code...
|
||||||
else
|
else
|
||||||
|
printmsg "Stripped code" \
|
||||||
|
> "$OUTPUT"
|
||||||
cat "$INPUT" \
|
cat "$INPUT" \
|
||||||
| egrep -v '%'$PREFIX'' \
|
| egrep -v '%'$PREFIX'' \
|
||||||
| egrep -v '^(\s*%)?\s*$' \
|
| egrep -v '^(\s*%)?\s*$' \
|
||||||
> "$OUTPUT"
|
>> "$OUTPUT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user