Last active
January 8, 2018 00:24
-
-
Save netjunki/da7fffb65b7f51a4c5c27e5c6b9ff137 to your computer and use it in GitHub Desktop.
Multiline IWikiSyntaxProvider
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a page with ##just hidden## spoiler. <- This works correctly and on the page displays without the surrounding ## | |
== '''__Header2__''' == | |
Trying to replicate an issue found on another page. | |
The below content doesn't work correctly and the ## are shown. | |
## | |
=== '''''Header3 Header''''' === | |
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent vulputate, est ultricies euismod malesuada, diam nulla dignissim eros, id fringilla tortor libero ut nisl. Aliquam porttitor turpis lorem, nec pharetra ex vehicula nec. Cras feugiat luctus lacinia. Vestibulum cursus bibendum diam, at tincidunt libero egestas venenatis. Praesent quis luctus nunc. Donec auctor enim purus, ut commodo risus varius sed. Nunc id erat suscipit, mollis est nec, posuere lectus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Duis quis odio quis orci vestibulum mattis non ac arcu. | |
## |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" Copyright (c) 2018 Ben Lau <[email protected]>""" | |
from genshi.builder import tag | |
from trac.core import * | |
from trac.wiki.api import IWikiSyntaxProvider | |
class SpoilerMarkupPlugin(Component): | |
""" Trac Plug-in to provide Wiki Syntax for marking spoiler for exclusion in includes.""" | |
implements ( IWikiSyntaxProvider ) | |
RE_SPOILER = r"##(?P<spoiler>.*?)##(?ms)" | |
def _spoiler(self, formatter, match, fullmatch): | |
content = fullmatch.group('spoiler') | |
return content | |
def get_wiki_syntax(self): | |
yield ( self.RE_SPOILER , self._spoiler ) | |
def get_link_resolvers(self): | |
return [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment