diff --git a/examples/manhattan_grid/js/example.js b/examples/manhattan_grid/js/example.js index c9035741..4835d997 100644 --- a/examples/manhattan_grid/js/example.js +++ b/examples/manhattan_grid/js/example.js @@ -1,8 +1,9 @@ /* -The idea (a slight variation of a proposal by -Harold Cooper) is to extend the Manhattan -Grid in all directions, so that every point on Earth can be addressed as -"Xth Ave & Yth St".

+The idea (a slight variation of a proposal by [Harold +Cooper](http://extendny.com/)) is to extend the Manhattan Grid in all +directions, so that every point on Earth can be addressed as "Xth Ave & Yth +St". + The origin of this coordinate system is the intersection of Zero Ave (a.k.a. Avenue A) and Zero St (a.k.a. Houston St). Avenues east of Zero Ave, just as Streets south of Zero St, have negative numbers. Broadway, which will split not @@ -11,7 +12,8 @@ retains its orientation, but is adjusted slightly so that it originates at the intersection of Zero & Zero. From there, Broadway, Zero Avenue and Zero Street continue as perfectly straight equatorial lines. All three will intersect once more, exactly halfway, in the Indian Ocean, (southwest of Australia), at the -point furthest from Manhattan.

+point furthest from Manhattan. + As subsequent avenues remain exactly parallel to Zero Ave, and subsequent streets exactly parallel to Zero St, they form smaller and smaller circles around the globe. The northernmost and southernmost streets are small circles @@ -144,7 +146,7 @@ Ox.load('Image', function() { east: Ox.getPoint(points['0 & 0'], -C / 4, bearings.streets), /* Broadway has two poles as well, and constructing them will make drawing - easier. Ox.mod is the modulo function. Unlike -90 % 360, + easier. Ox.mod is the modulo function. Unlike `-90 % 360`, which in JavaScript is -90, Ox.mod(-90, 360) returns 270. */ westBroadway: Ox.getPoint( @@ -162,7 +164,7 @@ Ox.load('Image', function() { Now we calculate circles for Broadway, Avenues and Streets. Ox.getCircle returns an array of lat/lng pairs that form a circle around a given point, with a given radius and a given precision, so that the circle will have - Math.pow(2, precision) segments. + `Math.pow(2, precision)` segments. */ lines = { /* @@ -209,10 +211,10 @@ Ox.load('Image', function() { /* Before we start drawing, we define a few helper functions. - getXYByLatLng returns screen coordinates for a given point. + `getXYByLatLng` returns screen coordinates for a given point. We use Ox.getXYByLatLng, which takes a lat/lng pair and returns its x/y - position on a 1×1 Mercator position, with {x: 0, y: 0} at the - bottom left and {x: 1, y: 1} at the top right. + position on a 1×1 Mercator position, with `{x: 0, y: 0}` at the + bottom left and `{x: 1, y: 1}` at the top right. */ function getXYByLatLng(point) { return Ox.map(Ox.getXYByLatLng(point), function(v) { @@ -221,7 +223,7 @@ Ox.load('Image', function() { } /* - getLatLngByXY is the inverse of the above, just like + `getLatLngByXY` is the inverse of the above, just like Ox.getLatLngByXY. */ function getLatLngByXY(xy) { @@ -231,7 +233,7 @@ Ox.load('Image', function() { } /* - getASByLatLng takes lat/lng and returns avenue/street. To + `getASByLatLng` takes lat/lng and returns avenue/street. To compute the avenue, we subtract the point's distance from the West Pole, in avenues, from the total number of avenues. To compute the street, we subtract the point's distance from the North Pole, in avenues, from the @@ -260,7 +262,7 @@ Ox.load('Image', function() { } /* - getASByXY returns avenue and street at the given screen + `getASByXY` returns avenue and street at the given screen coordinates. */ function getASByXY(xy) { @@ -268,7 +270,7 @@ Ox.load('Image', function() { } /* - drawPath draws a path of lat/lng pairs on an image. For each + `drawPath` draws a path of lat/lng pairs on an image. For each path segment, we have to check if it crosses the eastern or western edge of the map that splits the Pacific Ocean. Note that our test (a segment crosses the edge if it spans more than 180 degrees longitude) is obviously diff --git a/source/Ox.UI/js/Code/SourceViewer.js b/source/Ox.UI/js/Code/SourceViewer.js index 0a92d591..e1aa1fe5 100644 --- a/source/Ox.UI/js/Code/SourceViewer.js +++ b/source/Ox.UI/js/Code/SourceViewer.js @@ -42,10 +42,13 @@ Ox.SourceViewer = function(options, self) { var sections = [{comment: '', code: ''}]; Ox.tokenize(source).forEach(function(token, i) { var type = token.type == 'comment' ? 'comment' : 'code'; + // ignore '//' comments if (!/^\/\//.test(token.value)) { if (type == 'comment') { i && sections.push({comment: '', code: ''}); - token.value = expand(trim(token.value.slice(2, -2))); + token.value = Ox.parseMarkdown( + trim(token.value.slice(2, -2)) + ); self.options.replaceComment.forEach(function(replace) { token.value = token.value.replace( replace[0], replace[1] @@ -77,7 +80,7 @@ Ox.SourceViewer = function(options, self) { function expand(str) { return str.replace(/(\W)`([\s\S]+?)`/g, function(match, outer, inner) { return outer + '' + Ox.encodeHTMLEntities(inner) + ''; - }) + }); } function trim(str) { diff --git a/source/Ox/js/Array.js b/source/Ox/js/Array.js index f44315a6..dea07539 100644 --- a/source/Ox/js/Array.js +++ b/source/Ox/js/Array.js @@ -2,15 +2,15 @@ /*@ Ox.api Turns an array into a list API - Ox.api takes an array and returns a function that allows you to - run complex queries against it. See the examples below for details. + `Ox.api` takes an array and returns a function that allows you to run + complex queries against it. See the examples below for details. (items, options) -> List API items <[o]> An array of objects (key/value stores) options Options object cache If true, cache results - enums Enumerables, for example {size: ['S', 'M', 'L']} + enums Enumerables, for example `{size: ['S', 'M', 'L']}` geo If true, return combined area with totals - sort <[o]|[s]> Default sort, for example ['+name', '-age'] + sort <[o]|[s]> Default sort, for example `['+name', '-age']` sums <[s]> List of keys to be included in totals unique The name of the unique key @@ -275,9 +271,8 @@ Ox.last = function(array, value) { /*@ Ox.len Returns the length of an array, node list, object or string - Not to be confused with Ox.length, which is the - length property of the Ox function - (1). + Not to be confused with `Ox.length`, which is the `length` property of the + `Ox` function (`1`). > Ox.len((function() { return arguments; }(1, 2, 3))) 3 > Ox.len([1, 2, 3]) @@ -309,8 +304,7 @@ Ox.len = function(collection) { /*@ Ox.map Transforms the values of an array, object or string - Unlike [].map(), Ox.map() works for arrays, - objects and strings. + Unlike `[].map()`, `Ox.map()` works for arrays, objects and strings. > Ox.map([2, 1, 0], function(v, i) { return v == i; }) [false, true, false] > Ox.map({a: 'b', b: 'b', c: 'b'}, function(v, k) { return v == k; }) @@ -454,7 +448,7 @@ Ox.shuffle = function(collection) { }; /*@ -Ox.slice Alias for Array.prototype.slice.call +Ox.slice Alias for `Array.prototype.slice.call` > (function() { return Ox.slice(arguments, 1, -1); }(1, 2, 3)) [2] > (function() { return Ox.slice(arguments, 1); }(1, 2, 3)) @@ -484,8 +478,7 @@ if ( /*@ Ox.some Tests if one or more elements of a collection meet a given condition - Unlike [].some(), Ox.some() works for arrays, - objects and strings. + Unlike `[].some()`, `Ox.some()` works for arrays, objects and strings. > Ox.some([2, 1, 0], function(i, v) { return i == v; }) true > Ox.some({a: 1, b: 2, c: 3}, function(v) { return v == 1; })