MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / run

Method run

markdown/extensions/abbr.py:43–59  ·  view source on GitHub ↗

Find and remove all Abbreviation references from the text. Each reference is set as a new AbbrPattern in the markdown instance.

(self, lines)

Source from the content-addressed store, hash-verified

41 """ Abbreviation Preprocessor - parse text for abbr references. """
42
43 def run(self, lines):
44 '''
45 Find and remove all Abbreviation references from the text.
46 Each reference is set as a new AbbrPattern in the markdown instance.
47
48 '''
49 new_text = []
50 for line in lines:
51 m = ABBR_REF_RE.match(line)
52 if m:
53 abbr = m.group('abbr').strip()
54 title = m.group('title').strip()
55 self.markdown.inlinePatterns['abbr-%s'%abbr] = \
56 AbbrPattern(self._generate_pattern(abbr), title)
57 else:
58 new_text.append(line)
59 return new_text
60
61 def _generate_pattern(self, text):
62 '''

Callers

nothing calls this directly

Calls 4

_generate_patternMethod · 0.95
AbbrPatternClass · 0.85
matchMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected