當前位置: 首頁>>代碼示例>>Python>>正文


Python HTMLParser.__init__方法代碼示例

本文整理匯總了Python中sgml.HTMLParser.HTMLParser.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python HTMLParser.__init__方法的具體用法?Python HTMLParser.__init__怎麽用?Python HTMLParser.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sgml.HTMLParser.HTMLParser的用法示例。


在下文中一共展示了HTMLParser.__init__方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from sgml.HTMLParser import HTMLParser [as 別名]
# 或者: from sgml.HTMLParser.HTMLParser import __init__ [as 別名]
 def __init__(self, writer, settings, context):
     if not self._inited:
         for k, v in self.fontdingbats.items():
             self.dingbats[(k, 'grey')] = v
             self.dingbats[(k, 'color')] = v
         import Greek
         for k, v in Greek.entitydefs.items():
             tup = (v, 'Symbol')
             self.dingbats[(k, 'grey')] = tup
             self.dingbats[(k, 'color')] = tup
         PrintingHTMLParser._inited = 1
     HTMLParser.__init__(self, AbstractFormatter(writer))
     if settings.strict_parsing:
         self.sgml_parser.restrict(0)
     self._baseurl = context.get_baseurl()
     self.context = context
     self.settings = settings
     if settings.imageflag:
         self._image_loader = utils.image_loader
     self._image_cache = {}
     self._anchors = {None: None}
     self._anchor_sequence = []
     self._anchor_xforms = []
     if not settings.footnoteflag:
         self.add_anchor_transform(disallow_anchor_footnotes)
     else:
         self.add_anchor_transform(
             disallow_self_reference(context.get_url()))
     self.__fontsize = [3]
開發者ID:XeroHero,項目名稱:grailbrowser,代碼行數:31,代碼來源:PSParser.py

示例2: __init__

# 需要導入模塊: from sgml.HTMLParser import HTMLParser [as 別名]
# 或者: from sgml.HTMLParser.HTMLParser import __init__ [as 別名]
 def __init__(self, viewer, reload=0):
     global _inited
     self.viewer = viewer
     self.reload = reload
     self.context = self.viewer.context
     self.app = self.context.app
     self.load_dingbat = self.app.load_dingbat
     self.loaded = []
     self.current_map = None
     self.target = None
     self.formatter_stack = []
     fmt = formatter.AbstractFormatter(self.viewer)
     HTMLParser.__init__(self, fmt)
     self.push_formatter(fmt)
     if not _inited:
         _inited = 1
         init_module(self.app.prefs)
     self._ids = {}
     # Hackery so reload status can be reset when all applets are loaded
     import AppletLoader
     self.reload1 = self.reload and AppletLoader.set_reload(self.context)
     if self.reload1:
         self.reload1.attach(self)
     if self.app.prefs.GetBoolean('parsing-html', 'strict'):
         self.sgml_parser.restrict(0)
     # Information from <META ... CONTENT="..."> is collected here.
     # Entries are KEY --> [(NAME, HTTP-EQUIV, CONTENT), ...], where
     # KEY is (NAME or HTTP-EQUIV).
     self._metadata = {}
開發者ID:XeroHero,項目名稱:grailbrowser,代碼行數:31,代碼來源:GrailHTMLParser.py


注:本文中的sgml.HTMLParser.HTMLParser.__init__方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。