bookloupe/gen-html-entities.sh
author ali <ali@juiblex.co.uk>
Fri Sep 06 22:56:49 2013 +0100 (2013-09-06)
changeset 84 eb0da244ad08
permissions -rw-r--r--
Update documentation for 1.93
     1 #!/bin/sh
     2 
     3 header()
     4 {
     5 cat << EOF
     6 /*
     7  * Automatically generated by gen-html-entities. Do not edit by hand.
     8  */
     9 
    10 struct {
    11     char *name;
    12     gunichar c;
    13 } HTMLentities[] = {
    14 EOF
    15 }
    16 
    17 parse_ent_file()
    18 {
    19     awk '/<!ENTITY .* CDATA/ { \
    20       c=substr($4,4,length($4)-5);
    21       print "    { \"" $2 "\", " c, "}," } \
    22       ' $1
    23 }
    24 
    25 footer()
    26 {
    27 cat << EOF
    28 };
    29 EOF
    30 }
    31 
    32 header
    33 for file; do
    34     parse_ent_file $file
    35 done
    36 footer