当前位置: 首页>>代码示例>>Python>>正文


Python Page.hilite_re方法代码示例

本文整理汇总了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
开发者ID:BSierakowski,项目名称:personal_code,代码行数:27,代码来源:moinmoin.py

示例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)
开发者ID:mikejamesthompson,项目名称:orgsites,代码行数:34,代码来源:test_parser_wiki.py

示例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
开发者ID:hylom,项目名称:fusuma,代码行数:27,代码来源:moinmoin.py

示例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
开发者ID:steveyen,项目名称:moingo,代码行数:22,代码来源:test_text_moin_wiki.py

示例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()
开发者ID:moinwiki,项目名称:moin-legacy,代码行数:25,代码来源:test_parser_wiki.py


注:本文中的MoinMoin.Page.Page.hilite_re方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。