16 from itertools
import chain
21 from .stats
import CombinedTagStat, TagStat
22 from .tags
import TagPatterns
31 self.
tagstags = NormalizedDict(ignore=
'_')
36 visitor.visit_tag_statistics(self)
39 return iter(sorted(chain(self.
combinedcombined, self.
tagstags.values())))
44 def __init__(self, included=None, excluded=None, combined=None, docs=None,
59 if tag
not in self.
statsstats.tags:
60 self.
statsstats.tags[tag] = self.
_info_info.get_stat(tag)
72 for stat
in self.
statsstats.combined:
73 if stat.match(test.tags):
90 name = name
or pattern
95 return ' & '.join(doc.text
for doc
in self.
_docs_docs
if doc.match(tag))
98 return [link.get_link(tag)
for link
in self.
_links_links
if link.match(tag)]
115 _match_pattern_tokenizer = re.compile(
r'(\*|\?+)')
120 self.
_title_title = title.replace(
'_',
' ')
133 for index, group
in enumerate(match.groups()):
134 placefolder =
'%%%d' % (index+1)
135 link = link.replace(placefolder, group)
136 title = title.replace(placefolder, group)
141 return re.compile(pattern, re.IGNORECASE)
145 if token.startswith(
'?'):
146 yield '(%s)' % (
'.'*len(token))
150 yield re.escape(token)