Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce a replacement encoding as a trial balloon to fixing various…
… issues. Part of https://www.w3.org/Bugs/Public/show_bug.cgi?id=21057 (Also commit some scripts.)
- Loading branch information
Showing
6 changed files
with
109 additions
and
25 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import json | ||
filename = "encodings.json" | ||
data = json.loads(open(filename, "r").read()) | ||
|
||
handle = open(filename, "w") | ||
handle.write(json.dumps(data, sort_keys=True, allow_nan=False, indent=2, separators=(',', ': '))) | ||
handle.write("\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import json | ||
|
||
def get_data(filename): | ||
return json.loads(open(filename, "r").read()) | ||
|
||
def create_table(): | ||
data = get_data("encodings.json") | ||
table = "" | ||
labelsseen = [] | ||
for set in data: | ||
table += " <tbody>\n <tr><th colspan=2><a href=#" + set["heading"].lower().replace(" ", "-") + ">" + set["heading"] + "</a>\n" | ||
for encoding in set["encodings"]: | ||
rowspan = "" | ||
label_len = len(encoding["labels"]) | ||
if label_len > 1: | ||
rowspan = " rowspan=" + str(label_len) | ||
|
||
table += " <tr>\n <td" + rowspan + "><span>" + encoding["name"] + "</span>" | ||
i = 0 | ||
labels = encoding["labels"] | ||
labels.sort() | ||
for label in labels: | ||
if label in labelsseen: | ||
raise NameError("Duplicate label: " + label) | ||
labelsseen.append(label) | ||
if i > 0: | ||
table += " <tr>" | ||
else: | ||
table += "\n " | ||
table += "<td>\"<code title>" + label + "</code>\"\n" | ||
i += 1 | ||
print table | ||
|
||
create_table() |