Repository navigation
Update html.entities.html5 dictionary and parseentities.py #60449
Description
Activity
A JSON file containing all the HTML5 entities is now available at http://dev.w3.org/html5/spec/entities.json.
I tested from the interpreter to see if it matches the values in html.entities.html5 and there are a dozen of entities that need to be updated:>>> s = json.load(open('entities.json')) >>> from html.entities import html5 >>> for (k1,i1),(k2,i2) in zip(sorted(s.items()), sorted(html5.items())): ... if i1['characters'] != i2: (k1, k2, i1['characters'], i2, i1['codepoints'], list(map(ord, i2))) ... ('⃜', 'DotDot;', '⃜', '◌⃜', [8412], [9676, 8412]) ('̑', 'DownBreve;', '̑', '◌̑', [785], [9676, 785]) ('⟨', 'LeftAngleBracket;', '⟨', '〈', [10216], [9001]) ('
', 'NewLine;', '\n', '␊', [10], [9226]) ('⟩', 'RightAngleBracket;', '⟩', '〉', [10217], [9002]) ('	', 'Tab;', '\t', '␉', [9], [9225]) ('⃛', 'TripleDot;', '⃛', '◌⃛', [8411], [9676, 8411]) ('⟨', 'lang;', '⟨', '〈', [10216], [9001]) ('⟨', 'langle;', '⟨', '〈', [10216], [9001]) ('⟩', 'rang;', '⟩', '〉', [10217], [9002]) ('⟩', 'rangle;', '⟩', '〉', [10217], [9002]) ('⃛', 'tdot;', '⃛', '◌⃛', [8411], [9676, 8411])
The Tools/scripts/parseentities.py script should also be updated (or possibly a new, separate script should be added), so it can be used to generate the html5 dict. I'm setting this as release blocker so that the update gets done before the release (other values might change in the meanwhile).
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Oct 16, 2012 I say replace the code. HTML 4.01 won’t be updated.
I think it's ok to have a separate file rather than patching the existing one (see attached patch). If the old script is not used anymore it could be removed, otherwise we could just leave it there.
iuliiaproskurnia commented
on Oct 23, 2012 iuliiaproskurniamannequinMannequinMore actionsVersion with --patch to modify Lib/html/entities.py automatically
New changeset dd8b969d7459 by Ezio Melotti in branch 'default':
bpo-16245: add a script to generate the html.entities.html5 dict.
http://hg.python.org/cpython/rev/dd8b969d7459New changeset 1eb1c6942ac8 by Ezio Melotti in branch '3.3':
bpo-16245: Fix the value of a few entities in html.entities.html5.
http://hg.python.org/cpython/rev/1eb1c6942ac8New changeset 70fab10cd542 by Ezio Melotti in branch 'default':
bpo-16245: merge with 3.3.
http://hg.python.org/cpython/rev/70fab10cd542New changeset fb80df16c4ff by Ezio Melotti in branch 'default':
Add Misc/NEWS entry for dd8b969d7459/bpo-16245.
http://hg.python.org/cpython/rev/fb80df16c4ffI now committed an improved version of the script (thanks Iuliia!) and updated the html.entities.html5 dictionary accordingly.
I'm leaving this open because we will have to check if the dictionary is still updated before the release of Python 3.4.
- addedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
on Oct 23, 2012 RamchandraApte commented
on Feb 20, 2013 RamchandraAptemannequinMannequinMore actionsShouldn't this be deferred blocker?
This is still marked as a release blocker. I guess this is a "tickler" for Ezio to go check and see if there's a new entities file.
Ezio: can you get this issue closed or downgraded in the next two days?
I'm downgrading this to "deferred blocker". We'll make sure it happens before Python 3.4.0, but there's no need to hold up Python 3.4a1 for this.
I run Tools/scripts/parse_html5_entities.py and it says that "The current dictionary is updated.". We should check this again, and eventually close the issue, when 3.4 is released.
Was this done? I'm tagging 3.4.0 final soon.
I just ran the script:
$ Tools/scripts/parse_html5_entities.py The current dictionary is updated.
This is done :‑)
BTW this message does not mean that the dictionary was just updated, but that is was already up to date.
According to git blame, the html5 dict in https://github.com/python/cpython/blob/master/Lib/html/entities.py has changed in 7 years. On the other hand, the standard on which it is based, https://html.spec.whatwg.org/multipage/named-characters.html, was last revised yesterday, and I presume several other times since. On the third hand, I just ran the update script and there was no change to entities.py, so maybe is has been run with every release.
Should a comment be added to the file listing the unicode source and the update script?
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields: