bookloupe/gen-html-entities.sh
author ali <ali@juiblex.co.uk>
Thu Dec 05 10:58:41 2013 +0000 (2013-12-05)
changeset 219 98fc47ee1beb
permissions -rw-r--r--
Added tag 2.0.69 for changeset b01d4a64a929
     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