本文整理汇总了Python中docutils.utils.punctuation_chars.match_chars方法的典型用法代码示例。如果您正苦于以下问题:Python punctuation_chars.match_chars方法的具体用法?Python punctuation_chars.match_chars怎么用?Python punctuation_chars.match_chars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类docutils.utils.punctuation_chars
的用法示例。
在下文中一共展示了punctuation_chars.match_chars方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: quoted_start
# 需要导入模块: from docutils.utils import punctuation_chars [as 别名]
# 或者: from docutils.utils.punctuation_chars import match_chars [as 别名]
def quoted_start(self, match):
"""Test if inline markup start-string is 'quoted'.
'Quoted' in this context means the start-string is enclosed in a pair
of matching opening/closing delimiters (not necessarily quotes)
or at the end of the match.
"""
string = match.string
start = match.start()
if start == 0: # start-string at beginning of text
return False
prestart = string[start - 1]
try:
poststart = string[match.end()]
except IndexError: # start-string at end of text
return True # not "quoted" but no markup start-string either
return punctuation_chars.match_chars(prestart, poststart)