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
cb51d842
Kaydet (Commit)
cb51d842
authored
May 17, 2008
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
update references and documentation for modules in the new html package
(
http://bugs.python.org/issue2882
)
üst
91ae2502
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
22 deletions
+23
-22
htmllib.rst
Doc/library/htmllib.rst
+5
-5
htmlparser.rst
Doc/library/htmlparser.rst
+7
-7
parser.py
Lib/html/parser.py
+6
-5
htmllib.py
Lib/htmllib.py
+1
-1
test_codeccallbacks.py
Lib/test/test_codeccallbacks.py
+2
-2
test_multibytecodec_support.py
Lib/test/test_multibytecodec_support.py
+1
-1
test_sundry.py
Lib/test/test_sundry.py
+1
-1
No files found.
Doc/library/htmllib.rst
Dosyayı görüntüle @
cb51d842
...
...
@@ -77,12 +77,12 @@ The module defines a parser class and an exception:
Interface definition for transforming an abstract flow of formatting events into
specific output events on writer objects.
Module :mod:`
HTMLP
arser`
Module :mod:`
html.p
arser`
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
entitydef
s`
Module :mod:`html
.entitie
s`
Definition of replacement text for XHTML 1.0 entities.
Module :mod:`sgmllib`
...
...
@@ -149,10 +149,10 @@ additional methods and instance variables for use within tag methods.
:meth:`save_bgn` will raise a :exc:`TypeError` exception.
:mod:`html
entitydef
s` --- Definitions of HTML general entities
=============================================================
=
:mod:`html
.entitie
s` --- Definitions of HTML general entities
=============================================================
.. module:: html
entitydef
s
.. module:: html
.entitie
s
:synopsis: Definitions of HTML general entities.
.. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
...
...
Doc/library/htmlparser.rst
Dosyayı görüntüle @
cb51d842
:mod:`
HTMLP
arser` --- Simple HTML and XHTML parser
==================================================
:mod:`
html.p
arser` --- Simple HTML and XHTML parser
==================================================
=
.. module::
HTMLP
arser
.. module::
html.p
arser
:synopsis: A simple parser that can handle HTML and XHTML.
...
...
@@ -22,7 +22,7 @@ in :mod:`sgmllib`.
The :class:`HTMLParser` class is instantiated without arguments.
An
HTMLParser
instance is fed HTML data and calls handler functions when tags
An
:class:`HTMLParser`
instance is fed HTML data and calls handler functions when tags
begin and end. The :class:`HTMLParser` class is meant to be overridden by the
user to provide a desired behavior.
...
...
@@ -92,8 +92,8 @@ An exception is defined as well:
``handle_starttag('a', [('href', 'http://www.cwi.nl/')])``.
.. versionchanged:: 2.6
All entity references from
htmlentitydefs are now replaced in the attribut
e
values.
All entity references from
:mod:`html.entities` are now replaced in th
e
attribute
values.
.. method:: HTMLParser.handle_startendtag(tag, attrs)
...
...
@@ -171,7 +171,7 @@ Example HTML Parser Application
As a basic example, below is a very basic HTML parser that uses the
:class:`HTMLParser` class to print out tags as they are encountered::
from
HTMLP
arser import HTMLParser
from
html.p
arser import HTMLParser
class MyHTMLParser(HTMLParser):
...
...
Lib/html/parser.py
Dosyayı görüntüle @
cb51d842
...
...
@@ -372,16 +372,17 @@ class HTMLParser(markupbase.ParserBase):
c
=
int
(
s
)
return
unichr
(
c
)
else
:
# Cannot use name2codepoint directly, because HTMLParser
supports apos,
# which is not part of HTML 4
import
html
entitydef
s
# Cannot use name2codepoint directly, because HTMLParser
#
supports apos,
which is not part of HTML 4
import
html
.entitie
s
if
HTMLParser
.
entitydefs
is
None
:
entitydefs
=
HTMLParser
.
entitydefs
=
{
'apos'
:
u"'"
}
for
k
,
v
in
html
entitydef
s
.
name2codepoint
.
iteritems
():
for
k
,
v
in
html
.
entitie
s
.
name2codepoint
.
iteritems
():
entitydefs
[
k
]
=
unichr
(
v
)
try
:
return
self
.
entitydefs
[
s
]
except
KeyError
:
return
'&'
+
s
+
';'
return
re
.
sub
(
r"&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));"
,
replaceEntities
,
s
)
return
re
.
sub
(
r"&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));"
,
replaceEntities
,
s
)
Lib/htmllib.py
Dosyayı görüntüle @
cb51d842
...
...
@@ -24,7 +24,7 @@ class HTMLParser(sgmllib.SGMLParser):
"""
from
html
entitydef
s
import
entitydefs
from
html
.entitie
s
import
entitydefs
def
__init__
(
self
,
formatter
,
verbose
=
0
):
"""Creates an instance of the HTMLParser class.
...
...
Lib/test/test_codeccallbacks.py
Dosyayı görüntüle @
cb51d842
import
test.test_support
,
unittest
import
sys
,
codecs
,
html
entitydef
s
,
unicodedata
import
sys
,
codecs
,
html
.
entitie
s
,
unicodedata
class
PosReturn
:
# this can be used for configurable callbacks
...
...
@@ -86,7 +86,7 @@ class CodecCallbackTest(unittest.TestCase):
l
=
[]
for
c
in
exc
.
object
[
exc
.
start
:
exc
.
end
]:
try
:
l
.
append
(
u"&
%
s;"
%
html
entitydef
s
.
codepoint2name
[
ord
(
c
)])
l
.
append
(
u"&
%
s;"
%
html
.
entitie
s
.
codepoint2name
[
ord
(
c
)])
except
KeyError
:
l
.
append
(
u"&#
%
d;"
%
ord
(
c
))
return
(
u""
.
join
(
l
),
exc
.
end
)
...
...
Lib/test/test_multibytecodec_support.py
Dosyayı görüntüle @
cb51d842
...
...
@@ -64,7 +64,7 @@ class TestBase:
if
self
.
has_iso10646
:
return
from
html
entitydef
s
import
codepoint2name
from
html
.entitie
s
import
codepoint2name
def
xmlcharnamereplace
(
exc
):
if
not
isinstance
(
exc
,
UnicodeEncodeError
):
...
...
Lib/test/test_sundry.py
Dosyayı görüntüle @
cb51d842
...
...
@@ -50,7 +50,7 @@ class TestUntestedModules(unittest.TestCase):
import
encodings
import
formatter
import
getpass
import
html
entitydef
s
import
html
.entitie
s
import
ihooks
import
imghdr
import
imputil
...
...
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