forked from 0x2620/oxjs
better Ox.isEqual(), more tests, more documentation
This commit is contained in:
parent
a1ed6a44c5
commit
37219bfbe9
5 changed files with 466 additions and 252 deletions
|
|
@ -6,7 +6,7 @@ Ox.DocPage = function(options, self) {
|
|||
item: {}
|
||||
})
|
||||
.options(options || {})
|
||||
.addClass('OxText')
|
||||
.addClass('OxDocPage OxText')
|
||||
.css({
|
||||
overflow: 'auto'
|
||||
});
|
||||
|
|
@ -42,8 +42,13 @@ Ox.DocPage = function(options, self) {
|
|||
if (item[section]) {
|
||||
if (section == 'description') {
|
||||
$elements.push($('<div>')
|
||||
.css({paddingLeft: (level * 32) + 'px'})
|
||||
.html(item.description)
|
||||
.css({
|
||||
paddingTop: (level ? 0 : 8) + 'px',
|
||||
borderTop: level ? '': '1px solid rgb(192, 192, 192)',
|
||||
marginTop: (level ? 0 : 8) + 'px',
|
||||
marginLeft: (level * 32) + 'px',
|
||||
})
|
||||
.html(Ox.parseHTML(item.description))
|
||||
);
|
||||
} else {
|
||||
$elements.push($('<div>')
|
||||
|
|
@ -108,7 +113,7 @@ Ox.DocPage = function(options, self) {
|
|||
.addClass(className)
|
||||
.css({marginLeft: (level * 32 + 16) + 'px'})
|
||||
.html(
|
||||
'<code>' + Ox.parseHTML(example.result) + '</code>'
|
||||
'<code>' + Ox.encodeHTML(example.result) + '</code>'
|
||||
)
|
||||
)
|
||||
});
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ Ox.SyntaxHighlighter = function(options, self) {
|
|||
!(self.options.stripComments && token.type == 'comment')
|
||||
) {
|
||||
classNames = 'Ox' + Ox.toTitleCase(token.type);
|
||||
if (token.type == 'whitespace') {
|
||||
if (self.options.showWhitespace && token.type == 'whitespace') {
|
||||
if (isAfterLinebreak() && hasIrregularSpaces()) {
|
||||
classNames += ' OxLeading'
|
||||
} else if (isBeforeLinebreak()) {
|
||||
|
|
@ -65,27 +65,15 @@ Ox.SyntaxHighlighter = function(options, self) {
|
|||
}
|
||||
});
|
||||
self.lines = self.source.split('<br/>');
|
||||
self.lineNumbersWidth = (self.lines.length + self.options.offset - 1).toString().length * 7;
|
||||
self.sourceCodeWidth = 80 * 7 + (
|
||||
self.lines.length > 40 ? Ox.UI.SCROLLBAR_SIZE : 0
|
||||
);
|
||||
self.height = 40 * 14 + (
|
||||
Math.max.apply(null, self.lines.map(function(line) {
|
||||
return line.length;
|
||||
})) > 80 ? Ox.UI.SCROLLBAR_SIZE : 0
|
||||
);
|
||||
|
||||
that.css({
|
||||
//width: self.lineNumbersWidth + self.sourceCodeWidth,
|
||||
//height: self.height
|
||||
});
|
||||
self.lineNumbersWidth = (
|
||||
self.lines.length + self.options.offset - 1
|
||||
).toString().length * 7;
|
||||
|
||||
self.$lineNumbers = new Ox.Element()
|
||||
.addClass('OxLineNumbers')
|
||||
.css({
|
||||
display: 'table-cell',
|
||||
width: self.lineNumbersWidth + 'px',
|
||||
//height: (self.lines.length * 14) + 8 + 'px',
|
||||
padding: '4px',
|
||||
})
|
||||
.html(
|
||||
|
|
@ -98,8 +86,6 @@ Ox.SyntaxHighlighter = function(options, self) {
|
|||
.addClass('OxSourceCode')
|
||||
.css({
|
||||
display: 'table-cell',
|
||||
//width: self.sourceCodeWidth + 'px',
|
||||
//height: (self.lines.length * 14) + 'px',
|
||||
padding: '4px'
|
||||
})
|
||||
.html(self.source)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue