本文整理汇总了Python中MoinMoin.Page.Page.hilite_re方法的典型用法代码示例。如果您正苦于以下问题:Python Page.hilite_re方法的具体用法?Python Page.hilite_re怎么用?Python Page.hilite_re使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoinMoin.Page.Page
的用法示例。
在下文中一共展示了Page.hilite_re方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse
# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import hilite_re [as 别名]
def parse(story):
"""
The main workhorse that does nothing but call MoinMoin to do its dirty
laundry
@param story: A text for conversion
@type story: string
@returns: formatted string
@rtype: string
"""
s = StringIO()
oldstdout = sys.stdout
form = None
page = Page(None)
page.hilite_re = None
request = Request()
request.user = User()
formatter = Formatter(request)
formatter.setPage(page)
sys.stdout = s
Parser(story, request).format(formatter, form)
sys.stdout = oldstdout
result = s.getvalue()
s.close()
return result
示例2: parse
# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import hilite_re [as 别名]
def parse(body):
"""Parse body and return html
Create a page with body, then parse it and format using html formatter
"""
assert body is not None
request.reset()
pg = Page(request, 'ThisPageDoesNotExistsAndWillNeverBeReally')
pg.set_raw_body(body)
from MoinMoin.formatter.text_html import Formatter
pg.formatter = Formatter(request)
request.formatter = pg.formatter
pg.formatter.setPage(pg)
pg.hilite_re = None
output = []
# Temporarily replace request.write with custom write function that
# write into our output object.
def write_output(text, o=output):
o.append(text)
saved_write = request.write
request.write = write_output
try:
Parser(body, request).format(pg.formatter)
finally:
request.write = saved_write
return ''.join(output)
示例3: parse15
# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import hilite_re [as 别名]
def parse15(story):
"""
The main workhorse that does nothing but call MoinMoin to do its dirty
laundry. This version compatible with MoinMoin 1.5
@param story: A text for conversion
@type story: string
@returns: formatted string
@rtype: string
"""
s = StringIO()
oldstdout = sys.stdout
form = None
request = RequestCLI()
#request.user = User()
page = Page(request, '')
page.hilite_re = None
formatter = Formatter(request)
formatter.setPage(page)
sys.stdout = s
Parser(story, request).format(formatter)
sys.stdout = oldstdout
result = s.getvalue()
s.close()
return result
示例4: parse
# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import hilite_re [as 别名]
def parse(self, body):
"""Parse body and return html
Create a page with body, then parse it and format using html formatter
"""
request = self.request
assert body is not None
request.reset()
page = Page(request, PAGENAME)
page.hilite_re = None
page.set_raw_body(body)
formatter = HtmlFormatter(request)
formatter.setPage(page)
page.formatter = formatter
request.formatter = formatter
parser = WikiParser(body, request, line_anchors=False)
formatter.startContent("") # needed for _include_stack init
output = request.redirectedOutput(parser.format, formatter)
formatter.endContent("")
return output
示例5: parse
# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import hilite_re [as 别名]
def parse(self, body):
"""Parse body and return html
Create a page with body, then parse it and format using html formatter
"""
assert body is not None
self.request.reset()
page = Page(self.request, 'ThisPageDoesNotExistsAndWillNeverBeReally')
page.set_raw_body(body)
from MoinMoin.formatter.text_html import Formatter
page.formatter = Formatter(self.request)
self.request.formatter = page.formatter
page.formatter.setPage(page)
page.hilite_re = None
output = StringIO()
saved_write = self.request.write
self.request.write = output.write
try:
Parser(body, self.request).format(page.formatter)
finally:
self.request.write = saved_write
return output.getvalue()