summaryrefslogblamecommitdiffstats
path: root/modules/bibles/grc/whnu/convert.sh
blob: d4c443a723c48a311e59b37a58b24f4b42aef6d2 (plain) (tree)



























                                                                                                              
#!/bin/bash
FILENAME=$(basename $1)
BOOK=${FILENAME%.*}
vn="0"
sed -e 's/
//g' $1| while read line; do
	for i in $line; do
		if [[ "$i" =~ [0-9]+:[0-9]+ ]]; then
			echo; echo \$\$\$$BOOK $i
		elif [[ "$i" =~ \{.*\} ]]; then
			echo -n "<w lemma=\"strong:$lemma\" morph=\"robinson:${i:1:-1}"
			if [[ "$sm" -ne "" ]]; then echo -n " strongsMorph:$sm"; fi
			echo -n "\">$txt</w> "
			sm=""
		elif [[ "$i" =~ [0-9]+ ]]; then
			if [[ "$i" > "5624" ]]; then sm=$i
			else lemma=$i; fi
		elif [[ "$i" = "|" ]]; then
			((vn = vn + 1))
			if [[ "$vn" > "1" ]]; then echo -n "</seg>"; fi
			if [[ "$vn" < "3" ]]; then echo -n "<seg type=\"x-variant\" subType=\"x-$vn\">"
			else vn="0"; fi
		elif [[ "$i" =~ [a-z]+ ]]; then
			txt=$(echo $i |./symbgreektoutf16 -robinson| uconv --from-code UTF-16 --to-code UTF-8)
		else
			echo NOT HANDLED!: $i
		fi
	done
done