Home | History | Annotate | Download | only in thirdparty

Lines Matching refs:markup

111 # First, the classes that represent markup elements.
887 """Encapsulates a number of ways of matching a markup element (tag or
912 markup = None
914 markup = markupName
915 markupAttrs = markup
921 or (markup and self._matches(markup, self.name)) \
922 or (not markup and self._matches(markupName, self.name)):
941 if markup:
942 found = markup
947 def search(self, markup):
948 #print 'looking for %s in %s' % (self, markup)
952 if hasattr(markup, "__iter__") \
953 and not isinstance(markup, Tag):
954 for element in markup:
961 elif isinstance(markup, Tag):
963 found = self.searchTag(markup)
965 elif isinstance(markup, NavigableString) or \
966 isinstance(markup, basestring):
967 if self._matches(markup, self.text):
968 found = markup
971 % markup.__class__
974 def _matches(self, markup, matchAgainst):
975 #print "Matching %s against %s" % (markup, matchAgainst)
978 result = markup is not None
980 result = matchAgainst(markup)
984 if isinstance(markup, Tag):
985 markup = markup.name
986 if markup and not isinstance(markup, basestring):
987 markup = unicode(markup)
991 result = markup and matchAgainst.search(markup)
993 result = markup in matchAgainst
995 result = markup.has_key(matchAgainst)
996 elif matchAgainst and isinstance(markup, basestring):
997 if isinstance(markup, unicode):
1003 result = matchAgainst == markup
1050 This class is useful for parsing XML or made-up markup languages,
1080 def __init__(self, markup="", parseOnlyThese=None, fromEncoding=None,
1084 provided markup (which can be a string or a file-like object)
1139 if hasattr(markup, 'read'): # It's a file-type object.
1140 markup = markup.read()
1141 self.markup = markup
1147 self.markup = None # The markup can now be GCed
1161 markup = self.markup
1162 if isinstance(markup, unicode):
1167 (markup, [self.fromEncoding, inDocumentEncoding],
1169 markup = dammit.unicode
1172 if markup:
1177 markup = fix.sub(m, markup)
1186 SGMLParser.feed(self, markup)
1661 pathologically bad markup. It makes no assumptions about tag
1766 def __init__(self, markup, overrideEncodings=[],
1769 self.markup, documentEncoding, sniffedEncoding = \
1770 self._detectEncoding(markup, isHTML)
1773 if markup == '' or isinstance(markup, unicode):
1775 self.unicode = unicode(markup)
1788 if not u and chardet and not isinstance(self.markup, unicode):
1789 u = self._convertFrom(chardet.detect(self.markup)['encoding'])
1816 markup = self.markup
1823 markup = re.compile("([\x80-\x9f])").sub \
1825 markup)
1829 u = self._toUnicode(markup, proposed)
1830 self.markup = u
1837 return self.markup