• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /usr/bin/perl -w
2
3#
4# Copyright (C) 2017 and later: Unicode, Inc. and others.
5# License & terms of use: http://www.unicode.org/copyright.html
6#
7
8use strict;
9
10
11my $locale = $ARGV[0];
12
13
14my $long_name = `/home/weiv/src/icu/source/extra/colprobe/longname $locale`;
15my $pageTitle = $locale."_collation";
16my $filename = $pageTitle.".html";
17
18open TABLE, ">$filename";
19
20
21print TABLE <<"EndOfTemplate";
22<html>
23
24<head>
25<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
26<title>$pageTitle</title>
27<style>
28         <!--
29         table        { border-spacing: 0; border-collapse: collapse; width: 100%;
30               border: 1px solid black }
31td, th       { width: 10%; border-spacing: 0; border-collapse: collapse; color: black;
32               vertical-align: top; border: 1px solid black }
33-->
34     </style>
35</head>
36
37<body bgcolor="#FFFFFF">
38
39<p><b><font color="#FF0000">Collation:</font> $locale ($long_name) <a href="http://oss.software.ibm.com/cgi-bin/icu/lx/en/?_=$locale">Demo</a>,
40
41<a href="../all_diff_xml/comparison_charts.html">Cover
42Page</a>, <a href="../all_diff_xml/index.html">Index</a></b></p>
43<table>
44  <tr>
45EndOfTemplate
46
47my $dirCommon = "common";
48my $refCommon = $dirCommon."/UCARules.txt";
49my $nameCommon = $dirCommon."/".$locale."_collation.html";
50my $colorCommon = "#AD989D";
51
52my $loc;
53
54if(!(-e $nameCommon)) {
55  $locale =~ /_/;
56  $loc = $`;
57  $nameCommon = "$dirCommon/$loc"."_collation.html";
58}
59print TABLE "    <th bgcolor=\"$colorCommon\">COMMON (<a href=\"$refCommon\">UCA</a> <a href=\"../$dirCommon/xml/$locale.xml\">xml</a>)</th>\n";
60
61my $dirLinux = "linux";
62my $refLinux = $dirLinux."/".$locale.".utf8_default_raw.html";
63my $rawLinux = $dirLinux."/".$locale.".utf8_raw.html";
64my $defLinux = $dirLinux."/".$locale;
65my $nameLinux = "$dirLinux/$locale".".utf8_collation.html";
66my $colorLinux = "#1191F1";
67
68print TABLE "    <th bgcolor=\"$colorLinux\">LINUX (";
69if (!(-e $nameLinux)) {
70#try the variant that has @euro stuck in
71  $nameLinux = "$dirLinux/$locale".'.utf8@euro_collation.html';
72  if(-e $nameLinux) {
73    $refLinux = $dirLinux."/".$locale.'.utf8@euro_default_raw.html';
74    $rawLinux = $dirLinux."/".$locale.'.utf8@euro_raw.html';
75  }
76}
77if (-e $nameLinux) {
78    print TABLE "<a href=\"$rawLinux\">Ordering</a> <a href=\"$defLinux\">Definition</a> <a href=\"$refLinux\">base</a>";
79}
80
81print TABLE " <a href=\"../$dirLinux/xml/$locale.xml\">xml</a>)</th>\n";
82
83my $dirWin = "winxp";
84my $refWin = $dirWin."/".$locale."_default_raw.html";
85my $rawWin = $dirWin."/".$locale."_raw.html";
86my $nameWin = "$dirWin/$locale"."_collation.html";
87my $colorWin = "#98FB98";
88
89print TABLE "    <th bgcolor=\"$colorWin\">WINDOWS (";
90if (-e $nameWin) {
91   print TABLE "<a href=\"$rawWin\">Ordering</a> <a href=\"$refWin\">base</a> ";
92}
93print TABLE "<a href=\"../windows/xml/$locale.xml\">xml</a>)</th>\n";
94
95print TABLE "  </tr>\n  <tr>";
96
97
98readRules($nameCommon, "#AD989D", "Same as the UCA.");
99readRules($nameLinux, "#1191F1", "No data available.");
100readRules($nameWin, "#98FB98", "No data available.");
101
102
103print TABLE <<"EndOfFooter";
104  </tr>
105</table>
106
107</body>
108</html>
109EndOfFooter
110
111
112sub readRules {
113  # readRules($file, $color)
114  my $filename  = shift;
115  my $color = shift;
116  my $comment = shift;
117  my $noLines = 0;
118  my $printOut = 0;
119
120  my $file;
121
122  if(-e $filename) {
123    open($file, "<$filename") || die "something very strange happened\n";
124    print TABLE "<td bgcolor=\"$color\">\n";
125    while (<$file>) {
126      if (/\}\<br\>$/) {
127        $printOut = 0;
128
129      }
130      if ($printOut) {
131        print TABLE $_;
132        $noLines++;
133      }
134      if (/Sequence/) {
135        $printOut = 1;
136        print "found sequence\n";
137        $noLines = 0;
138      }
139
140    }
141    if (!$noLines) {
142      print TABLE "Same ordering as base\n";
143    }
144    print TABLE "</td>\n";
145  } else {
146    print TABLE "<td bgcolor=\"$color\">\n$comment</td>\n";
147  }
148}
149
150
151# Tasting of food product
152# 650-574-4551 $50 1 hour
153
154
155#     <td bgcolor="#AD989D">1.0-alpha</td>
156#     <td bgcolor="#FF6633">1.0</td>
157#     <td bgcolor="#FF6633">=</td>
158#     <td bgcolor="#FF6633"><span title="006E {LATIN SMALL LETTER N}">&amp;n</span><br>
159#       <span title="006E 0079 {LATIN SMALL LETTER N} {LATIN SMALL LETTER Y}">&nbsp;&nbsp;&lt;&nbsp;ny</span><br>
160
161#       <span title="006E 006E 0079 {LATIN SMALL LETTER N} {LATIN SMALL LETTER N} {LATIN SMALL LETTER Y} / 006E 0079 {LATIN SMALL LETTER N} {LATIN SMALL LETTER Y}">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;nny&nbsp;/&nbsp;ny</span><br>
162#       <span title="006E 0059 {LATIN SMALL LETTER N} {LATIN CAPITAL LETTER Y}">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;&lt;&lt;&nbsp;nY</span><br>
163#     </td>
164#     <td bgcolor="#FF6633">=</td>
165#     <td bgcolor="#FFFF33">1.2</td>
166
167#     <td bgcolor="#98FB98">Windows XP</td>
168#     <td bgcolor="#FF6633">=</td>
169#     <td bgcolor="#FF6633">=</td>
170