diff --git a/demos/doc/js/doc.js b/demos/doc/js/doc.js index b86dac02..84d50511 100644 --- a/demos/doc/js/doc.js +++ b/demos/doc/js/doc.js @@ -8,11 +8,14 @@ Ox.load('UI', { doc.forEach(function(item) { Ox.DocPage({doc: item}).appendTo(Ox.UI.$body); }); + /* Ox.get('../../build/Ox.UI/js/Map/Ox.Map.js', function(source) { var doc = Ox.doc(source); doc.forEach(function(item) { Ox.DocPage({doc: item}).appendTo(Ox.UI.$body); }); }); + */ + Ox.print('TEST', Ox.test(source)) }); }); \ No newline at end of file diff --git a/source/Ox.js b/source/Ox.js index 86996197..a5e182e5 100644 --- a/source/Ox.js +++ b/source/Ox.js @@ -143,246 +143,6 @@ Core functions ================================================================================ */ -/*@ -Ox.doc Generates documentation for annotated JavaScript - (source) Array of documentation objects - source JavaScript source code - > Ox.doc("//@ Ox.foo just some string") - [{"name": "Ox.foo", "summary": "just some string", "type": "string"}] -@*/ - -Ox.doc = (function() { - var re = { - item: /^(.+?) <(.+?)> (.+)$/, - multiline: /^\/\*\@.*?\n([\w\W]+)\n.*?\@\*\/$/, - script: /\n(\s* - > object.options("key", "val").options("key") + > Ox.test.object.options("key", "val").options("key") "val" - > object.options({foo: "foo", bar: "bar"}).options() + > Ox.test.object.options({foo: "foo", bar: "bar"}).options() {"key": "val", "foo": "foo", "bar": "bar"} @*/ @@ -824,13 +584,15 @@ Ox.forEach forEach loop callback Callback function value <*> Value key Key - > var string = ""; - > Ox.forEach(["f", "o", "o"], function(v, i) { string += i; }) - > Ox.forEach({a: "f", b: "o", c: "o"}, function(v, k) { string += k; }) - > Ox.forEach("foo", function(v) { string += v; }) - > string - "012abcfoo" @*/ +/* + > Ox.test.string = ""; + > Ox.forEach(["f", "o", "o"], function(v, i) { Ox.test.string += i; }) + > Ox.forEach({a: "f", b: "o", c: "o"}, function(v, k) { Ox.test.string += k; }) + > Ox.forEach("foo", function(v) { Ox.test.string += v; }) + > Ox.test.string + "012abcfoo" +*/ Ox.forEach = function(obj, fn) { var isObject = Ox.isObject(obj), key; for (key in obj) { @@ -1021,11 +783,13 @@ Ox.makeArray Takes an array-like object and returns a true array ["foo", "bar"] > Ox.makeArray("foo") ["f", "o", "o"] - > Ox.makeArray({0: "f", 1: "o", 2: "0", length: 3}) + > Ox.makeArray({0: "f", 1: "o", 2: "o", length: 3}) ["f", "o", "o"] @*/ -Ox.makeArray = Array.prototype.slice.call; +Ox.makeArray = function(obj) { + return Array.prototype.slice.call(obj); +} Ox.makeObject = function(obj) { /* @@ -1689,7 +1453,6 @@ Ox.canvas Generic canvas object @*/ Ox.canvas = function() { - // Ox.canvas(img) or Ox.canvas(width, height) var c = {}, isImage = arguments.length == 1, image = isImage ? arguments[0] : { width: arguments[0], height: arguments[1] @@ -1735,7 +1498,7 @@ Ox.documentReady = (function() { Ox.element Generic HTML element, mimics jQuery (str) -> Element object str Tagname ('') or selector ('tagname', '.classname', '#id') - > Ox.element("
").addClass("red").addClass("red")[0].classname + > Ox.element("
").addClass("red").addClass("red")[0].className "red" > Ox.element("
").attr({id: "red"}).attr("id") "red" @@ -2950,6 +2713,598 @@ Ox.parseURLs = function(html) { ); }; +/* +================================================================================ +JavaScript functions +================================================================================ +*/ + +/*@ +Ox.doc Generates documentation for annotated JavaScript + (source) Array of documentation objects + source JavaScript source code + > Ox.doc("//@ Ox.foo just some string") + [{"name": "Ox.foo", "summary": "just some string", "type": "string"}] +@*/ + +Ox.doc = (function() { + var re = { + item: /^(.+?) <(.+?)> (.+)$/, + multiline: /^\/\*\@.*?\n([\w\W]+)\n.*?\@\*\/$/, + script: /\n(\s*