Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor HTMLParser.unescape to use html.entities.html5 #59361

Closed
ezio-melotti opened this issue Jun 24, 2012 · 5 comments
Closed

Refactor HTMLParser.unescape to use html.entities.html5 #59361

ezio-melotti opened this issue Jun 24, 2012 · 5 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@ezio-melotti
Copy link
Member

ezio-melotti commented Jun 24, 2012

BPO 15156
Nosy @ezio-melotti, @merwok, @bitdancer
Files
  • issue15156.diff
  • issue15156-2.diff
  • 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:

    assignee = 'https://github.com/ezio-melotti'
    closed_at = <Date 2012-06-24.20:05:35.901>
    created_at = <Date 2012-06-24.02:45:42.758>
    labels = ['type-feature', 'library']
    title = 'Refactor HTMLParser.unescape to use html.entities.html5'
    updated_at = <Date 2012-06-24.20:05:35.899>
    user = 'https://github.com/ezio-melotti'

    bugs.python.org fields:

    activity = <Date 2012-06-24.20:05:35.899>
    actor = 'ezio.melotti'
    assignee = 'ezio.melotti'
    closed = True
    closed_date = <Date 2012-06-24.20:05:35.901>
    closer = 'ezio.melotti'
    components = ['Library (Lib)']
    creation = <Date 2012-06-24.02:45:42.758>
    creator = 'ezio.melotti'
    dependencies = []
    files = ['26129', '26131']
    hgrepos = []
    issue_num = 15156
    keywords = ['patch']
    message_count = 5.0
    messages = ['163702', '163790', '163811', '163837', '163838']
    nosy_count = 4.0
    nosy_names = ['ezio.melotti', 'eric.araujo', 'r.david.murray', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue15156'
    versions = ['Python 3.3']

    @ezio-melotti
    Copy link
    Member Author

    ezio-melotti commented Jun 24, 2012

    HTMLParser has an internal method called unescape [0] used to convert named character references to the equivalent characters, and it does so by using html.entities.name2codepoint to recreate the equivalent of html.entities.entityrefs with the addition of '.
    Now that the html5 entities have been added to html.entities, the parser should use them instead of name2codepoint.

    [0]: see Lib/html/parser.py:500

    @ezio-melotti ezio-melotti self-assigned this Jun 24, 2012
    @ezio-melotti ezio-melotti added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Jun 24, 2012
    @ezio-melotti
    Copy link
    Member Author

    ezio-melotti commented Jun 24, 2012

    Here's a patch, please review.

    @ezio-melotti
    Copy link
    Member Author

    ezio-melotti commented Jun 24, 2012

    Patch updated after the review.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 24, 2012

    New changeset 0d53703b1a99 by Ezio Melotti in branch 'default':
    bpo-15156: HTMLParser now uses the new "html.entities.html5" dictionary.
    http://hg.python.org/cpython/rev/0d53703b1a99

    @ezio-melotti
    Copy link
    Member Author

    ezio-melotti commented Jun 24, 2012

    Fixed, thanks for the reviews!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant