| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 function preamble { | 6 function preamble { |
| 7 | 7 |
| 8 encoding="$1" | 8 encoding="$1" |
| 9 cat <<PREAMBLE | 9 cat <<PREAMBLE |
| 10 # *************************************************************************** | 10 # *************************************************************************** |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 # The list of html5 encodings. Note that iso-8859-8-i is not listed here | 31 # The list of html5 encodings. Note that iso-8859-8-i is not listed here |
| 32 # because its mapping table is exactly the same as iso-8859-8. The difference | 32 # because its mapping table is exactly the same as iso-8859-8. The difference |
| 33 # is BiDi handling (logical vs visual). | 33 # is BiDi handling (logical vs visual). |
| 34 encodings="ibm866 iso-8859-2 iso-8859-3 iso-8859-4 iso-8859-5 iso-8859-6\ | 34 encodings="ibm866 iso-8859-2 iso-8859-3 iso-8859-4 iso-8859-5 iso-8859-6\ |
| 35 iso-8859-7 iso-8859-8 iso-8859-10 iso-8859-13 iso-8859-14\ | 35 iso-8859-7 iso-8859-8 iso-8859-10 iso-8859-13 iso-8859-14\ |
| 36 iso-8859-15 iso-8859-16 koi8-r koi8-u macintosh\ | 36 iso-8859-15 iso-8859-16 koi8-r koi8-u macintosh\ |
| 37 windows-874 windows-1250 windows-1251 windows-1252 windows-1253\ | 37 windows-874 windows-1250 windows-1251 windows-1252 windows-1253\ |
| 38 windows-1254 windows-1255 windows-1256 windows-1257 windows-1258\ | 38 windows-1254 windows-1255 windows-1256 windows-1257 windows-1258\ |
| 39 x-mac-cyrillic" | 39 x-mac-cyrillic" |
| 40 | 40 |
| 41 ENCODING_DIR="$(dirname $0)/../source/data/mappings" | 41 ENCODING_DIR="$(dirname "$0")/../source/data/mappings" |
| 42 for e in ${encodings} | 42 for e in ${encodings} |
| 43 do | 43 do |
| 44 output="${ENCODING_DIR}/${e}-html.ucm" | 44 output="${ENCODING_DIR}/${e}-html.ucm" |
| 45 index="index-${e}.txt" | 45 index="index-${e}.txt" |
| 46 indexurl="https://encoding.spec.whatwg.org/index-${e}.txt" | 46 indexurl="https://encoding.spec.whatwg.org/index-${e}.txt" |
| 47 curl -o ${index} "${indexurl}" | 47 curl -o ${index} "${indexurl}" |
| 48 preamble ${e} > ${output} | 48 preamble ${e} > ${output} |
| 49 awk 'BEGIN \ | 49 awk 'BEGIN \ |
| 50 { \ | 50 { \ |
| 51 for (i=0; i < 0x80; ++i) \ | 51 for (i=0; i < 0x80; ++i) \ |
| 52 { \ | 52 { \ |
| 53 printf("<U%04X> \\x%02X |0\n", i, i);} \ | 53 printf("<U%04X> \\x%02X |0\n", i, i);} \ |
| 54 } \ | 54 } \ |
| 55 !/^#/ && !/^$/ \ | 55 !/^#/ && !/^$/ \ |
| 56 { | 56 { |
| 57 printf ("<U%4s> \\x%02X |0\n", substr($2, 3), $1 + 0x80); \ | 57 printf ("<U%4s> \\x%02X |0\n", substr($2, 3), $1 + 0x80); \ |
| 58 }' ${index} | sort >> ${output} | 58 }' ${index} | sort >> ${output} |
| 59 echo 'END CHARMAP' >> ${output} | 59 echo 'END CHARMAP' >> ${output} |
| 60 rm ${index} | 60 rm ${index} |
| 61 done | 61 done |
| 62 | 62 |
| OLD | NEW |