示例#1
0
def process():
    log = current_app.logger
    v = request.values
    source = v['source']
    if not source:
        return redirect('/confluence/index')

    parser = create_parser('pukiwiki', log)
    converter = create_converter('confluence', log)
    parser.parse_text(source, converter)

    return render_template(
        'confluence/complete.html',
        converted_text=parser.buffer.value
    )
示例#2
0
def process():
    source = request.params.source
    parser = request.params.parser or 'pukiwiki'
    converter = request.params.converter or 'confluence'
    prefer_h1 = bool(request.params.prefer_h1 or '')

    app.log.debug("parser = %s, prefer_h1 = %s" % (parser, prefer_h1))
    app.log.debug("===== source =====\n" + source)
    if not source:
        return redirect("/%s/%s" % (converter, parser))

    parser = create_parser(parser, {}, app.log)
    converter = create_converter(converter, { 'prefer_h1': prefer_h1 }, app.log)
    parser.parse(source, converter)

    return template(
        'complete.html',
        converter='confluence',
        converted_text=parser.buffer.value
    )
 def setup_method(self, method):
     self.log = create_logger(True)
     self.p = create_parser('pukiwiki', {}, self.log)
     self.c = create_converter('confluence', {}, self.log)
 def setup_method(self, method):
     self.log = create_logger(True)
     self.p = create_parser('confluence_ameblo', {}, self.log)
     self.c = create_converter('ameblo', {}, self.log)
示例#5
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
from wiki_converter.core.log import create_logger
from wiki_converter.core.function import create_parser, create_converter

if __name__ == '__main__':
    l = create_logger(True)
    p = create_parser('confluence', l)
    c = create_converter('confluence', { 'prefer_h1': True }, l)
    input = sys.stdin.read()
    p.parse(input, c)
    print "=== input ==="
    print input
    print "=== converted ==="
    print p.buffer.value
    print "=== end ==="
示例#6
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
from wiki_converter.core.log import create_logger
from wiki_converter.core.function import create_parser, create_converter

if __name__ == '__main__':
    l = create_logger(True)
    p = create_parser('confluence_ameblo', l)
    c = create_converter('ameblo', {}, l)
    input = sys.stdin.read()
    p.parse(input, c)
    print "=== input ==="
    print input
    print "=== output ==="
    print p.buffer.value
    print "=== end ==="
示例#7
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
from wiki_converter.core.log import create_logger
from wiki_converter.core.function import create_parser, create_converter

if __name__ == '__main__':
    l = create_logger(True)
    p = create_parser('pukiwiki', {}, l)
    c = create_converter('confluence', { 'prefer_h1': True }, l)
    input = sys.stdin.read()
    p.parse(input, c)
    print "=== input ==="
    print input
    print "=== output ==="
    print p.buffer.value
    print "=== end ==="
    # TODO: Airの/usr/local/share/python削除