diff --git a/Gruntfile.js b/Gruntfile.js index e4ba5df8..425c6ed4 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -108,7 +108,7 @@ module.exports = function (grunt) { 'grunt-contrib-copy', 'grunt-contrib-clean', 'grunt-contrib-less', - 'grunt-jsdoc', + 'grunt-jsdoc' ].forEach(function (taskName) { grunt.loadNpmTasks(taskName); }); diff --git a/demo/sample/dateUtils.js b/demo/sample/dateUtils.js new file mode 100644 index 00000000..2ea62d51 --- /dev/null +++ b/demo/sample/dateUtils.js @@ -0,0 +1,66 @@ +/** + * A utility that has methods for converting dates to different formats. + * @module samples/dateUtils + */ +define([ + ], function( + + ) { + + return /** @alias module:samples/dateUtils */{ + + /** + * Converts a timestamp in epoch time (milliseconds since Jan 1, 1970) to a string. + * The string gets returned as a string in format "date month year hour:minute:second. + * For example "13 Feb 1999 12:18:32" + * + * @param {number} UNIX_timestamp The date in milliseconds after Jan 1, 1970 + * + * @returns {string} + * + * @static + */ + unixToDateTime: function (UNIX_timestamp) { + var a = new Date(UNIX_timestamp); + var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; + var year = a.getFullYear(); + var month = months[a.getMonth()]; + var date = a.getDate(); + var hour = a.getHours(); + var min = a.getMinutes(); + var sec = a.getSeconds(); + var time = date + " " + month + " " + year + " " + hour + ":" + min + ":" + sec; + return time; + }, + + /** + * Date parser that handles date string generation. + * @param {Date|number|string} value The date to convert to a string. It can be a JavaScript Date object, + * a unix time stamp, or a string that represents a date. + * @param {string} format The desired date format from the parser. Valid examples are + * * "MM/DD/YYYY HH:mm:ss" - "09/09/2000 13:02:08" + * * "DDD MMM DD YYYY h:mm A" - "Tue Jan 3 2002 8:08 AM" + * @returns {String} Returns a string representation of the passed in date value + * following the format definition provided as the format parameter. If the value cannot + * be parsed, the method returns "<value> (Not parsed)" + * + * @static + */ + getDateString: function (value, format) { + //var isValid = moment(value).isValid(); + var isValid = true; + var dateString; + + if (isValid && value instanceof Date) { + dateString = moment(value).format(format); + } else if (isValid && !isNaN(value)) { + dateString = moment.unix(value).format(format); + } else if (isValid && typeof(value) === "string") { + dateString = moment(value).format(format); + } else { + dateString = value + " (Not parsed)"; + } + return dateString; + } + }; +}); diff --git a/less/main.less b/less/main.less index 2cd7f6a5..d2aeed28 100644 --- a/less/main.less +++ b/less/main.less @@ -299,4 +299,20 @@ list-style-type: disc; } } + + .class-description { + ol, ul { + margin-left: 25px; + } + + ol > li { + list-style-type: decimal; + margin-bottom: 5px; + } + + ul > li { + margin-bottom: 5px; + list-style-type: disc; + } + } } \ No newline at end of file diff --git a/less/navigation.less b/less/navigation.less index 5e221b24..f74ac0cf 100644 --- a/less/navigation.less +++ b/less/navigation.less @@ -29,6 +29,12 @@ } } + .typeHeading { + font: 600 1.1em Helvetica; + color: #f5f5f5; + border-bottom: 1px solid #333; + } + .search { padding: 10px 15px; diff --git a/publish.js b/publish.js index 21b283ea..f09e302c 100644 --- a/publish.js +++ b/publish.js @@ -200,14 +200,19 @@ function attachModuleSymbols(doclets, modules) { * @return {string} The HTML for the navigation sidebar. */ function buildNav(members) { - var nav = []; + var nav = {}; if (members.namespaces.length) { + var namespaces = []; + _.each(members.namespaces, function (v) { - nav.push({ + namespaces.push({ type: 'namespace', longname: v.longname, name: v.name, + displayName: v.name.replace(/\b(module|event):/g, ''), + + url: helper.longnameToUrl[v.longname] || v.longname, members: find({ kind: 'member', memberof: v.longname @@ -226,14 +231,54 @@ function buildNav(members) { }) }); }); + nav.Namespaces = namespaces; } if (members.classes.length) { + var classes = []; + _.each(members.classes, function (v) { - nav.push({ + classes.push({ type: 'class', longname: v.longname, name: v.name, + displayName: v.name.replace(/\b(module|event):/g, ''), + + url: helper.longnameToUrl[v.longname] || v.longname, + + members: find({ + kind: 'member', + memberof: v.longname + }), + methods: find({ + kind: 'function', + memberof: v.longname + }), + typedefs: find({ + kind: 'typedef', + memberof: v.longname + }), + events: find({ + kind: 'event', + memberof: v.longname + }) + }); + }); + nav.Classes = classes; + } + + if (members.modules.length) { + var modules = []; + + _.each(members.modules, function(v) { + modules.push({ + type: 'module', + longname: v.longname, + name: v.name, + displayName: v.name.replace(/\b(module|event):/g, ''), + + url: helper.longnameToUrl[v.longname] || v.longname, + members: find({ kind: 'member', memberof: v.longname @@ -252,6 +297,7 @@ function buildNav(members) { }) }); }); + nav.Modules = modules; } return nav; diff --git a/tmpl/navigation.tmpl b/tmpl/navigation.tmpl index 0f70feb0..fa338037 100644 --- a/tmpl/navigation.tmpl +++ b/tmpl/navigation.tmpl @@ -9,73 +9,78 @@ var self = this;