Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
877b10ad
Kaydet (Commit)
877b10ad
authored
Haz 01, 2008
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Remove the htmllib and sgmllib modules as per PEP 3108.
üst
6b38daa8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
14 additions
and
244 deletions
+14
-244
formatter.rst
Doc/library/formatter.rst
+2
-6
html.entities.rst
Doc/library/html.entities.rst
+4
-5
html.parser.rst
Doc/library/html.parser.rst
+2
-6
htmllib.rst
Doc/library/htmllib.rst
+0
-147
markup.rst
Doc/library/markup.rst
+0
-2
sgmllib.rst
Doc/library/sgmllib.rst
+0
-0
urllib.rst
Doc/library/urllib.rst
+2
-3
_markupbase.py
Lib/_markupbase.py
+2
-3
htmllib.py
Lib/htmllib.py
+0
-0
sgmllib.py
Lib/sgmllib.py
+0
-0
test___all__.py
Lib/test/test___all__.py
+0
-2
test_htmllib.py
Lib/test/test_htmllib.py
+0
-69
test_sgmllib.py
Lib/test/test_sgmllib.py
+0
-0
NEWS
Misc/NEWS
+2
-0
cheatsheet
Misc/cheatsheet
+0
-1
No files found.
Doc/library/formatter.rst
Dosyayı görüntüle @
877b10ad
:mod:`formatter` --- Generic output formatting
==============================================
...
...
@@ -6,12 +5,9 @@
:synopsis: Generic output formatter and device interface.
.. index:: single: HTMLParser (class in htmllib)
This module supports two interface definitions, each with multiple
implementations. The *formatter* interface is used by the :class:`HTMLParser`
class of the :mod:`htmllib` module, and the *writer* interface is required by
the formatter interface.
implementations: The *formatter* interface, and the *writer* interface which is
required by the formatter interface.
Formatter objects transform an abstract flow of formatting events into specific
output events on writer objects. Formatters manage several stack structures to
...
...
Doc/library/html.entities.rst
Dosyayı görüntüle @
877b10ad
...
...
@@ -7,11 +7,10 @@
This module defines three dictionaries, ``name2codepoint``, ``codepoint2name``,
and ``entitydefs``. ``entitydefs`` is used by the :mod:`htmllib` module to
provide the :attr:`entitydefs` member of the :class:`html.parser.HTMLParser`
class. The definition provided here contains all the entities defined by XHTML
1.0 that can be handled using simple textual substitution in the Latin-1
character set (ISO-8859-1).
and ``entitydefs``. ``entitydefs`` is used to provide the :attr:`entitydefs`
member of the :class:`html.parser.HTMLParser` class. The definition provided
here contains all the entities defined by XHTML 1.0 that can be handled using
simple textual substitution in the Latin-1 character set (ISO-8859-1).
.. data:: entitydefs
...
...
Doc/library/html.parser.rst
Dosyayı görüntüle @
877b10ad
...
...
@@ -11,9 +11,6 @@
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`.
.. class:: HTMLParser()
...
...
@@ -23,9 +20,8 @@ in :mod:`sgmllib`.
begin and end. The :class:`HTMLParser` class is meant to be overridden by the
user to provide a desired behavior.
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.
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.
An exception is defined as well:
...
...
Doc/library/htmllib.rst
deleted
100644 → 0
Dosyayı görüntüle @
6b38daa8
:mod:`htmllib` --- A parser for HTML documents
==============================================
.. module:: htmllib
:synopsis: A parser for HTML documents.
.. index::
single: HTML
single: hypertext
.. index::
module: sgmllib
module: formatter
single: SGMLParser (in module sgmllib)
This module defines a class which can serve as a base for parsing text files
formatted in the HyperText Mark-up Language (HTML). The class is not directly
concerned with I/O --- it must be provided with input in string form via a
method, and makes calls to methods of a "formatter" object in order to produce
output. The :class:`HTMLParser` class is designed to be used as a base class
for other classes in order to add functionality, and allows most of its methods
to be extended or overridden. In turn, this class is derived from and extends
the :class:`SGMLParser` class defined in module :mod:`sgmllib`. The
:class:`HTMLParser` implementation supports the HTML 2.0 language as described
in :rfc:`1866`. Two implementations of formatter objects are provided in the
:mod:`formatter` module; refer to the documentation for that module for
information on the formatter interface.
The following is a summary of the interface defined by
:class:`sgmllib.SGMLParser`:
* The interface to feed data to an instance is through the :meth:`feed` method,
which takes a string argument. This can be called with as little or as much
text at a time as desired; ``p.feed(a); p.feed(b)`` has the same effect as
``p.feed(a+b)``. When the data contains complete HTML markup constructs, these
are processed immediately; incomplete constructs are saved in a buffer. To
force processing of all unprocessed data, call the :meth:`close` method.
For example, to parse the entire contents of a file, use::
parser.feed(open('myfile.html').read())
parser.close()
* The interface to define semantics for HTML tags is very simple: derive a class
and define methods called :meth:`start_tag`, :meth:`end_tag`, or :meth:`do_tag`.
The parser will call these at appropriate moments: :meth:`start_tag` or
:meth:`do_tag` is called when an opening tag of the form ``<tag ...>`` is
encountered; :meth:`end_tag` is called when a closing tag of the form ``<tag>``
is encountered. If an opening tag requires a corresponding closing tag, like
``<H1>`` ... ``</H1>``, the class should define the :meth:`start_tag` method; if
a tag requires no closing tag, like ``<P>``, the class should define the
:meth:`do_tag` method.
The module defines a parser class and an exception:
.. class:: HTMLParser(formatter)
This is the basic HTML parser class. It supports all entity names required by
the XHTML 1.0 Recommendation (http://www.w3.org/TR/xhtml1). It also defines
handlers for all HTML 2.0 and many HTML 3.0 and 3.2 elements.
.. exception:: HTMLParseError
Exception raised by the :class:`HTMLParser` class when it encounters an error
while parsing.
.. seealso::
Module :mod:`formatter`
Interface definition for transforming an abstract flow of formatting events into
specific output events on writer objects.
Module :mod:`html.parser`
Alternate HTML parser that offers a slightly lower-level view of the input, but
is designed to work with XHTML, and does not implement some of the SGML syntax
not used in "HTML as deployed" and which isn't legal for XHTML.
Module :mod:`html.entities`
Definition of replacement text for XHTML 1.0 entities.
Module :mod:`sgmllib`
Base class for :class:`HTMLParser`.
.. _html-parser-objects:
HTMLParser Objects
------------------
In addition to tag methods, the :class:`HTMLParser` class provides some
additional methods and instance variables for use within tag methods.
.. attribute:: HTMLParser.formatter
This is the formatter instance associated with the parser.
.. attribute:: HTMLParser.nofill
Boolean flag which should be true when whitespace should not be collapsed, or
false when it should be. In general, this should only be true when character
data is to be treated as "preformatted" text, as within a ``<PRE>`` element.
The default value is false. This affects the operation of :meth:`handle_data`
and :meth:`save_end`.
.. method:: HTMLParser.anchor_bgn(href, name, type)
This method is called at the start of an anchor region. The arguments
correspond to the attributes of the ``<A>`` tag with the same names. The
default implementation maintains a list of hyperlinks (defined by the ``HREF``
attribute for ``<A>`` tags) within the document. The list of hyperlinks is
available as the data attribute :attr:`anchorlist`.
.. method:: HTMLParser.anchor_end()
This method is called at the end of an anchor region. The default
implementation adds a textual footnote marker using an index into the list of
hyperlinks created by :meth:`anchor_bgn`.
.. method:: HTMLParser.handle_image(source, alt[, ismap[, align[, width[, height]]]])
This method is called to handle images. The default implementation simply
passes the *alt* value to the :meth:`handle_data` method.
.. method:: HTMLParser.save_bgn()
Begins saving character data in a buffer instead of sending it to the formatter
object. Retrieve the stored data via :meth:`save_end`. Use of the
:meth:`save_bgn` / :meth:`save_end` pair may not be nested.
.. method:: HTMLParser.save_end()
Ends buffering character data and returns all data saved since the preceding
call to :meth:`save_bgn`. If the :attr:`nofill` flag is false, whitespace is
collapsed to single spaces. A call to this method without a preceding call to
:meth:`save_bgn` will raise a :exc:`TypeError` exception.
Doc/library/markup.rst
Dosyayı görüntüle @
877b10ad
...
...
@@ -23,8 +23,6 @@ definition of the Python bindings for the DOM and SAX interfaces.
html.parser.rst
html.entities.rst
sgmllib.rst
htmllib.rst
pyexpat.rst
xml.dom.rst
xml.dom.minidom.rst
...
...
Doc/library/sgmllib.rst
deleted
100644 → 0
Dosyayı görüntüle @
6b38daa8
This diff is collapsed.
Click to expand it.
Doc/library/urllib.rst
Dosyayı görüntüle @
877b10ad
...
...
@@ -389,14 +389,13 @@ URL Opener objects
.. index::
single: HTML
pair: HTTP; protocol
module: htmllib
* The data returned by :func:`urlopen` or :func:`urlretrieve` is the raw data
returned by the server. This may be binary data (such as an image), plain text
or (for example) HTML. The HTTP protocol provides type information in the reply
header, which can be inspected by looking at the :mailheader:`Content-Type`
header. If the returned data is HTML, you can use the module
:mod:`htmllib` to
parse it.
header. If the returned data is HTML, you can use the module
:mod:`html.parser` to
parse it.
.. index:: single: FTP
...
...
Lib/_markupbase.py
Dosyayı görüntüle @
877b10ad
"""Shared support for scanning document type declarations in HTML and XHTML.
This module is used as a foundation for the HTMLParser and sgmllib
modules (indirectly, for htmllib as well). It has no documented
public API and should not be used directly.
This module is used as a foundation for the html.parser module. It has no
documented public API and should not be used directly.
"""
...
...
Lib/htmllib.py
deleted
100644 → 0
Dosyayı görüntüle @
6b38daa8
This diff is collapsed.
Click to expand it.
Lib/sgmllib.py
deleted
100644 → 0
Dosyayı görüntüle @
6b38daa8
This diff is collapsed.
Click to expand it.
Lib/test/test___all__.py
Dosyayı görüntüle @
877b10ad
...
...
@@ -73,7 +73,6 @@ class AllTest(unittest.TestCase):
self
.
check_all
(
"glob"
)
self
.
check_all
(
"gzip"
)
self
.
check_all
(
"heapq"
)
self
.
check_all
(
"htmllib"
)
self
.
check_all
(
"http.client"
)
self
.
check_all
(
"ihooks"
)
self
.
check_all
(
"imaplib"
)
...
...
@@ -116,7 +115,6 @@ class AllTest(unittest.TestCase):
self
.
check_all
(
"rlcompleter"
)
self
.
check_all
(
"robotparser"
)
self
.
check_all
(
"sched"
)
self
.
check_all
(
"sgmllib"
)
self
.
check_all
(
"shelve"
)
self
.
check_all
(
"shlex"
)
self
.
check_all
(
"shutil"
)
...
...
Lib/test/test_htmllib.py
deleted
100644 → 0
Dosyayı görüntüle @
6b38daa8
import
formatter
import
htmllib
import
unittest
from
test
import
support
class
AnchorCollector
(
htmllib
.
HTMLParser
):
def
__init__
(
self
,
*
args
,
**
kw
):
self
.
__anchors
=
[]
htmllib
.
HTMLParser
.
__init__
(
self
,
*
args
,
**
kw
)
def
get_anchor_info
(
self
):
return
self
.
__anchors
def
anchor_bgn
(
self
,
*
args
):
self
.
__anchors
.
append
(
args
)
class
DeclCollector
(
htmllib
.
HTMLParser
):
def
__init__
(
self
,
*
args
,
**
kw
):
self
.
__decls
=
[]
htmllib
.
HTMLParser
.
__init__
(
self
,
*
args
,
**
kw
)
def
get_decl_info
(
self
):
return
self
.
__decls
def
unknown_decl
(
self
,
data
):
self
.
__decls
.
append
(
data
)
class
HTMLParserTestCase
(
unittest
.
TestCase
):
def
test_anchor_collection
(
self
):
# See SF bug #467059.
parser
=
AnchorCollector
(
formatter
.
NullFormatter
(),
verbose
=
1
)
parser
.
feed
(
"""<a href='http://foo.org/' name='splat'> </a>
<a href='http://www.python.org/'> </a>
<a name='frob'> </a>
"""
)
parser
.
close
()
self
.
assertEquals
(
parser
.
get_anchor_info
(),
[(
'http://foo.org/'
,
'splat'
,
''
),
(
'http://www.python.org/'
,
''
,
''
),
(
''
,
'frob'
,
''
),
])
def
test_decl_collection
(
self
):
# See SF patch #545300
parser
=
DeclCollector
(
formatter
.
NullFormatter
(),
verbose
=
1
)
parser
.
feed
(
"""<html>
<body>
hallo
<![if !supportEmptyParas]> <![endif]>
</body>
</html>
"""
)
parser
.
close
()
self
.
assertEquals
(
parser
.
get_decl_info
(),
[
"if !supportEmptyParas"
,
"endif"
])
def
test_main
():
support
.
run_unittest
(
HTMLParserTestCase
)
if
__name__
==
"__main__"
:
test_main
()
Lib/test/test_sgmllib.py
deleted
100644 → 0
Dosyayı görüntüle @
6b38daa8
This diff is collapsed.
Click to expand it.
Misc/NEWS
Dosyayı görüntüle @
877b10ad
...
...
@@ -60,6 +60,8 @@ Extension Modules
Library
-------
- Removed the ``htmllib`` and ``sgmllib`` modules.
- The deprecated ``SmartCookie`` and ``SimpleCookie`` classes have
been removed from ``http.cookies``.
...
...
Misc/cheatsheet
Dosyayı görüntüle @
877b10ad
...
...
@@ -1895,7 +1895,6 @@ reprlib Redo repr() but with limits on most sizes.
rlcompleter Word completion for GNU readline 2.0.
robotparser Parse robots.txt files, useful for web spiders.
sched A generally useful event scheduler class.
sgmllib A parser for SGML.
shelve Manage shelves of pickled objects.
shlex Lexical analyzer class for simple shell-like syntaxes.
shutil Utility functions usable in a shell-like program.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment