当前位置: 首页>>代码示例>>Python>>正文


Python BaseHTMLProcessor.BaseHTMLProcessor类代码示例

本文整理汇总了Python中BaseHTMLProcessor.BaseHTMLProcessor的典型用法代码示例。如果您正苦于以下问题:Python BaseHTMLProcessor类的具体用法?Python BaseHTMLProcessor怎么用?Python BaseHTMLProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BaseHTMLProcessor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: end_a

 def end_a(self):
     if self._start_a:
         method = getattr( self, self._start_a.__name__.replace('start','end'), None )
         if method:
             method()
     else:
         BaseHTMLProcessor.unknown_endtag(self,"a")
开发者ID:PlatoForum,项目名称:PlatoForum,代码行数:7,代码来源:PttParser.py

示例2: reset

	def reset(self,query):
		#query is the list of keywords,eg:['yu','aoi']
		query=[escape(word) for word in query]
		words='|'.join(query)
		self.Q_PATTERN=re.compile(r'(?P<query>' + words + r')',re.I)
		self.highlight=0
		BaseHTMLProcessor.reset(self)
开发者ID:andy071001,项目名称:Bookmark_Hot,代码行数:7,代码来源:queryHighlight.py

示例3: reset

    def reset(self):

        self._start_a = None
        self.methodQueue = []
        self.divClassStack = []
        self.articleRec = []
        BaseHTMLProcessor.reset(self)
开发者ID:PlatoForum,项目名称:PlatoForum,代码行数:7,代码来源:PttParser.py

示例4: reset

	def reset(self):
		# extend (called from __init__ in ancestor)
		# Reset all data attributes
		self.verbatim = 0
		BaseHTMLProcessor.reset(self)
开发者ID:luobotiao,项目名称:python3,代码行数:5,代码来源:dialect.py

示例5: reset

 def reset(self):
   '''extend (called from __init__ in ancestor)'''
   self.verbatim = 0
   BaseHTMLProcessor.reset(self)
开发者ID:SachiNorman,项目名称:MIT-6.00x-work,代码行数:4,代码来源:dialect.py

示例6: unknown_endtag

	def unknown_endtag(self, tag):
		self.flushcolor()
		BaseHTMLProcessor.unknown_endtag(self, tag)
		if self.needcolor:
			self.colorindex = len(self.pieces)
开发者ID:alextigernick,项目名称:Django-Tutorial,代码行数:5,代码来源:colorize.py

示例7: unknown_starttag

	def unknown_starttag(self, tag, attrs):
		self.flushcolor()
		BaseHTMLProcessor.unknown_starttag(self, tag, attrs)
		if self.needcolor:
			self.colorindex = len(self.pieces)
开发者ID:alextigernick,项目名称:Django-Tutorial,代码行数:5,代码来源:colorize.py

示例8: flushcolor

	def flushcolor(self):
		if self.colorindex:
			buffer = "".join(self.pieces[self.colorindex:])
			self.pieces = self.pieces[:self.colorindex]
			self.colorindex = 0
			BaseHTMLProcessor.handle_data(self, self.HTMLfontify(buffer))
开发者ID:alextigernick,项目名称:Django-Tutorial,代码行数:6,代码来源:colorize.py

示例9: reset

	def reset(self):
		BaseHTMLProcessor.reset(self)
		self.colorindex = 0
		self.needcolor = 0
开发者ID:alextigernick,项目名称:Django-Tutorial,代码行数:4,代码来源:colorize.py

示例10: __init__

	def __init__(self, usefonts=0):
		BaseHTMLProcessor.__init__(self)
		self.usefonts = usefonts
开发者ID:alextigernick,项目名称:Django-Tutorial,代码行数:3,代码来源:colorize.py

示例11: __init__

	def __init__(self, basedir):
		BaseHTMLProcessor.__init__(self)
		self.basedir = basedir
开发者ID:12379Monty,项目名称:Computational-Investing-pt-1,代码行数:3,代码来源:autosize.py

示例12: BaseHTMLProcessor

import urllib 
from BaseHTMLProcessor import BaseHTMLProcessor
                                      
sock = urllib.urlopen("../Programmer/html/examples.html") 
htmlSource = sock.read()                            
sock.close() 
parser = BaseHTMLProcessor()
parser.feed(htmlSource)    
f = open('../Programmer/html/examples1.html', 'w')
f.write(parser.output())                           
开发者ID:A1kmm,项目名称:cm,代码行数:10,代码来源:examplesprocessing.py

示例13: BaseHTMLProcessor

#! /usr/bin/python

htmlSource = """
<html>
<head>
<title>Test page</title>
</head>
<body>
<ul>
<li><a href=index.html>Home</a></li>
<li><a href=toc.html>Table of contents</a></li>
<li><a href=history.html>Revision history</a></li>
</body>
</html>
"""
import sys
sys.path.append("../..")
from BaseHTMLProcessor import BaseHTMLProcessor

parser = BaseHTMLProcessor()
parser.feed(htmlSource)

print parser.output()
开发者ID:lilinj2000,项目名称:DiveInPython,代码行数:23,代码来源:example8_16.py

示例14: start_a

 def start_a(self,attrs):
     if self._start_a:
         self._start_a(attrs)
     else:
         BaseHTMLProcessor.unknown_starttag(self,"a",attrs)
开发者ID:PlatoForum,项目名称:PlatoForum,代码行数:5,代码来源:PttParser.py

示例15:

#!/usr/bin/python
'''
 htmlQuo.py
 @author ffmmx
 
'''

from BaseHTMLProcessor import BaseHTMLProcessor
if __name__=='__main__':
    htmlSource='''
    <html>
     <head>
     <title>Test page</title>
     </head>
     <body>
     <ul>
     <li><a href=index.html>Home</a></li>
     <li><a href=toc.html>Table of contents</a></li>
     <li><a href=history.html>Revision history</a></li>
     </body>
     </html>
    '''
    parser=BaseHTMLProcessor()
    print parser.feed(htmlSource)

开发者ID:firefoxmmx2,项目名称:pythontest,代码行数:24,代码来源:htmlQuo.py


注:本文中的BaseHTMLProcessor.BaseHTMLProcessor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。