summaryrefslogtreecommitdiff
path: root/webgen
diff options
context:
space:
mode:
authorPhilipp Schafft <lion@lion.leolix.org>2015-10-04 09:25:21 +0000
committerPhilipp Schafft <lion@lion.leolix.org>2017-03-27 02:11:19 +0000
commita7a5c051e4487a90c7407223ef27b1ef92939cc3 (patch)
tree081e63c55353ec12bac42483d66c0f0e75a3c959 /webgen
parent96e06d4fb8f685a8ecc5390f8eb8bc32ceab1be6 (diff)
added frame work for supporting preprocessors
Diffstat (limited to 'webgen')
-rwxr-xr-xwebgen31
1 files changed, 29 insertions, 2 deletions
diff --git a/webgen b/webgen
index c2649fc..d727a62 100755
--- a/webgen
+++ b/webgen
@@ -42,10 +42,30 @@ TPLS=tpl/
HEADER=header
END=end
PAGE_SUFFIX='.html'
-TEMPLATES="$1"
+TEMPLATES=''
DEFAULT_MENU='-menu-none'
+PREPROCESSOR='none'
# CODE:
+
+while [ ! -z "$1" ]
+do
+ case "$1" in
+ '--preprocessor')
+ PREPROCESSOR="$2"
+ shift
+ ;;
+ '--'*)
+ echo "Error: Unknown option: $1" >&2
+ exit 1
+ ;;
+ *)
+ TEMPLATES="$1"
+ ;;
+ esac
+ shift
+done
+
[ "$TEMPLATES" = '' ] && TEMPLATES="*"
if [ "$TEMPLATES" = '+' ]
@@ -65,7 +85,14 @@ cd $TPLS
cat_file() {
_file="$1"
- cat -- "$_file"
+ case "$PREPROCESSOR" in
+ none)
+ cat -- "$_file"
+ ;;
+ *)
+ echo "Error: Unknown preprocessor: $PREPROCESSOR" >&2
+ ;;
+ esac
}
gen_news()