本文整理匯總了Python中docutils.parsers.rst.states.RSTStateMachine方法的典型用法代碼示例。如果您正苦於以下問題:Python states.RSTStateMachine方法的具體用法?Python states.RSTStateMachine怎麽用?Python states.RSTStateMachine使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類docutils.parsers.rst.states
的用法示例。
在下文中一共展示了states.RSTStateMachine方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: parse
# 需要導入模塊: from docutils.parsers.rst import states [as 別名]
# 或者: from docutils.parsers.rst.states import RSTStateMachine [as 別名]
def parse(self, inputstring, document):
"""Parse `inputstring` and populate `document`, a document tree."""
self.setup_parse(inputstring, document)
self.statemachine = states.RSTStateMachine(
state_classes=self.state_classes,
initial_state=self.initial_state,
debug=document.reporter.debug_flag)
inputlines = docutils.statemachine.string2lines(
inputstring, tab_width=document.settings.tab_width,
convert_whitespace=True)
self.statemachine.run(inputlines, document, inliner=self.inliner)
self.finish_parse()
示例2: wideformat
# 需要導入模塊: from docutils.parsers.rst import states [as 別名]
# 或者: from docutils.parsers.rst.states import RSTStateMachine [as 別名]
def wideformat():
state = Body(RSTStateMachine(None, None))
#state = Mock()
lineno = 1
app = None
return wide_format.WideFormat(state, lineno, app)
示例3: parse
# 需要導入模塊: from docutils.parsers.rst import states [as 別名]
# 或者: from docutils.parsers.rst.states import RSTStateMachine [as 別名]
def parse(self, inputstring, document):
"""Parse `inputstring` and populate `document`, a document tree."""
self.setup_parse(inputstring, document)
self.statemachine = states.RSTStateMachine(
state_classes=self.state_classes,
initial_state=self.initial_state,
debug=document.reporter.debug_flag)
inputlines = docutils.statemachine.string2lines(
inputstring, tab_width=document.settings.tab_width,
convert_whitespace=True)
self.statemachine.run(inputlines, document, inliner=self.inliner)
# restore the "default" default role after parsing a document
if '' in roles._roles:
del roles._roles['']
self.finish_parse()