|
@@ -19,18 +19,40 @@ build1() {
|
19
|
19
|
#
|
20
|
20
|
# Process one skeleton
|
21
|
21
|
#
|
22
|
|
- local srcpath dstpath
|
23
|
|
- srcpath=$1
|
24
|
|
- dstpath=$2
|
25
|
|
- test -n "$dstpath" || dstpath=${srcpath%.skel}
|
26
|
|
- case $dstpath in
|
27
|
|
- *.md) <"$srcpath" expand_includes | expand_variables "vars" >"$dstpath" ;;
|
28
|
|
- *) <"$srcpath" expand_variables "vars" >"$dstpath" ;;
|
29
|
|
- esac
|
|
22
|
+ local srcpath="$1"
|
|
23
|
+ local dstpath="$2"
|
|
24
|
+ local ftype="$3"
|
|
25
|
+ test -n "$dstpath" || dstpath=${srcpath%.skel}
|
|
26
|
+ test -n "$ftype" || ftype=$(guess_ftype "$dstpath")
|
|
27
|
+ <"$srcpath" build1_ftype "$ftype" >"$dstpath"
|
30
|
28
|
mkdir -p "$MKIT_LOCAL"
|
31
|
29
|
echo "$dstpath" >> "$MKIT_LOCAL/built.lst"
|
32
|
30
|
}
|
33
|
31
|
|
|
32
|
+guess_ftype() {
|
|
33
|
+ #
|
|
34
|
+ # Guess file type from destination path $1
|
|
35
|
+ #
|
|
36
|
+ local dstpath="$1"
|
|
37
|
+ case $dstpath in
|
|
38
|
+ *.md) echo markdown ;;
|
|
39
|
+ *) echo MKIT_COMMON ;;
|
|
40
|
+ esac
|
|
41
|
+}
|
|
42
|
+
|
|
43
|
+build1_ftype() {
|
|
44
|
+ #
|
|
45
|
+ # Build a file of type $1
|
|
46
|
+ #
|
|
47
|
+ local ftype="$1"
|
|
48
|
+ case $ftype in
|
|
49
|
+ MKIT_COMMON) expand_variables "vars" ;;
|
|
50
|
+ markdown) expand_includes | expand_variables "vars" ;;
|
|
51
|
+ rpmstuff) expand_variables "vars" "rpmstuff:vars" ;;
|
|
52
|
+ *) die "unknown file type: $ftype" ;;
|
|
53
|
+ esac
|
|
54
|
+}
|
|
55
|
+
|
34
|
56
|
build_manpages() {
|
35
|
57
|
local manfile mdfile
|
36
|
58
|
if command -v ronn >/dev/null;
|