1
0
Fork 0
forked from 0x2620/oxjs

better layout for documentation pages, use syntax highlighter

This commit is contained in:
rolux 2011-05-07 23:07:53 +02:00
commit a1ed6a44c5
7 changed files with 121 additions and 115 deletions

View file

@ -116,7 +116,7 @@ Ox.wrap = function(val, chained) {
//@ Array ----------------------------------------------------------------------
/*@
Ox.compact <f> Returns an array w/o <code>null</code or <code>undefined</code>
Ox.compact <f> Returns an array w/o <code>null</code> or <code>undefined</code>
> Ox.compact([null,,1,,2,,3])
[1, 2, 3]
@*/
@ -132,8 +132,8 @@ Ox.compact = function(arr) {
/*@
Ox.flatten <f> Flattens an array
> Ox.flatten([1, [2, [3], 4], 5])
[1, 2, 3, 4, 5]
> Ox.flatten([1, [2, [3], 2], 1])
[1, 2, 3, 2, 1]
@*/
Ox.flatten = function(arr) {
// fixme: can this work for objects too?
@ -152,8 +152,8 @@ Ox.flatten = function(arr) {
/*@
Ox.merge <f> Merges an array with one or more other arrays
> Ox.merge(['foo'], ['foo', 'bar'], ['bar'])
['foo', 'foo', 'bar', 'bar']
> Ox.merge([1], [2, 3, 2], [1])
[1, 2, 3, 2, 1]
@*/
Ox.merge = function(arr) {
Ox.forEach(Array.prototype.slice.call(arguments, 1), function(arg) {
@ -1661,7 +1661,7 @@ Ox.element = function(str) {
33819
> Ox.decodeBase32('?').toString()
'NaN'
*/
@*/
Ox.decodeBase32 = function(str) {
return parseInt(Ox.map(str.toUpperCase(), function(char) {
var index = digits.indexOf(aliases[char] || char);
@ -3014,6 +3014,8 @@ Ox.doc = (function() {
if (/^[A-Z]/.test(item.name)) {
// main item
item.source = parseTokens(tokens[i]);
item.line = source.substr(0, item.source[0].offset)
.split('\n').length;
items.push(item);
} else {
// property of a function item
@ -3428,7 +3430,9 @@ Ox.divideInt = function(num, by) {
}
/*@
Ox.limit <f> Returns the logarithm of a given number to a given base
Ox.limit <f> Limits a number by a given mininum and maximum
<code>Ox.limit(num, min, max)</code> is a shorthand for
<code>Math.min(Math.max(num, min), max)</code>
(num) -> <n> <code>num</code>
(num, max) -> <n> <code>Math.max(num, max)</code>
(num, min, max) -> <n> <code>Math.min(Math.max(num, min), max)</code>