mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
pep8/style matching
This commit is contained in:
parent
02f984f7ef
commit
fcc74be267
1 changed files with 11 additions and 8 deletions
|
|
@ -98,15 +98,18 @@ directives.register_directive('youtube', YouTube)
|
||||||
|
|
||||||
_abbr_re = re.compile('\((.*)\)$')
|
_abbr_re = re.compile('\((.*)\)$')
|
||||||
|
|
||||||
class abbreviation(nodes.Inline, nodes.TextElement): pass
|
|
||||||
|
class abbreviation(nodes.Inline, nodes.TextElement):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def abbr_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
|
def abbr_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
|
||||||
text = utils.unescape(text)
|
text = utils.unescape(text)
|
||||||
m = _abbr_re.search(text)
|
m = _abbr_re.search(text)
|
||||||
if m is None:
|
if m is None:
|
||||||
return [abbreviation(text, text)], []
|
return [abbreviation(text, text)], []
|
||||||
abbr = text[:m.start()].strip()
|
abbr = text[:m.start()].strip()
|
||||||
expl = m.group(1)
|
expl = m.group(1)
|
||||||
return [abbreviation(abbr, abbr, explanation=expl)], []
|
return [abbreviation(abbr, abbr, explanation=expl)], []
|
||||||
|
|
||||||
roles.register_local_role('abbr', abbr_role)
|
roles.register_local_role('abbr', abbr_role)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue