forked from 0x2620/oxjs
add method source to parent source; strip leading and trailing newlines
This commit is contained in:
parent
b1d171282c
commit
72d3ec87c2
2 changed files with 28 additions and 14 deletions
|
|
@ -86,8 +86,8 @@ Ox.DocPage = function(options, self) {
|
|||
.css({marginLeft: ((level * 32 + 32) + 'px')})
|
||||
.html(
|
||||
'<code><b>></b> ' +
|
||||
//Ox.encodeHTML(example.statement)
|
||||
example.statement
|
||||
Ox.encodeHTML(example.statement)
|
||||
//example.statement
|
||||
.replace(/ /g, ' ')
|
||||
.replace(/\n/g, '<br/>\n ') +
|
||||
'</code>'
|
||||
|
|
@ -103,18 +103,12 @@ Ox.DocPage = function(options, self) {
|
|||
});
|
||||
} else if (section == 'source') {
|
||||
var html = '';
|
||||
var flag = false;
|
||||
item.source.forEach(function(token) {
|
||||
if (token.type != 'linebreak' && token.type != 'whitespace') {
|
||||
flag = true;
|
||||
}
|
||||
if (flag) {
|
||||
html += '<span class="Ox' + Ox.toTitleCase(token.type) + '">' +
|
||||
Ox.encodeHTML(token.source)
|
||||
.replace(/ /g, ' ')
|
||||
.replace(/\n/g, '<br/>') +
|
||||
'</span>';
|
||||
}
|
||||
html += '<span class="Ox' + Ox.toTitleCase(token.type) + '">' +
|
||||
Ox.encodeHTML(token.source)
|
||||
.replace(/ /g, ' ')
|
||||
.replace(/\n/g, '<br/>') +
|
||||
'</span>';
|
||||
});
|
||||
$elements.push($('<div>')
|
||||
.addClass('OxSourceCode ' + className)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue