X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=utils%2Fdbdata.sh;h=51d88f8b0c8b68c81e4efce07b22d10355e01077;hb=c7318e88c35718dd81b62638ef198d20cfdc1ea3;hp=4dce3a089afa9122cf23fa7e07776c377d880a8b;hpb=0a052fac8b4d98a220c661c96de98a5382e6c699;p=m17n%2Fm17n-docs.git
diff --git a/utils/dbdata.sh b/utils/dbdata.sh
index 4dce3a0..51d88f8 100755
--- a/utils/dbdata.sh
+++ b/utils/dbdata.sh
@@ -1,9 +1,61 @@
#!/bin/sh
-FILE=$1
-while shift 1; do
- sed -n -e "/^(input-method/s/(input-method \([^ ]*\) \([^)]*\))/
$FILE \1 \2/p" $FILE
- echo
- sed -n -e '/^;;;/ s/^;;; *//p' -e '/^(description "/,/^")/ s/^(description "\|^")\|\\\|$//gp' $FILE
+IMDOC=`pwd`/utils/imdoc
+
+set `ls $1/$2`
+while [ $# -ge 1 ] ; do
FILE=$1
+ IM=`grep '^(input-method' $FILE`
+ if test -n "$IM"; then
+ if grep -q '^;;;' $FILE; then
+ sed -n -e '/^(input-method/s/(input-method \([^ ]*\) \([^ )]*\)\( \([^)]*\)\)*)/\1 \2 \4/p' $FILE | (read LNG NAME EXTRA
+ if test -z "NAME"; then
+ NAME=$EXTRA
+ fi
+ if test "$LNG" = "t"; then
+ LNG=generic
+ fi
+ if test "$NAME" = "nil"; then
+ HEADER=" $FILE (extra-name:$EXTRA, only for inclusion)"
+ HEADER2=""
+ else
+# title=`sed -n -e '/^(title/s/(title \("[^"]*"\).*$/\1/p' $FILE`
+ file=`basename $FILE`
+ base=`basename $file .mim`
+ dir=`dirname $FILE`
+ dir=`dirname $dir`
+ icon="$dir/icons/$base.png"
+ if [ -f "$icon" ] ; then
+ [ -f "images/icon-$base.png" ] || convert -resize 50% "$icon" "images/icon-$base.png"
+ fi
+ HEADER=" $base (language:$LNG name:$NAME @htmlonly"
+# if test -n "$title"; then
+# HEADER="$HEADER title:$title"
+# fi
+ HEADER2=""
+ HEADER3="@endhtmlonly"
+ HEADER4=")"
+ fi
+ echo "$HEADER"
+ if test -n "$HEADER2"; then
+ echo "$HEADER2"; echo "$HEADER3"; echo "$HEADER4"
+ fi
+ echo
+ echo "@htmlonly"
+ echo ""
+ echo "@endhtmlonly"
+ sed -n -e '/^;;; *@/ s/;;; *\(.*\)/\1/p' \
+ -e '/^;;; *[^ @]/ s,;;; *\(.*\),\1@n,p' $FILE
+ echo "@htmlonly"
+ echo "
"
+ echo "@endhtmlonly"
+ )
+ else
+ M17NDIR=/usr/share/m17n $IMDOC $FILE "$IM"
+ fi
+ else
+ echo
+ sed -n -e '/^;;;/ p' $FILE | sed -e '/^[^;]/ s/$/
/' -e '/^;;;/ s/^;;; *//'
+ fi
+ shift
done