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))
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
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'))
def SpanHandler(rest, acc): (text, rest) = Inline.collectSpan(rest) acc.append(Inline.LiteralFragment(text)) return rest
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
def SpanHandler(rest, acc): (inner, rest) = Inline.collectSpan(rest) acc.append(Inline.TagFragment("pyle_code", [Inline.LiteralFragment(inner)])) return rest
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'
def __init__(self, blockPara): import Inline self.fragments = [] Inline.parse(blockPara.as_string(), self.fragments)
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
def SpanHandler(rest, acc): (inner, rest) = Inline.parse(rest) acc.append(Inline.TagFragment('pyle_b', inner)) return rest
def SublanguageHandler(args, doc, renderer): renderer.add(Inline.HtmlFragment(doc.reconstruct_child_text().as_string()))