Show More
@@ -1,3 +1,5 b'' | |||
|
1 | # coding=utf-8 | |
|
2 | ||
|
1 | 3 | import markdown |
|
2 | 4 | from markdown.inlinepatterns import Pattern, SubstituteTagPattern |
|
3 | 5 | from markdown.util import etree |
@@ -12,6 +14,7 b" REFLINK_PATTERN = r'((>>)(\\d+))'" | |||
|
12 | 14 | SPOILER_PATTERN = r'%%([^(%%)]+)%%' |
|
13 | 15 | COMMENT_PATTERN = r'^(//(.+))' |
|
14 | 16 | STRIKETHROUGH_PATTERN = r'~(.+)~' |
|
17 | DASH_PATTERN = r'--' | |
|
15 | 18 | |
|
16 | 19 | |
|
17 | 20 | class TextFormatter(): |
@@ -144,6 +147,11 b' class CodePattern(TextFormatter):' | |||
|
144 | 147 | format_left = ' ' |
|
145 | 148 | |
|
146 | 149 | |
|
150 | class DashPattern(Pattern): | |
|
151 | def handleMatch(self, m): | |
|
152 | return u'β' | |
|
153 | ||
|
154 | ||
|
147 | 155 | class NeboardMarkdown(markdown.Extension): |
|
148 | 156 | def extendMarkdown(self, md, md_globals): |
|
149 | 157 | self._add_neboard_patterns(md) |
@@ -162,6 +170,7 b' class NeboardMarkdown(markdown.Extension' | |||
|
162 | 170 | spoiler = SpoilerPattern(SPOILER_PATTERN, md) |
|
163 | 171 | comment = CommentPattern(COMMENT_PATTERN, md) |
|
164 | 172 | strikethrough = StrikeThroughPattern(STRIKETHROUGH_PATTERN, md) |
|
173 | dash = DashPattern(DASH_PATTERN, md) | |
|
165 | 174 | |
|
166 | 175 | md.inlinePatterns[u'autolink_ext'] = autolink |
|
167 | 176 | md.inlinePatterns[u'spoiler'] = spoiler |
@@ -169,6 +178,7 b' class NeboardMarkdown(markdown.Extension' | |||
|
169 | 178 | md.inlinePatterns[u'comment'] = comment |
|
170 | 179 | md.inlinePatterns[u'reflink'] = reflink |
|
171 | 180 | md.inlinePatterns[u'quote'] = quote |
|
181 | md.inlinePatterns[u'dash'] = dash | |
|
172 | 182 | |
|
173 | 183 | |
|
174 | 184 | def make_extension(configs=None): |
General Comments 0
You need to be logged in to leave comments.
Login now