1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/bookloupe/gen-html-entities.sh Thu Oct 17 08:30:04 2013 +0100
1.3 @@ -0,0 +1,36 @@
1.4 +#!/bin/sh
1.5 +
1.6 +header()
1.7 +{
1.8 +cat << EOF
1.9 +/*
1.10 + * Automatically generated by gen-html-entities. Do not edit by hand.
1.11 + */
1.12 +
1.13 +struct {
1.14 + char *name;
1.15 + gunichar c;
1.16 +} HTMLentities[] = {
1.17 +EOF
1.18 +}
1.19 +
1.20 +parse_ent_file()
1.21 +{
1.22 + awk '/<!ENTITY .* CDATA/ { \
1.23 + c=substr($4,4,length($4)-5);
1.24 + print " { \"" $2 "\", " c, "}," } \
1.25 + ' $1
1.26 +}
1.27 +
1.28 +footer()
1.29 +{
1.30 +cat << EOF
1.31 +};
1.32 +EOF
1.33 +}
1.34 +
1.35 +header
1.36 +for file; do
1.37 + parse_ent_file $file
1.38 +done
1.39 +footer