示例#1
0
def SpanHandler(rest, acc):
    (text, rest) = Inline.collectSpan(rest)
    textparts = text.split('|', 1)
    if len(textparts) > 1:
        target = textparts[0]
        vistext = textparts[1]
    else:
        target = text
        vistext = target
    acc.append(Inline.ExternalLink(target, vistext))
    return rest
def SublanguageHandler(args, doc, renderer):
    code = doc.reconstruct_child_text().as_string()
    literalfragment = Inline.LiteralFragment(code)
    if Config.code_enscript_command:
	filename = os.tmpnam()
	file = open(filename, 'w+')
	file.write(code)
	file.close()
	command = Config.code_enscript_command + ' -B -p - --language=html --color -E' + \
	    args + ' ' + filename + ' 2>/dev/null'
	child_stdout = os.popen(command)
	result = child_stdout.read()
	child_stdout.close()
	os.unlink(filename)
        renderer.add(HighlightedCode(Inline.HtmlFragment(enscriptre.sub(r'\1', result)),
                                     literalfragment))
    else:
	renderer.add(HighlightedCode(literalfragment, literalfragment))
示例#3
0
def SpanHandler(rest, acc):
    (text, rest) = Inline.collectSpan(rest)
    textparts = text.split('|', 1)
    if len(textparts) > 1:
        target = textparts[0]
        vistext = textparts[1]
    else:
        target = text
        vistext = target
    acc.append(Inline.ExternalLink(target, vistext))
    return rest
示例#4
0
def SpanHandler(rest, acc):
    (inner, rest) = Inline.parse(rest)

    rendercache = web.ctx.active_page.rendercache()
    if not rendercache.has_key("footnotes"):
        rendercache["footnotes"] = []

    number = len(rendercache["footnotes"]) + 1
    note = Footnote(number, inner)
    rendercache["footnotes"].append(note)
    acc.append(note)
    return rest
def SpanHandler(rest, acc):
    (inner, rest) = Inline.parse(rest)

    rendercache = web.ctx.active_page.rendercache()
    if not rendercache.has_key('footnotes'):
        rendercache['footnotes'] = []

    number = len(rendercache['footnotes']) + 1
    note = Footnote(number, inner)
    rendercache['footnotes'].append(note)
    acc.append(note)
    return rest
示例#6
0
 def visit_sublanguage(self, commandline, doc):
     commandparts = commandline.split(' ', 1)
     command = commandparts[0]
     if len(commandparts) > 1:
         args = commandparts[1]
     else:
         args = ''
     (err, plugin) = Plugin.find_plugin('sublanguages', command,
                                        'SublanguageHandler')
     if plugin:
         try:
             plugin(args, doc, self)
         except BlockSyntaxError, e:
             import Inline
             self.add(Inline.MarkupError(True, 'pluginerror', e.message))
         except:
def SpanHandler(rest, acc):
    (text, rest) = Inline.collectSpan(rest)

    parts = text.split('/', 1)
    name = parts[0]
    pagename = ''

    if name.find(':') != -1:
        (pagename, name) = name.split(':', 1)
    if not pagename:
        pagename = web.ctx.source_page_title

    if len(parts) > 1:
        alt = parts[1]
    else:
        alt = '[Attachment ' + pagename + ':' + name + ']'

    a = Core.Attachment(pagename, name, None)
    acc.append(AttachmentReference(a, alt))
    return rest
def SpanHandler(rest, acc):
    return Inline.discardSpan(rest)
def SpanHandler(rest, acc):
    (fragments, rest) = Inline.parse(rest)
    acc.append(Inline.TagFragment('pyle_tt', fragments))
    return rest
def SublanguageHandler(args, doc, renderer):
    text = doc.reconstruct_child_text().as_string()
    (fragments, rest) = Inline.parse(text)
    renderer.add(Inline.TagFragment('pyle_pre', fragments, 'pre'))
示例#11
0
def SpanHandler(rest, acc):
    (fragments, rest) = Inline.parse(rest)
    acc.append(Inline.TagFragment('pyle_tt', fragments))
    return rest
def SpanHandler(rest, acc):
    (text, rest) = Inline.collectSpan(rest)
    acc.append(Inline.LiteralFragment(text))
    return rest
示例#13
0
def SpanHandler(rest, acc):
    acc.append(Inline.TagFragment('pyle_br', []))
    return Inline.discardSpan(rest)
def SpanHandler(rest, acc):
    (inner, rest) = Inline.collectSpan(rest)
    acc.append(Inline.TagFragment('pyle_code',
                                  [Inline.LiteralFragment(inner)]))
    return rest
def SpanHandler(rest, acc):
    (inner, rest) = Inline.collectSpan(rest)
    acc.append(Inline.HtmlFragment(inner))
    return rest
示例#16
0
文件: code.py 项目: pombredanne/pyle2
def SpanHandler(rest, acc):
    (inner, rest) = Inline.collectSpan(rest)
    acc.append(Inline.TagFragment("pyle_code", [Inline.LiteralFragment(inner)]))
    return rest
示例#17
0
            args = commandparts[1]
        else:
            args = ''
        (err, plugin) = Plugin.find_plugin('sublanguages', command,
                                           'SublanguageHandler')
        if plugin:
            try:
                plugin(args, doc, self)
            except BlockSyntaxError, e:
                import Inline
                self.add(Inline.MarkupError(True, 'pluginerror', e.message))
            except:
                import traceback
                import Inline
                tb = traceback.format_exc()
                self.add(Inline.MarkupError(True, 'pluginerror', tb))
                sys.stderr.write(tb)
        else:
            import Inline
            self.add(Inline.MarkupError(True, 'missingsublanguage', err))

    def visit_normal(self, para):
        self.add(Paragraph(para))


class DefaultPageContent(Renderable):
    def __init__(self, title):
        self.title = title

    def templateName(self):
        return 'default_page_content'
示例#18
0
    def __init__(self, blockPara):
	import Inline
	self.fragments = []
	Inline.parse(blockPara.as_string(), self.fragments)
示例#19
0
 def __init__(self, blockPara):
     import Inline
     self.fragments = []
     Inline.parse(blockPara.as_string(), self.fragments)
示例#20
0
def SpanHandler(rest, acc):
    return Inline.discardSpan(rest)
示例#21
0
文件: pre.py 项目: pombredanne/pyle2
def SublanguageHandler(args, doc, renderer):
    text = doc.reconstruct_child_text().as_string()
    (fragments, rest) = Inline.parse(text)
    renderer.add(Inline.TagFragment("pyle_pre", fragments, "pre"))
def SpanHandler(rest, acc):
    (text, rest) = Inline.collectSpan(rest)
    text = text.strip()
    acc.append(Inline.ExternalLink(Config.bug_url_template % text, "bug %s" % text))
    return rest
示例#23
0
def SpanHandler(rest, acc):
    (inner, rest) = Inline.parse(rest)
    acc.append(Inline.TagFragment('pyle_b', inner))
    return rest
示例#24
0
def SpanHandler(rest, acc):
    acc.append(Inline.TagFragment('pyle_br', []))
    return Inline.discardSpan(rest)
示例#25
0
def SpanHandler(rest, acc):
    (inner, rest) = Inline.parse(rest)
    acc.append(Inline.TagFragment('pyle_b', inner))
    return rest
示例#26
0
def SublanguageHandler(args, doc, renderer):
    renderer.add(Inline.HtmlFragment(doc.reconstruct_child_text().as_string()))