# SOME DESCRIPTIVE TITLE. # Copyright (C) 1990-2016, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 2.7\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-10-30 10:44+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../Doc/library/htmlparser.rst:3 msgid ":mod:`HTMLParser` --- Simple HTML and XHTML parser" msgstr "" #: ../Doc/library/htmlparser.rst:10 msgid "" "The :mod:`HTMLParser` module has been renamed to :mod:`html.parser` in " "Python 3. The :term:`2to3` tool will automatically adapt imports when " "converting your sources to Python 3." msgstr "" #: ../Doc/library/htmlparser.rst:21 msgid "**Source code:** :source:`Lib/HTMLParser.py`" msgstr "" #: ../Doc/library/htmlparser.rst:25 msgid "" "This module defines a class :class:`.HTMLParser` which serves as the basis " "for parsing text files formatted in HTML (HyperText Mark-up Language) and " "XHTML. Unlike the parser in :mod:`htmllib`, this parser is not based on the " "SGML parser in :mod:`sgmllib`." msgstr "" #: ../Doc/library/htmlparser.rst:33 msgid "" "An :class:`.HTMLParser` instance is fed HTML data and calls handler methods " "when start tags, end tags, text, comments, and other markup elements are " "encountered. The user should subclass :class:`.HTMLParser` and override its " "methods to implement the desired behavior." msgstr "" #: ../Doc/library/htmlparser.rst:38 msgid "The :class:`.HTMLParser` class is instantiated without arguments." msgstr "" #: ../Doc/library/htmlparser.rst:40 msgid "" "Unlike the parser in :mod:`htmllib`, this parser does not check that end " "tags match start tags or call the end-tag handler for elements which are " "closed implicitly by closing an outer element." msgstr "" #: ../Doc/library/htmlparser.rst:44 msgid "An exception is defined as well:" msgstr "" #: ../Doc/library/htmlparser.rst:48 msgid "" ":class:`.HTMLParser` is able to handle broken markup, but in some cases it " "might raise this exception when it encounters an error while parsing. This " "exception provides three attributes: :attr:`msg` is a brief message " "explaining the error, :attr:`lineno` is the number of the line on which the " "broken construct was detected, and :attr:`offset` is the number of " "characters into the line at which the construct starts." msgstr "" #: ../Doc/library/htmlparser.rst:57 msgid "Example HTML Parser Application" msgstr "" #: ../Doc/library/htmlparser.rst:59 msgid "" "As a basic example, below is a simple HTML parser that uses the :class:`." "HTMLParser` class to print out start tags, end tags and data as they are " "encountered::" msgstr "" #: ../Doc/library/htmlparser.rst:81 msgid "The output will then be:" msgstr "" #: ../Doc/library/htmlparser.rst:100 msgid ":class:`.HTMLParser` Methods" msgstr "" #: ../Doc/library/htmlparser.rst:102 msgid ":class:`.HTMLParser` instances have the following methods:" msgstr "" #: ../Doc/library/htmlparser.rst:107 msgid "" "Feed some text to the parser. It is processed insofar as it consists of " "complete elements; incomplete data is buffered until more data is fed or :" "meth:`close` is called. *data* can be either :class:`unicode` or :class:" "`str`, but passing :class:`unicode` is advised." msgstr "" #: ../Doc/library/htmlparser.rst:115 msgid "" "Force processing of all buffered data as if it were followed by an end-of-" "file mark. This method may be redefined by a derived class to define " "additional processing at the end of the input, but the redefined version " "should always call the :class:`.HTMLParser` base class method :meth:`close`." msgstr "" #: ../Doc/library/htmlparser.rst:123 msgid "" "Reset the instance. Loses all unprocessed data. This is called implicitly " "at instantiation time." msgstr "" #: ../Doc/library/htmlparser.rst:129 msgid "Return current line number and offset." msgstr "" #: ../Doc/library/htmlparser.rst:134 msgid "" "Return the text of the most recently opened start tag. This should not " "normally be needed for structured processing, but may be useful in dealing " "with HTML \"as deployed\" or for re-generating input with minimal changes " "(whitespace between attributes can be preserved, etc.)." msgstr "" #: ../Doc/library/htmlparser.rst:140 msgid "" "The following methods are called when data or markup elements are " "encountered and they are meant to be overridden in a subclass. The base " "class implementations do nothing (except for :meth:`~HTMLParser." "handle_startendtag`):" msgstr "" #: ../Doc/library/htmlparser.rst:147 msgid "" "This method is called to handle the start of a tag (e.g. ``
``)." msgstr "" #: ../Doc/library/htmlparser.rst:149 msgid "" "The *tag* argument is the name of the tag converted to lower case. The " "*attrs* argument is a list of ``(name, value)`` pairs containing the " "attributes found inside the tag's ``<>`` brackets. The *name* will be " "translated to lower case, and quotes in the *value* have been removed, and " "character and entity references have been replaced." msgstr "" #: ../Doc/library/htmlparser.rst:155 msgid "" "For instance, for the tag ````, this method " "would be called as ``handle_starttag('a', [('href', 'https://www.cwi." "nl/')])``." msgstr "" #: ../Doc/library/htmlparser.rst:158 msgid "" "All entity references from :mod:`htmlentitydefs` are now replaced in the " "attribute values." msgstr "" #: ../Doc/library/htmlparser.rst:165 msgid "" "This method is called to handle the end tag of an element (e.g. ``
``)." msgstr "" #: ../Doc/library/htmlparser.rst:167 msgid "The *tag* argument is the name of the tag converted to lower case." msgstr "" #: ../Doc/library/htmlparser.rst:172 msgid "" "Similar to :meth:`handle_starttag`, but called when the parser encounters an " "XHTML-style empty tag (````). This method may be overridden by " "subclasses which require this particular lexical information; the default " "implementation simply calls :meth:`handle_starttag` and :meth:" "`handle_endtag`." msgstr "" #: ../Doc/library/htmlparser.rst:180 msgid "" "This method is called to process arbitrary data (e.g. text nodes and the " "content of ```` and ````)." msgstr "" #: ../Doc/library/htmlparser.rst:186 msgid "" "This method is called to process a named character reference of the form " "``&name;`` (e.g. ``>``), where *name* is a general entity reference (e.g. " "``'gt'``)." msgstr "" #: ../Doc/library/htmlparser.rst:193 msgid "" "This method is called to process decimal and hexadecimal numeric character " "references of the form ``&#NNN;`` and ``&#xNNN;``. For example, the decimal " "equivalent for ``>`` is ``>``, whereas the hexadecimal is ``>``; " "in this case the method will receive ``'62'`` or ``'x3E'``." msgstr "" #: ../Doc/library/htmlparser.rst:201 msgid "" "This method is called when a comment is encountered (e.g. ```` will cause this method to be " "called with the argument ``' comment '``." msgstr "" #: ../Doc/library/htmlparser.rst:206 msgid "" "The content of Internet Explorer conditional comments (condcoms) will also " "be sent to this method, so, for ````, this method will receive ``'[if IE 9]>IE9-specific content``)." msgstr "" #: ../Doc/library/htmlparser.rst:216 msgid "" "The *decl* parameter will be the entire contents of the declaration inside " "the ```` markup (e.g. ``'DOCTYPE html'``)." msgstr "" #: ../Doc/library/htmlparser.rst:222 msgid "" "This method is called when a processing instruction is encountered. The " "*data* parameter will contain the entire processing instruction. For " "example, for the processing instruction ````, this method " "would be called as ``handle_pi(\"proc color='red'\")``." msgstr "" #: ../Doc/library/htmlparser.rst:229 msgid "" "The :class:`.HTMLParser` class uses the SGML syntactic rules for processing " "instructions. An XHTML processing instruction using the trailing ``'?'`` " "will cause the ``'?'`` to be included in *data*." msgstr "" #: ../Doc/library/htmlparser.rst:236 msgid "" "This method is called when an unrecognized declaration is read by the parser." msgstr "" #: ../Doc/library/htmlparser.rst:238 msgid "" "The *data* parameter will be the entire contents of the declaration inside " "the ```` markup. It is sometimes useful to be overridden by a " "derived class." msgstr "" #: ../Doc/library/htmlparser.rst:246 msgid "Examples" msgstr "Exemples" #: ../Doc/library/htmlparser.rst:248 msgid "" "The following class implements a parser that will be used to illustrate more " "examples::" msgstr "" #: ../Doc/library/htmlparser.rst:285 msgid "Parsing a doctype::" msgstr "" #: ../Doc/library/htmlparser.rst:291 msgid "Parsing an element with a few attributes and a title::" msgstr "" #: ../Doc/library/htmlparser.rst:303 msgid "" "The content of ``script`` and ``style`` elements is returned as is, without " "further parsing::" msgstr "" #: ../Doc/library/htmlparser.rst:319 msgid "Parsing comments::" msgstr "" #: ../Doc/library/htmlparser.rst:326 msgid "" "Parsing named and numeric character references and converting them to the " "correct char (note: these 3 references are all equivalent to ``'>'``)::" msgstr "" #: ../Doc/library/htmlparser.rst:334 msgid "" "Feeding incomplete chunks to :meth:`~HTMLParser.feed` works, but :meth:" "`~HTMLParser.handle_data` might be called more than once::" msgstr "" #: ../Doc/library/htmlparser.rst:346 msgid "Parsing invalid HTML (e.g. unquoted attributes) also works::" msgstr ""