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