use Ox.SyntaxHighlighter on /api/

This commit is contained in:
j 2012-05-29 14:22:39 +02:00
parent 75f7516978
commit 55992dd834
4 changed files with 37 additions and 96 deletions

View file

@ -5,9 +5,7 @@
<title>{{sitename}} API</title> <title>{{sitename}} API</title>
<link rel="shortcut icon" type="image/png" href="/static/png/icon.png"/> <link rel="shortcut icon" type="image/png" href="/static/png/icon.png"/>
<link rel="stylesheet" type="text/css" href="/static/css/highlight.css"/>
<script type="text/javascript" src="/static/oxjs/build/Ox.js"></script> <script type="text/javascript" src="/static/oxjs/build/Ox.js"></script>
<script type="text/javascript" src="/static/js/api/highlight.pack.js"></script>
<script type="text/javascript" src="/static/js/api/pandora.js"></script> <script type="text/javascript" src="/static/js/api/pandora.js"></script>
</head> </head>
<body></body> <body></body>

View file

@ -1,67 +0,0 @@
pre code {
display: block;
background: #F0F0F0;
}
pre code,
.xml .title {
color: black;
}
.string,
.title,
.parent,
.tag .attribute .value,
.rules .value,
.rules .value .number,
.preprocessor,
.instancevar,
.aggregate,
.template_tag,
.django .variable,
.addition,
.flow,
.stream {
color: #800;
}
.comment,
.annotation,
.template_comment,
.diff .header,
.chunk {
color: #888;
}
.number,
.regexp,
.literal,
.change {
color: #080;
}
.decorator,
.filter .argument,
.localvars,
.array,
.attr_selector,
.pi,
.doctype,
.deletion,
.envvar,
.shebang {
color: #88F;
}
.keyword,
.id,
.title,
.aggregate {
font-weight: bold;
}
.html .css,
.html .javascript,
.html .vbscript {
opacity: 0.5;
}

File diff suppressed because one or more lines are too long

View file

@ -125,33 +125,44 @@ function constructList() {
hash = '#'; hash = '#';
if(data.ids.length) if(data.ids.length)
data.ids.forEach(function(id) { data.ids.forEach(function(id) {
info.append($("<h2>").html(id)); info.append(
var $doc =$('<pre>') $("<h2>")
.html(app.actions[id].doc.replace('/\n/<br>\n/g')) .html(id)
.appendTo(info); .css({
var $code = $('<code class="python">') marginBottom: '8px'
.html(app.actions[id].code[1].replace('/\n/<br>\n/g'))
.hide();
/*
var $button = Ox.Button({
type: "image",
options: [
{id: "one", title: "right"},
{id: "two", title: "down"},
],
}) })
.addClass("margin") );
.click(function() { $code.toggle()}) var code = app.actions[id].code[1],
.appendTo(info); f = app.actions[id].code[0],
*/ line = Math.round(Ox.last(f.split(':')) || 0),
var f = app.actions[id].code[0]; doc = app.actions[id].doc.replace('/\n/<br>\n/g'),
$('<span>') $code, $doc;
.html(' View Source ('+f+')')
.click(function() { $code.toggle()})
.appendTo(info)
$('<pre>').append($code).appendTo(info)
hljs.highlightBlock($code[0], ' ');
$doc = Ox.SyntaxHighlighter({
source: doc,
})
.appendTo(info);
Ox.Button({
title: 'View Source (' + f + ')',
}).bindEvent({
click: function() {
$code.toggle();
}
})
.css({
margin: '4px'
})
.appendTo(info);
$code = Ox.SyntaxHighlighter({
showLineNumbers: true,
source: code,
offset: line
})
.css({
borderWidth: '1px',
}).appendTo(info).hide();
Ox.print(code);
hash += id + ',' hash += id + ','
}); });
else else