本文整理匯總了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')