本文整理汇总了Python中markdown.inlinepatterns.SimpleTagPattern方法的典型用法代码示例。如果您正苦于以下问题:Python inlinepatterns.SimpleTagPattern方法的具体用法?Python inlinepatterns.SimpleTagPattern怎么用?Python inlinepatterns.SimpleTagPattern使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类markdown.inlinepatterns
的用法示例。
在下文中一共展示了inlinepatterns.SimpleTagPattern方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_better
# 需要导入模块: from markdown import inlinepatterns [as 别名]
# 或者: from markdown.inlinepatterns import SimpleTagPattern [as 别名]
def make_better(self, md):
"""
Configure all the pattern rules.
This should be used instead of smart_strong package.
pymdownx.extra should be used in place of makrdown.extensions.extra.
"""
config = self.getConfigs()
enabled = config["smart_enable"]
if enabled:
enable_all = enabled == "all"
enable_under = enabled == "underscore" or enable_all
enable_star = enabled == "asterisk" or enable_all
star_strong_em = SMART_STAR_STRONG_EM if enable_star else STAR_STRONG_EM
under_strong_em = SMART_UNDER_STRONG_EM if enable_under else UNDER_STRONG_EM
star_em_strong = SMART_STAR_EM_STRONG if enable_star else STAR_EM_STRONG
under_em_strong = SMART_UNDER_EM_STRONG if enable_under else UNDER_EM_STRONG
star_strong_em2 = SMART_STAR_STRONG_EM2 if enable_star else STAR_STRONG_EM2
under_strong_em2 = SMART_UNDER_STRONG_EM2 if enable_under else UNDER_STRONG_EM2
star_strong = SMART_STAR_STRONG if enable_star else STAR_STRONG
under_strong = SMART_UNDER_STRONG if enable_under else UNDER_STRONG
star_emphasis = SMART_STAR_EM if enable_star else STAR_EM
under_emphasis = SMART_UNDER_EM if enable_under else UNDER_EM
md.inlinePatterns["strong_em"] = DoubleTagPattern(star_strong_em, 'strong,em')
md.inlinePatterns.add("strong_em2", DoubleTagPattern(under_strong_em, 'strong,em'), '>strong_em')
md.inlinePatterns.link("em_strong", ">strong_em2")
md.inlinePatterns["em_strong"] = DoubleTagPattern(star_em_strong, 'em,strong')
md.inlinePatterns.add('em_strong2', DoubleTagPattern(under_em_strong, 'em,strong'), '>em_strong')
md.inlinePatterns.add('strong_em3', DoubleTagPattern(star_strong_em2, 'strong,em'), '>em_strong2')
md.inlinePatterns.add('strong_em4', DoubleTagPattern(under_strong_em2, 'strong,em'), '>strong_em3')
md.inlinePatterns["strong"] = SimpleTagPattern(star_strong, 'strong')
md.inlinePatterns.add("strong2", SimpleTagPattern(under_strong, 'strong'), '>strong')
md.inlinePatterns["emphasis"] = SimpleTagPattern(star_emphasis, 'em')
md.inlinePatterns["emphasis2"] = SimpleTagPattern(under_emphasis, 'em')
示例2: extendMarkdown
# 需要导入模块: from markdown import inlinepatterns [as 别名]
# 或者: from markdown.inlinepatterns import SimpleTagPattern [as 别名]
def extendMarkdown(self, md, md_globals):
"""Modifies inline patterns."""
mark_tag = SimpleTagPattern(reg_pattern, 'mark')
md.inlinePatterns.add('mark', mark_tag, '_begin')
示例3: extendMarkdown
# 需要导入模块: from markdown import inlinepatterns [as 别名]
# 或者: from markdown.inlinepatterns import SimpleTagPattern [as 别名]
def extendMarkdown(self, md, md_globals):
"""Modifies inline patterns."""
mark_tag = SimpleTagPattern(reg_pattern, 'del')
md.inlinePatterns.add('del', mark_tag, '_begin')
示例4: extendMarkdown
# 需要导入模块: from markdown import inlinepatterns [as 别名]
# 或者: from markdown.inlinepatterns import SimpleTagPattern [as 别名]
def extendMarkdown(self, md, md_globals):
highlight_pattern = SimpleTagPattern(self.HIGHLIGHT_RE, 'mark')
md.inlinePatterns.add('highlight', highlight_pattern, '_end')
pdf_pattern = PDFPattern(self.PDF_RE)
md.inlinePatterns.add('pdf_link', pdf_pattern, '_begin')
vid_pattern = VideoPattern(self.VID_RE)
md.inlinePatterns.add('video_link', vid_pattern, '_begin')
url_pattern = IFramePattern(self.URL_RE)
md.inlinePatterns.add('iframe_link', url_pattern, '_begin')
示例5: extendMarkdown
# 需要导入模块: from markdown import inlinepatterns [as 别名]
# 或者: from markdown.inlinepatterns import SimpleTagPattern [as 别名]
def extendMarkdown(self, md, md_globals):
"""Modifies inline patterns."""
md.inlinePatterns.add('kbd', SimpleTagPattern(KBD_RE, 'kbd'), '<not_strong')
示例6: extendMarkdown
# 需要导入模块: from markdown import inlinepatterns [as 别名]
# 或者: from markdown.inlinepatterns import SimpleTagPattern [as 别名]
def extendMarkdown(self, md, md_globals):
"""Modifies inline patterns."""
md.inlinePatterns.add('del', SimpleTagPattern(DEL_RE, 'del'), '<not_strong')
示例7: extendMarkdown
# 需要导入模块: from markdown import inlinepatterns [as 别名]
# 或者: from markdown.inlinepatterns import SimpleTagPattern [as 别名]
def extendMarkdown(self, md, md_globals):
"""Modifies inline patterns."""
md.inlinePatterns.add('del', SimpleTagPattern(DEL_RE, 'del'), '<not_strong')
md.inlinePatterns.add('ins', SimpleTagPattern(INS_RE, 'ins'), '<not_strong')