translate foo to <code>foo</code>

This commit is contained in:
rolux 2012-05-28 15:58:10 +02:00
parent ef15919a3e
commit 8c60fef203

View file

@ -60,7 +60,7 @@ Ox.SourceViewer = function(options, self) {
.appendTo(self.$table),
$comment = $('<td>')
.addClass('OxComment OxSerif')
.html(trim(section.comment))
.html(quote(trim(section.comment)))
.appendTo($section),
$code = $('<td>')
.addClass('OxCode')
@ -74,6 +74,10 @@ Ox.SourceViewer = function(options, self) {
});
});
function quote(str) {
return str.replace(/\s`(.*?)`/g, ' <code>$1</code>')
}
function trim(str) {
// removes leading or trailing empty line
return str.replace(/^\s*\n/, '').replace(/\n\s*$/, '');