├── .npmignore ├── Makefile ├── .gitignore ├── api ├── assets │ ├── css │ │ ├── external-small.png │ │ └── main.css │ ├── js │ │ ├── tabs.js │ │ └── yui-prettify.js │ └── vendor │ │ └── prettify │ │ ├── prettify-min.css │ │ ├── CHANGES.html │ │ └── README.html ├── index.html ├── files │ ├── base_js_Base.js.html │ ├── lib_index.js.html │ ├── lib_docview.js.html │ └── lib_cli.js.html ├── classes │ ├── cli.html │ ├── index.html │ └── DocView.html └── modules │ └── yuidoc.html ├── themes ├── default │ ├── assets │ │ ├── css │ │ │ ├── logo.png │ │ │ └── external-small.png │ │ ├── js │ │ │ ├── yui-prettify.js │ │ │ ├── api-filter.js │ │ │ ├── tabs.js │ │ │ ├── api-search.js │ │ │ └── api-list.js │ │ └── vendor │ │ │ └── prettify │ │ │ ├── prettify-min.css │ │ │ ├── CHANGES.html │ │ │ └── README.html │ ├── theme.json │ ├── partials │ │ ├── files.handlebars │ │ ├── options.handlebars │ │ ├── index.handlebars │ │ ├── sidebar.handlebars │ │ ├── module.handlebars │ │ ├── props.handlebars │ │ ├── events.handlebars │ │ ├── attrs.handlebars │ │ ├── method.handlebars │ │ └── classes.handlebars │ └── layouts │ │ └── main.handlebars └── simple │ ├── assets │ ├── css │ │ ├── logo.png │ │ └── external-small.png │ ├── js │ │ ├── yui-prettify.js │ │ └── tabs.js │ └── vendor │ │ └── prettify │ │ ├── prettify-min.css │ │ ├── CHANGES.html │ │ └── README.html │ ├── partials │ ├── index.handlebars │ ├── files.handlebars │ ├── props.handlebars │ ├── module.handlebars │ ├── events.handlebars │ ├── attrs.handlebars │ ├── classes.handlebars │ ├── method.handlebars │ └── sidebar.handlebars │ ├── theme.json │ └── layouts │ └── main.handlebars ├── yuidoc.json ├── tests ├── test │ ├── anim.js │ └── test.js └── test2 │ └── dump │ └── dump.js ├── package.json ├── LICENSE ├── lib ├── index.js ├── docview.js ├── help.js ├── cli.js ├── utils.js └── yuidoc.js └── README.md /.npmignore: -------------------------------------------------------------------------------- 1 | .git 2 | sandbox 3 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | npm -g i . 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | node_modules 3 | ddc 4 | -------------------------------------------------------------------------------- /api/assets/css/external-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apm/yuidocjs/master/api/assets/css/external-small.png -------------------------------------------------------------------------------- /themes/default/assets/css/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apm/yuidocjs/master/themes/default/assets/css/logo.png -------------------------------------------------------------------------------- /themes/simple/assets/css/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apm/yuidocjs/master/themes/simple/assets/css/logo.png -------------------------------------------------------------------------------- /themes/default/assets/css/external-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apm/yuidocjs/master/themes/default/assets/css/external-small.png -------------------------------------------------------------------------------- /themes/simple/assets/css/external-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apm/yuidocjs/master/themes/simple/assets/css/external-small.png -------------------------------------------------------------------------------- /themes/simple/partials/index.handlebars: -------------------------------------------------------------------------------- 1 |

API Docs - Main Index

2 |

Something smart and pretty should probably go here.

3 | -------------------------------------------------------------------------------- /themes/simple/partials/files.handlebars: -------------------------------------------------------------------------------- 1 |

{{fileName}}

2 | 3 |
4 | {{fileData}}
5 | 
6 | 7 | -------------------------------------------------------------------------------- /themes/default/theme.json: -------------------------------------------------------------------------------- 1 | { 2 | "yuiGridsUrl": "http://yui.yahooapis.com/3.4.0/build/cssgrids/cssgrids-min.css", 3 | "yuiSeedUrl": "http://yui.yahooapis.com/3.4.0/build/yui/yui-min.js" 4 | } 5 | -------------------------------------------------------------------------------- /themes/simple/theme.json: -------------------------------------------------------------------------------- 1 | { 2 | "yuiGridsUrl": "http://yui.yahooapis.com/3.4.0/build/cssgrids/cssgrids-min.css", 3 | "yuiSeedUrl": "http://yui.yahooapis.com/combo?3.4.0/build/yui/yui-min.js" 4 | } 5 | -------------------------------------------------------------------------------- /themes/default/partials/files.handlebars: -------------------------------------------------------------------------------- 1 |

File: {{fileName}}

2 | 3 |
4 |
5 | {{fileData}}
6 |     
7 |
8 | -------------------------------------------------------------------------------- /api/assets/js/tabs.js: -------------------------------------------------------------------------------- 1 | YUI().use('tabview', function(Y) { 2 | var classdocs = Y.one('#classdocs'); 3 | if (classdocs) { 4 | if (classdocs.all('li').size()) { 5 | var tabview = new Y.TabView({ srcNode: classdocs }); 6 | tabview.render(); 7 | } 8 | } 9 | }); 10 | -------------------------------------------------------------------------------- /yuidoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "YUIDoc", 3 | "description": "YUIDoc documentation tool written in Javascript", 4 | "version": "0.1.0", 5 | "url": "http://yuilibrary.com/projects/yuidoc", 6 | "options": { 7 | "linkNatives": "true", 8 | "attributesEmit": "true", 9 | "paths": [ "./lib" ], 10 | "outdir": "./api" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /themes/simple/partials/props.handlebars: -------------------------------------------------------------------------------- 1 | 2 |
3 | `{{name}}` <{{#crossLink type}}{{/crossLink}}>{{#if final}} (final){{/if}}{{#if static}} (static){{/if}}
4 | `{{file}}:{{line}}` 5 | {{{propertyDescription}}} 6 | {{#if example}} 7 |
Example
8 | {{{example}}} 9 | {{/if}} 10 |
11 | -------------------------------------------------------------------------------- /tests/test/anim.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the Anim MODULE description 3 | * @main anim 4 | * @module anim 5 | */ 6 | 7 | /** 8 | * This is the Anim Class description 9 | * @class Anim 10 | */ 11 | 12 | /** 13 | * The easing module provides methods for customizing 14 | * how an animation behaves during each run. 15 | * @class Easing 16 | * @submodule anim-easing 17 | */ 18 | 19 | 20 | /** 21 | * FOO FOO FOO FOO FOO The easing module provides methods for customizing 22 | * @class EasingFoo 23 | * @submodule anim-easing-foo 24 | */ 25 | 26 | 27 | -------------------------------------------------------------------------------- /api/assets/js/yui-prettify.js: -------------------------------------------------------------------------------- 1 | YUI().use('node', function(Y) { 2 | var code = Y.all('.prettyprint.linenums'); 3 | if (code.size()) { 4 | code.each(function(c) { 5 | var lis = c.all('ol li'), 6 | l = 1; 7 | lis.each(function(n) { 8 | n.prepend(''); 9 | l++; 10 | }); 11 | }); 12 | var h = location.hash; 13 | location.hash = ''; 14 | h = h.replace('LINE_', 'LINENUM_'); 15 | location.hash = h; 16 | } 17 | }); 18 | -------------------------------------------------------------------------------- /themes/default/assets/js/yui-prettify.js: -------------------------------------------------------------------------------- 1 | YUI().use('node', function(Y) { 2 | var code = Y.all('.prettyprint.linenums'); 3 | if (code.size()) { 4 | code.each(function(c) { 5 | var lis = c.all('ol li'), 6 | l = 1; 7 | lis.each(function(n) { 8 | n.prepend(''); 9 | l++; 10 | }); 11 | }); 12 | var h = location.hash; 13 | location.hash = ''; 14 | h = h.replace('LINE_', 'LINENUM_'); 15 | location.hash = h; 16 | } 17 | }); 18 | -------------------------------------------------------------------------------- /themes/simple/assets/js/yui-prettify.js: -------------------------------------------------------------------------------- 1 | YUI().use('node', function(Y) { 2 | var code = Y.all('.prettyprint.linenums'); 3 | if (code.size()) { 4 | code.each(function(c) { 5 | var lis = c.all('ol li'), 6 | l = 1; 7 | lis.each(function(n) { 8 | n.prepend(''); 9 | l++; 10 | }); 11 | }); 12 | var h = location.hash; 13 | location.hash = ''; 14 | h = h.replace('LINE_', 'LINENUM_'); 15 | location.hash = h; 16 | } 17 | }); 18 | -------------------------------------------------------------------------------- /api/assets/vendor/prettify/prettify-min.css: -------------------------------------------------------------------------------- 1 | .str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun{color:#660}.pln{color:#000}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec{color:#606}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}@media print{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun{color:#440}.pln{color:#000}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}} -------------------------------------------------------------------------------- /themes/default/partials/options.handlebars: -------------------------------------------------------------------------------- 1 |
2 | Show: 3 | 7 | 8 | 12 | 13 | 17 |
18 | 19 | -------------------------------------------------------------------------------- /themes/simple/assets/vendor/prettify/prettify-min.css: -------------------------------------------------------------------------------- 1 | .str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun{color:#660}.pln{color:#000}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec{color:#606}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}@media print{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun{color:#440}.pln{color:#000}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}} -------------------------------------------------------------------------------- /themes/default/assets/vendor/prettify/prettify-min.css: -------------------------------------------------------------------------------- 1 | .str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun{color:#660}.pln{color:#000}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec{color:#606}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}@media print{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun{color:#440}.pln{color:#000}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}} -------------------------------------------------------------------------------- /themes/default/partials/index.handlebars: -------------------------------------------------------------------------------- 1 |
2 |
3 |

4 | Browse to a module or class using the sidebar to view its API documentation. 5 |

6 | 7 |

Keyboard Shortcuts

8 | 9 | 18 |
19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /themes/simple/partials/module.handlebars: -------------------------------------------------------------------------------- 1 | 2 |

{{moduleName}}

3 |
{{{moduleDescription}}}
4 | 5 |
6 |
7 | {{#if moduleClasses}} 8 |

This module has the following classes:

9 | 14 | {{/if}} 15 |
16 |
17 | {{#if subModules}} 18 |

This module has the following submodules:

19 | 24 | {{/if}} 25 |
26 |
27 |

28 | Module description found: `{{file}}:{{line}}` 29 | -------------------------------------------------------------------------------- /themes/default/partials/sidebar.handlebars: -------------------------------------------------------------------------------- 1 |
2 |

APIs

3 |
4 | 8 | 9 |
10 | 11 |
12 | 13 |
14 | 19 | 20 | 25 |
26 |
27 |
28 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yuidocjs", 3 | "version": "0.2.0", 4 | "description": "YUI Doc, JavaScript port", 5 | "author": "Dav Glass ", 6 | "bugs": { "web" : "http://github.com/davglass/yuidocjs/issues" }, 7 | "os": ["darwin", "linux"], 8 | "contributors": [ 9 | { "name": "Adam Moore", "email": "amoore@gmail.com" }, 10 | { "name": "Ryan Grove", "email": "ryan@wonko.com" } 11 | ], 12 | "engines": { 13 | "node" : ">=0.4.0" 14 | }, 15 | "main": "./lib/index", 16 | "bin" : { "yuidoc" : "./lib/cli.js" }, 17 | "dependencies": { 18 | "yui3": "*", 19 | "node-markdown": "*", 20 | "yui3-core": "3.4.0", 21 | "minimatch": "0.0.4" 22 | }, 23 | "preferGlobal": "true", 24 | "licenses":[ 25 | { 26 | "type" : "BSD", 27 | "url" : "http://developer.yahoo.com/yui/license.html" 28 | } 29 | ], 30 | "repository": { 31 | "type":"git", 32 | "url":"http://github.com/davglass/yuidocjs.git" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /themes/simple/layouts/main.handlebars: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{htmlTitle}} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |

{{title}}

17 |
18 |
19 | API Docs for: {{projectVersion}} 20 |
21 |
22 |
23 | 24 | 27 | 28 |
29 |
{{>layout_content}}
30 |
31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /themes/default/assets/js/api-filter.js: -------------------------------------------------------------------------------- 1 | YUI.add('api-filter', function (Y) { 2 | 3 | Y.APIFilter = Y.Base.create('apiFilter', Y.Base, [Y.AutoCompleteBase], { 4 | // -- Initializer ---------------------------------------------------------- 5 | initializer: function () { 6 | this._bindUIACBase(); 7 | this._syncUIACBase(); 8 | } 9 | 10 | }, { 11 | // -- Attributes ----------------------------------------------------------- 12 | ATTRS: { 13 | resultHighlighter: { 14 | value: 'phraseMatch' 15 | }, 16 | 17 | // May be set to "classes" or "modules". 18 | queryType: { 19 | value: 'classes' 20 | }, 21 | 22 | source: { 23 | valueFn: function() { 24 | var self = this; 25 | return function(q) { 26 | var data = Y.YUIDoc.meta[self.get('queryType')]; 27 | var out = []; 28 | Y.each(data, function(v) { 29 | if (v.toLowerCase().indexOf(q.toLowerCase()) > -1) { 30 | out.push(v); 31 | } 32 | }); 33 | return out; 34 | } 35 | } 36 | } 37 | } 38 | }); 39 | 40 | }, '3.4.0', {requires: [ 41 | 'autocomplete-base', 'autocomplete-highlighters', 'autocomplete-sources' 42 | ]}); 43 | -------------------------------------------------------------------------------- /themes/simple/partials/events.handlebars: -------------------------------------------------------------------------------- 1 | 2 |
3 | `{{name}}` {{#if type}}<{{#crossLink type}}{{/crossLink}}>{{/if}} 4 | {{#if extended_from}}`/* Extended from {{extended_from}} */`{{/if}} 5 | {{#if overwritten_from}}`/* Overwritten from {{name}} */`{{/if}} 6 |
7 | `{{file}}:{{line}}` 8 | {{{eventDescription}}} 9 | {{#if params}} 10 | Extra event object properties: 11 | 33 | {{/if}} 34 |
35 | 36 | -------------------------------------------------------------------------------- /themes/default/assets/js/tabs.js: -------------------------------------------------------------------------------- 1 | YUI({ 2 | insertBefore: 'site_styles' 3 | }).use('tabview', function(Y) { 4 | var classdocs = Y.one('#classdocs'), 5 | tabviewIndexTable = {}; 6 | if (classdocs) { 7 | if (classdocs.all('li').size()) { 8 | var tabview = new Y.TabView({ srcNode: classdocs }); 9 | tabview.render(); 10 | classdocs.all('li a').each(function (item, index) { 11 | var hash = item.get(['hash']); 12 | type = hash.substring(1); 13 | if (!tabviewIndexTable[type]) { 14 | tabviewIndexTable[type] = index; 15 | } 16 | }) 17 | Y.all('.sidebox.on-page').each(function (item, index) { 18 | var children = item.all('li a'); 19 | children.each(function (cItem, cIndex) { 20 | return function () { 21 | var handleClick = function (e) { 22 | var node = Y.one(this), 23 | hash = node.get(['hash']), 24 | hashValue = hash.substring(1).split('_'), 25 | type = hashValue.shift(), 26 | ogKey = hashValue.join('_'); // in case the hash had other underscores 27 | if (tabviewIndexTable[type] > -1 && tabviewIndexTable[type] !== currentTab) { 28 | currentTab = tabviewIndexTable[type]; 29 | tabview.selectChild(tabviewIndexTable[type]); 30 | } 31 | } 32 | Y.on('click', handleClick, cItem) 33 | }() 34 | }) 35 | }); 36 | } 37 | } 38 | }); 39 | -------------------------------------------------------------------------------- /themes/simple/assets/js/tabs.js: -------------------------------------------------------------------------------- 1 | YUI({ 2 | insertBefore: 'site_styles' 3 | }).use('tabview', function(Y) { 4 | var classdocs = Y.one('#classdocs'), 5 | tabviewIndexTable = {}; 6 | if (classdocs) { 7 | if (classdocs.all('li').size()) { 8 | var tabview = new Y.TabView({ srcNode: classdocs }); 9 | tabview.render(); 10 | classdocs.all('li a').each(function (item, index) { 11 | var hash = item.get(['hash']); 12 | type = hash.substring(1); 13 | if (!tabviewIndexTable[type]) { 14 | tabviewIndexTable[type] = index; 15 | } 16 | }) 17 | Y.all('.sidebox.on-page').each(function (item, index) { 18 | var children = item.all('li a'); 19 | children.each(function (cItem, cIndex) { 20 | return function () { 21 | var handleClick = function (e) { 22 | var node = Y.one(this), 23 | hash = node.get(['hash']), 24 | hashValue = hash.substring(1).split('_'), 25 | type = hashValue.shift(), 26 | ogKey = hashValue.join('_'); // in case the hash had other underscores 27 | if (tabviewIndexTable[type] > -1 && tabviewIndexTable[type] !== currentTab) { 28 | currentTab = tabviewIndexTable[type]; 29 | tabview.selectChild(tabviewIndexTable[type]); 30 | } 31 | } 32 | Y.on('click', handleClick, cItem) 33 | }() 34 | }) 35 | }); 36 | } 37 | } 38 | }); 39 | -------------------------------------------------------------------------------- /themes/simple/partials/attrs.handlebars: -------------------------------------------------------------------------------- 1 | 2 |
3 | `{{name}}` {{#if type}}<{{#crossLink type}}{{/crossLink}}>{{/if}} 4 | {{#if extended_from}}`/* Extended from {{extended_from}} */`{{/if}} 5 | {{#if overwritten_from}}`/* Overwritten from {{name}} */`{{/if}} 6 |
7 | `{{file}}:{{line}}` 8 | {{{attrDescription}}} 9 | {{#if emit}} 10 |
11 | Fires: `{{name}}Change(e)` 12 |

Fires when the value for the configuration attribute `{{name}}` is changed. You can listen for the event using the `on` method if you wish to be notified before the attribute's value has changed, or using the `after` method if you wish to be notified after the attribute's value has changed.

13 | Parameters:
14 | `e` <EventFacade> An Event Facade object with the following attribute specific properties added: 15 |
    16 |
  • `prevVal` The value of the attribute, prior to it being set
  • 17 |
  • `newVal` The value the attribute is to be set to
  • 18 |
  • `attrName` The name of the attribute being set
  • 19 |
  • `subAttrName` If setting a property within the attribute's value, the name of the sub-attribute property being set
  • 20 |
21 |
22 | {{/if}} 23 |
24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2011 Yahoo! Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the Yahoo! Inc. nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL YAHOO! INC. BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011, Yahoo! Inc. All rights reserved. 3 | Code licensed under the BSD License: 4 | http://yuilibrary.com/license/ 5 | */ 6 | /** 7 | * Module creates the YUI instance with the required modules, uses them and exports the **Y** to be used 8 | * by the _CLI class_ or by extenders: `require('yuidocjs');` 9 | * You can use it like this: 10 | 11 | var options = { 12 | paths: [ './lib' ], 13 | outdir: './out' 14 | }; 15 | 16 | var Y = require('yuidoc'); 17 | var json = (new Y.YUIDoc(options)).run(); 18 | 19 | * @class index 20 | * @exports {YUI} Y A YUI instance 21 | * @module yuidoc 22 | */ 23 | 24 | var YUI = require('yui3').YUI, 25 | path = require('path'); 26 | 27 | var Y = YUI({ 28 | modules: { 29 | help: { 30 | fullpath: path.join(__dirname, 'help.js') 31 | }, 32 | docparser: { 33 | fullpath: path.join(__dirname, 'docparser.js'), 34 | requires: ['base-base', 'json-stringify'] 35 | }, 36 | yuidoc: { 37 | fullpath: path.join(__dirname, 'yuidoc.js') 38 | }, 39 | 'doc-builder': { 40 | fullpath: path.join(__dirname, 'builder.js') 41 | }, 42 | utils: { 43 | fullpath: path.join(__dirname, 'utils.js') 44 | }, 45 | docview: { 46 | fullpath: path.join(__dirname, 'docview.js') 47 | } 48 | }, 49 | logExclude: { 50 | yui: true, 51 | get: true, 52 | loader: true, 53 | files: true 54 | } 55 | }).useSync('docparser', 'yuidoc', 'utils', 'doc-builder', 'docview', 'files', 'help'); 56 | 57 | Y.packageInfo = Y.Files.getJSON(path.join(__dirname, '../', 'package.json')); 58 | 59 | module.exports = Y; 60 | -------------------------------------------------------------------------------- /lib/docview.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011, Yahoo! Inc. All rights reserved. 3 | Code licensed under the BSD License: 4 | http://yuilibrary.com/license/ 5 | */ 6 | YUI.add('docview', function(Y) { 7 | 8 | 9 | /* 10 | Selleck 11 | Copyright (c) 2011 Yahoo! Inc. 12 | Licensed under the BSD License. 13 | */ 14 | 15 | /** 16 | View class borrowed from [Selleck](https://github.com/rgrove/selleck) 17 | The view class is a **`handlebars`** template helper. 18 | @class DocView 19 | @constructor 20 | @param {Object} data Meta data to use in this template 21 | @param {String} templateName The name of the template file to render. 22 | */ 23 | function DocView(data, templateName) { 24 | this.templateName = templateName; 25 | Y.mix(this, data); 26 | } 27 | 28 | DocView.prototype = { 29 | /** 30 | * **Mustache** `lambda` method for setting the HTML title 31 | * @method htmlTitle 32 | */ 33 | htmlTitle: function () { 34 | var name = this.displayName || this.name, 35 | title = name; 36 | 37 | if (title) { 38 | if (this.projectName) { 39 | title += ' - ' + this.projectName; 40 | } 41 | } else { 42 | title = this.projectName; 43 | } 44 | 45 | return title; 46 | }, 47 | 48 | /** 49 | * **Mustache** `lambda` method for setting the title 50 | * @method title 51 | */ 52 | title: function () { 53 | var name = this.displayName || this.name, 54 | title = this.projectName; 55 | 56 | if (name) { 57 | title += ': ' + name; 58 | } 59 | 60 | return title; 61 | } 62 | }; 63 | 64 | Y.DocView = DocView; 65 | }); 66 | -------------------------------------------------------------------------------- /themes/default/layouts/main.handlebars: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{htmlTitle}} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |

{{title}}

17 |
18 |
19 | API Docs for: {{projectVersion}} 20 |
21 |
22 |
23 | 24 |
25 | 28 |
29 |
30 | {{>options}} 31 |
32 |
33 | {{>layout_content}} 34 |
35 |
36 |
37 |
38 |
39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /themes/default/partials/module.handlebars: -------------------------------------------------------------------------------- 1 |

{{moduleName}} Module

2 |
3 | {{#if foundAt}} 4 |
5 | Defined in: `{{file}}:{{line}}` 6 |
7 | {{/if}} 8 | 9 | {{#if since}} 10 |

Available since {{since}}

11 | {{/if}} 12 |
13 | 14 | {{#if deprecated}} 15 |
16 |

17 | {{#if deprecationMessage}} 18 | Deprecated: {{deprecationMessage}} 19 | {{else}} 20 | This module is deprecated. 21 | {{/if}} 22 |

23 |
24 | {{/if}} 25 | 26 |
27 | {{{moduleDescription}}} 28 |
29 | 30 |
31 |
32 | {{#if moduleClasses}} 33 |

This module provides the following classes:

34 | 35 | 44 | {{/if}} 45 |
46 | 47 |
48 | {{#if subModules}} 49 |

This module is a rollup of the following modules:

50 | 51 | 64 | {{/if}} 65 |
66 |
67 | -------------------------------------------------------------------------------- /themes/simple/partials/classes.handlebars: -------------------------------------------------------------------------------- 1 |

Class {{moduleName}}

2 | {{#if uses}} 3 | Uses: 4 | {{#each uses}} 5 | {{this}} 6 | {{/each}} 7 |
8 | {{/if}} 9 | {{#if extension_for}} 10 | Extension For: 11 | {{#each extension_for}} 12 | {{this}} 13 | {{/each}} 14 |
15 | {{/if}} 16 | {{#if extends}} 17 | Extends: {{#crossLink extends}}{{/crossLink}}
18 | {{/if}} 19 | Class defined in: `{{file}}:{{line}}` 20 |
{{{classDescription}}}
21 | 22 | {{#if is_constructor}} 23 | {{#is_constructor}} 24 | {{>method}} 25 | {{/is_constructor}} 26 | {{/if}} 27 | 28 |
29 | 43 |
44 | {{#if methods}} 45 |
46 | {{#methods}} 47 | {{>method}} 48 | {{/methods}} 49 |
50 | {{/if}} 51 | {{#if properties}} 52 |
53 | {{#properties}} 54 | {{>props}} 55 | {{/properties}} 56 |
57 | {{/if}} 58 | {{#if attrs}} 59 |
60 | {{#attrs}} 61 | {{>attrs}} 62 | {{/attrs}} 63 |
64 | {{/if}} 65 | {{#if events}} 66 |
67 | {{#events}} 68 | {{>events}} 69 | {{/events}} 70 |
71 | {{/if}} 72 |
73 |
74 | -------------------------------------------------------------------------------- /themes/default/partials/props.handlebars: -------------------------------------------------------------------------------- 1 |
2 |

{{name}}

3 | {{#crossLink type}}{{/crossLink}} 4 | 5 | {{#if deprecated}} 6 | deprecated 7 | {{/if}} 8 | 9 | {{#if access}} 10 | {{access}} 11 | {{/if}} 12 | 13 | {{#if final}} 14 | final 15 | {{/if}} 16 | 17 | {{#if static}} 18 | static 19 | {{/if}} 20 | 21 |
22 | {{#if overwritten_from}} 23 |

Inherited from 24 | 25 | {{overwritten_from/class}} 26 | 27 | but overwritten in 28 | {{else}} 29 | {{#if extended_from}} 30 |

Inherited from 31 | {{extended_from}}: 32 | {{else}} 33 | {{#providedBy}} 34 |

Provided by the {{.}} module.

35 | {{/providedBy}} 36 |

Defined in 37 | {{/if}} 38 | {{/if}} 39 | `{{file}}:{{line}}`

40 | 41 | {{#if deprecationMessage}} 42 |

Deprecated: {{deprecationMessage}}

43 | {{/if}} 44 | 45 | {{#if since}} 46 |

Available since {{since}}

47 | {{/if}} 48 |
49 | 50 |
51 | {{{propertyDescription}}} 52 |
53 | 54 | {{#if default}} 55 |

Default: {{default}}

56 | {{/if}} 57 | 58 | {{#example}} 59 |
60 |

Example:

61 | 62 |
63 | {{{.}}} 64 |
65 |
66 | {{/example}} 67 |
68 | -------------------------------------------------------------------------------- /lib/help.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011, Yahoo! Inc. All rights reserved. 3 | Code licensed under the BSD License: 4 | http://yuilibrary.com/license/ 5 | */ 6 | YUI.add('help', function(Y) { 7 | 8 | var help = [ 9 | "", 10 | "YUI Doc generates API documentation from a modified JavaDoc syntax.", 11 | "", 12 | "Current version ({VERSION})", 13 | "", 14 | "Usage: yuidoc ", 15 | "", 16 | "Common Options:", 17 | " -c, --config, --configfile A JSON config file to provide configuration data.", 18 | " You can also create a yuidoc.json file and place it", 19 | " anywhere under your source tree and YUI Doc will find it", 20 | " and use it.", 21 | " -e, --extension The list of file extensions to parse ", 22 | " for api documentation. (defaults to .js)", 23 | " -x, --exclude Directorys to exclude from parsing ", 24 | " (defaults to '.DS_Store,.svn,CVS,.git,build_rollup_tmp,build_tmp')", 25 | " -v, --version Show the current YUIDoc version", 26 | " --project-version Set the doc version for the template", 27 | " -N, --no-color Turn off terminal colors (for automation)", 28 | " -n, --norecurse Do not recurse directories (default is to recurse)", 29 | " -S, --selleck Look for Selleck component data and attach to API meta data", 30 | " -V, --view Dump the Handlebars.js view data instead of writing template files", 31 | " -p, --parse-only Only parse the API docs and create the JSON data, do not render templates", 32 | " -o, --out Path to put the generated files (defaults to ./out)", 33 | " -t, --themedir Path to a custom theme directory containing Handlebars templates", 34 | " -h, --help Show this help", 35 | " -T, --theme Choose one of the built in themes (default is default)", 36 | "", 37 | " Supply a list of paths (shell globbing is handy here)", 38 | "", 39 | ].join('\n'); 40 | 41 | 42 | 43 | Y.showHelp = function() { 44 | console.error(Y.Lang.sub(help, { 45 | VERSION: Y.packageInfo.version 46 | })); 47 | process.exit(1); 48 | } 49 | }); 50 | -------------------------------------------------------------------------------- /themes/simple/partials/method.handlebars: -------------------------------------------------------------------------------- 1 | 2 |
3 | {{#if final}}final {{/if}}{{#if returnType}}{{#crossLink returnType}}{{/crossLink}} {{/if}}`{{name}}`( `{{paramsList}} ` ) {{#if access}}`/* {{access}} method */`{{/if}} 4 |
5 | 6 | {{#if overwritten_from}} 7 | Defined in {{overwritten_from/class}} but overwritten locally: 8 | {{else}} 9 | {{#if extended_from}} Defined in {{extended_from}}: {{/if}} 10 | {{/if}} 11 | `{{file}}:{{line}}` 12 |
13 | {{{methodDescription}}} 14 | {{#if params}} 15 | Parameters: 16 |
    17 | {{#params}} 18 |
  • 19 | {{#if optional}} 20 | `[{{name}}{{#if optdefault}}={{optdefault}}{{/if}}]` <{{#crossLink type}}{{/crossLink}}> 21 | {{else}} 22 | `{{name}}` <{{#crossLink type}}{{/crossLink}}> 23 | {{/if}} 24 | {{#if multiple}} 25 | (*..n) 26 | {{/if}} 27 | {{{description}}} 28 | {{#if props}} 29 |
      30 | {{#props}} 31 |
    • `{{name}}` <{{#crossLink type}}{{/crossLink}}> {{{description}}} 32 | {{#if props}} 33 |
        34 | {{#props}} 35 |
      • `{{name}}` <{{#crossLink type}}{{/crossLink}}> {{{description}}}
      • 36 | {{/props}} 37 |
      38 | {{/if}} 39 |
    • 40 | {{/props}} 41 |
    42 | {{/if}} 43 |
  • 44 | {{/params}} 45 |
46 | {{/if}} 47 | {{#if return}} 48 | {{#return}} 49 |
Returns: {{#if type}}<{{#crossLink type}}{{/crossLink}}> {{/if}}{{{description}}}
50 | {{/return}} 51 | {{/if}} 52 | {{#if example}} 53 |
Example
54 | {{{example}}} 55 | {{/if}} 56 |
57 | -------------------------------------------------------------------------------- /api/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | YUIDoc 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |

YUIDoc

17 |
18 |
19 | API Docs for: 0.1.0 20 |
21 |
22 |
23 | 24 | 73 | 74 |
75 |

API Docs - Main Index

76 |

Something smart and pretty should probably go here.

77 |
78 |
79 |
80 |
81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /themes/simple/partials/sidebar.handlebars: -------------------------------------------------------------------------------- 1 | 21 | 22 | 34 | 35 | {{#if methods}} 36 | 48 | {{/if}} 49 | 50 | {{#if events}} 51 | 63 | {{/if}} 64 | 65 | {{#if props}} 66 | 78 | {{/if}} 79 | 80 | {{#if attributes}} 81 | 93 | {{/if}} 94 | 95 | {{#if fileTree}} 96 | 104 | {{/if}} 105 | 106 | -------------------------------------------------------------------------------- /themes/default/assets/js/api-search.js: -------------------------------------------------------------------------------- 1 | YUI.add('api-search', function (Y) { 2 | 3 | var Lang = Y.Lang, 4 | Node = Y.Node, 5 | YArray = Y.Array; 6 | 7 | Y.APISearch = Y.Base.create('apiSearch', Y.Base, [Y.AutoCompleteBase], { 8 | // -- Public Properties ---------------------------------------------------- 9 | RESULT_TEMPLATE: 10 | '
  • ' + 11 | '' + 12 | '

    {name}

    ' + 13 | '{resultType}' + 14 | '
    {description}
    ' + 15 | '{class}' + 16 | '
    ' + 17 | '
  • ', 18 | 19 | // -- Initializer ---------------------------------------------------------- 20 | initializer: function () { 21 | this._bindUIACBase(); 22 | this._syncUIACBase(); 23 | }, 24 | 25 | // -- Protected Methods ---------------------------------------------------- 26 | _apiResultFilter: function (query, results) { 27 | // Filter components out of the results. 28 | return YArray.filter(results, function (result) { 29 | return result.raw.resultType === 'component' ? false : result; 30 | }); 31 | }, 32 | 33 | _apiResultFormatter: function (query, results) { 34 | return YArray.map(results, function (result) { 35 | var raw = Y.merge(result.raw), // create a copy 36 | desc = raw.description || ''; 37 | 38 | // Convert description to text and truncate it if necessary. 39 | desc = Node.create('
    ' + desc + '
    ').get('text'); 40 | 41 | if (desc.length > 65) { 42 | desc = Y.Escape.html(desc.substr(0, 65)) + ' …'; 43 | } else { 44 | desc = Y.Escape.html(desc); 45 | } 46 | 47 | raw['class'] || (raw['class'] = ''); 48 | raw.description = desc; 49 | 50 | // Use the highlighted result name. 51 | raw.name = result.highlighted; 52 | 53 | return Lang.sub(this.RESULT_TEMPLATE, raw); 54 | }, this); 55 | }, 56 | 57 | _apiTextLocator: function (result) { 58 | return result.displayName || result.name; 59 | } 60 | }, { 61 | // -- Attributes ----------------------------------------------------------- 62 | ATTRS: { 63 | resultFormatter: { 64 | valueFn: function () { 65 | return this._apiResultFormatter; 66 | } 67 | }, 68 | 69 | resultFilters: { 70 | valueFn: function () { 71 | return this._apiResultFilter; 72 | } 73 | }, 74 | 75 | resultHighlighter: { 76 | value: 'phraseMatch' 77 | }, 78 | 79 | resultListLocator: { 80 | value: 'data.results' 81 | }, 82 | 83 | resultTextLocator: { 84 | valueFn: function () { 85 | return this._apiTextLocator; 86 | } 87 | }, 88 | 89 | source: { 90 | value: '/api/v1/search?q={query}&count={maxResults}' 91 | } 92 | } 93 | }); 94 | 95 | }, '3.4.0', {requires: [ 96 | 'autocomplete-base', 'autocomplete-highlighters', 'autocomplete-sources', 97 | 'escape' 98 | ]}); 99 | -------------------------------------------------------------------------------- /api/files/base_js_Base.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | YUIDoc 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
    14 |
    15 |
    16 |

    YUIDoc

    17 |
    18 |
    19 | API Docs for: 0.1.0 20 |
    21 |
    22 |
    23 | 24 | 84 | 85 |
    86 |

    base/js/Base.js

    87 | 88 |
     89 | 
     90 | 
    91 | 92 |
    93 |
    94 |
    95 |
    96 | 97 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /tests/test2/dump/dump.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Returns a simple string representation of the object or array. 3 | * Other types of objects will be returned unprocessed. Arrays 4 | * are expected to be indexed. Use object notation for 5 | * associative arrays. 6 | * 7 | * If included, the dump method is added to the YUI instance. 8 | * 9 | * @module dump 10 | */ 11 | 12 | var L = Y.Lang, 13 | OBJ = '{...}', 14 | FUN = 'f(){...}', 15 | COMMA = ', ', 16 | ARROW = ' => ', 17 | 18 | /** 19 | * The following methods are added to the YUI instance 20 | * @class YUI~dump 21 | */ 22 | 23 | /** 24 | * Returns a simple string representation of the object or array. 25 | * Other types of objects will be returned unprocessed. Arrays 26 | * are expected to be indexed. Use object notation for 27 | * associative arrays. 28 | * 29 | * This method is in the 'dump' module, which is not bundled with 30 | * the core YUI object 31 | * 32 | * @method dump 33 | * @param {object} o The object to dump. 34 | * @param {int} d How deep to recurse child objects, default 3. 35 | * @return {string} the dump result. 36 | */ 37 | dump = function(o, d) { 38 | var i, len, s = [], type = L.type(o); 39 | 40 | // Cast non-objects to string 41 | // Skip dates because the std toString is what we want 42 | // Skip HTMLElement-like objects because trying to dump 43 | // an element will cause an unhandled exception in FF 2.x 44 | if (!L.isObject(o)) { 45 | return o + ''; 46 | } else if (type == 'date') { 47 | return o; 48 | } else if (o.nodeType && o.tagName) { 49 | return o.tagName + '#' + o.id; 50 | } else if (o.document && o.navigator) { 51 | return 'window'; 52 | } else if (o.location && o.body) { 53 | return 'document'; 54 | } else if (type == 'function') { 55 | return FUN; 56 | } 57 | 58 | // dig into child objects the depth specifed. Default 3 59 | d = (L.isNumber(d)) ? d : 3; 60 | 61 | // arrays [1, 2, 3] 62 | if (type == 'array') { 63 | s.push('['); 64 | for (i = 0, len = o.length; i < len; i = i + 1) { 65 | if (L.isObject(o[i])) { 66 | s.push((d > 0) ? L.dump(o[i], d - 1) : OBJ); 67 | } else { 68 | s.push(o[i]); 69 | } 70 | s.push(COMMA); 71 | } 72 | if (s.length > 1) { 73 | s.pop(); 74 | } 75 | s.push(']'); 76 | // regexp /foo/ 77 | } else if (type == 'regexp') { 78 | s.push(o.toString()); 79 | // objects {k1 => v1, k2 => v2} 80 | } else { 81 | s.push('{'); 82 | for (i in o) { 83 | if (o.hasOwnProperty(i)) { 84 | try { 85 | s.push(i + ARROW); 86 | if (L.isObject(o[i])) { 87 | s.push((d > 0) ? L.dump(o[i], d - 1) : OBJ); 88 | } else { 89 | s.push(o[i]); 90 | } 91 | s.push(COMMA); 92 | } catch (e) { 93 | s.push('Error: ' + e.message); 94 | } 95 | } 96 | } 97 | if (s.length > 1) { 98 | s.pop(); 99 | } 100 | s.push('}'); 101 | } 102 | 103 | return s.join(''); 104 | }; 105 | 106 | Y.dump = dump; 107 | L.dump = dump; 108 | 109 | -------------------------------------------------------------------------------- /api/classes/cli.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | YUIDoc 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
    14 |
    15 |
    16 |

    YUIDoc

    17 |
    18 |
    19 | API Docs for: 0.1.0 20 |
    21 |
    22 |
    23 | 24 | 82 | 83 |
    84 |

    Class cli

    85 | 86 | 87 | Class defined in: lib/cli.js:3 88 |

    Parses the arguments, creates the options and passes them to Y.YUIDoc.

    89 | 90 | 91 | 92 |
    93 |
      94 | 95 | 96 | 97 | 98 |
    99 |
    100 | 101 | 102 | 103 | 104 |
    105 |
    106 |
    107 |
    108 |
    109 |
    110 | 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /tests/test/test.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * The test project 4 | * @project tester 5 | * @title The Tester 6 | * @icon http://a.img 7 | * @url http://one.url 8 | * @url http://two.url 9 | * @author admo 10 | * @contributor davglass 11 | * @contributor entropy 12 | */ 13 | 14 | /** 15 | * The module 16 | * @module mymodule 17 | * @category one,two 18 | * @category three 19 | * @requires one 20 | * @requires two 21 | * @uses three 22 | * @uses four 23 | */ 24 | 25 | /** 26 | * The submodule 27 | * @submodule mysubmodule 28 | * @category three,four 29 | */ 30 | 31 | 32 | /** 33 | * The class def 34 | * @class myclass 35 | * @constructor 36 | */ 37 | 38 | /** 39 | * test optional 40 | * @method testoptional 41 | * @param notype my desc 42 | * @param {int} namesecond my desc 43 | * @param namefirst {string} my desc 44 | * @param [optionalvar] {bool} my desc 45 | * @param {string} [optionalwithdefault="defaultval"] my desc 46 | * @evil 47 | * @injects {HTML} uses a string parameter to populate innerHTML 48 | * @returns something without a type 49 | * @example 50 | * This is code 51 | * @example 52 | * var = 'This is more code'; 53 | * document.title = 'Test This'; 54 | */ 55 | 56 | /** 57 | * test object param 58 | * @method testobjectparam 59 | * @param {object} anobject the object 60 | * @param {string} anobject.prop1 prop1 61 | * @param {bool} anobject.prop2 prop2 62 | * @return {string} something with a type 63 | */ 64 | 65 | /** 66 | * test 0..n param 67 | * @method test0ton 68 | * @param {string} [optionalandmultiple]* my desc 69 | * @returns something without a type 70 | */ 71 | 72 | /** 73 | * test 1..n param 74 | * @method test1ton 75 | * @param {string} multiple* my desc 76 | * @returns something without a type 77 | */ 78 | 79 | /** 80 | * Testing really long param description paring 81 | * @method reallyLongParamDesc 82 | * @param {Object} config Object with configuration property name/value pairs. The object can be 83 | * used to provide default values for the objects published attributes. 84 | * 85 | *

    86 | * The config object can also contain the following non-attribute properties, providing a convenient 87 | * way to configure events listeners and plugins for the instance, as part of the constructor call: 88 | *

    89 | * 90 | *
    91 | *
    on
    92 | *
    An event name to listener function map, to register event listeners for the "on" moment of the event. A constructor convenience property for the on method.
    93 | *
    after
    94 | *
    An event name to listener function map, to register event listeners for the "after" moment of the event. A constructor convenience property for the after method.
    95 | *
    bubbleTargets
    96 | *
    An object, or array of objects, to register as bubble targets for bubbled events fired by this instance. A constructor convenience property for the addTarget method.
    97 | *
    plugins
    98 | *
    A plugin, or array of plugins to be plugged into the instance (see PluginHost's plug method for signature details). A constructor convenience property for the plug method.
    99 | *
    100 | * 101 | */ 102 | 103 | 104 | /** 105 | This is the description 106 | 107 | @method foo 108 | @example 109 | 110 | var email = "lsmith@foo-truncated-here.com" 111 | 112 | **/ 113 | 114 | /** 115 | Other Class 116 | @class OtherClass 117 | @extensionfor myclass 118 | */ 119 | 120 | /** 121 | Other Class 2 122 | @class OtherClass2 123 | @extension_for myclass 124 | */ 125 | -------------------------------------------------------------------------------- /api/classes/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | YUIDoc 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
    14 |
    15 |
    16 |

    YUIDoc

    17 |
    18 |
    19 | API Docs for: 0.1.0 20 |
    21 |
    22 |
    23 | 24 | 82 | 83 |
    84 |

    Class index

    85 | 86 | 87 | Class defined in: lib/index.js:1 88 |

    Module creates the YUI instance with the required modules, uses them and exports the Y to be used 89 | by the CLI class or by extenders: require('yuidocjs');
    90 | You can use it like this:

    91 | 92 |
     var options = {
     93 |      paths: [ './lib' ],
     94 |      outdir: './out'
     95 |  };
     96 | 
     97 |  var Y = require('yuidoc');
     98 |  var json = (new Y.YUIDoc(options)).run();
     99 | 
    100 | 101 | 102 | 103 |
    104 |
      105 | 106 | 107 | 108 | 109 |
    110 |
    111 | 112 | 113 | 114 | 115 |
    116 |
    117 |
    118 |
    119 |
    120 |
    121 | 122 | 123 | 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /lib/cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | /* 3 | Copyright (c) 2011, Yahoo! Inc. All rights reserved. 4 | Code licensed under the BSD License: 5 | http://yuilibrary.com/license/ 6 | */ 7 | 8 | /** 9 | * Parses the arguments, creates the options and passes them to Y.YUIDoc. 10 | * @class cli 11 | * @module yuidoc 12 | */ 13 | 14 | var Y = require('yuidocjs'), 15 | fs = require('fs'), 16 | path = require('path'); 17 | 18 | var args = Y.Array(process.argv, 2), 19 | options = {}; 20 | 21 | while (args.length > 0) { 22 | var v = args.shift(); 23 | // options.* defined in ./builder.js 24 | switch (v) { 25 | case "-c": 26 | case "--config": 27 | case "--configfile": 28 | options.configfile = args.shift(); 29 | break; 30 | case "-e": 31 | case "--extension": 32 | options.extension = args.shift(); 33 | break; 34 | case "-x": 35 | case "--exclude": 36 | options.exclude = args.shift(); 37 | break; 38 | case "-v": 39 | case "--version": 40 | console.error(Y.packageInfo.version); 41 | process.exit(1); 42 | break; 43 | case "--project-version": 44 | options.version = args.shift(); 45 | break; 46 | case "-N": 47 | case "--no-color": 48 | Y.config.useColor = false; 49 | options.nocolor = true; 50 | break; 51 | case "-n": 52 | case "--norecurse": 53 | options.norecurse = true; 54 | break; 55 | case "-S": 56 | case "--selleck": 57 | options.selleck = true; 58 | break; 59 | case "-V": 60 | case "--view": 61 | options.dumpview = true; 62 | break; 63 | case "-p": 64 | case "--parse-only": 65 | options.parseOnly = true; 66 | break; 67 | case "-o": 68 | case "--outdir": 69 | options.outdir = args.shift(); 70 | break; 71 | case "-t": 72 | case "--themedir": 73 | options.themedir = args.shift(); 74 | break; 75 | case "-h": 76 | case "--help": 77 | Y.showHelp(); 78 | break; 79 | case "-T": 80 | case "--theme": 81 | var theme = args.shift(); 82 | options.themedir = path.join(__dirname, '../', 'themes', theme); 83 | break; 84 | default: 85 | if (!options.paths) { 86 | options.paths = []; 87 | } 88 | options.paths.push(v); 89 | } 90 | } 91 | 92 | Y.log('Starting YUIDoc@' + Y.packageInfo.version + ' using YUI@' + Y.version, 'info', 'yuidoc'); 93 | 94 | var starttime = (new Date).getTime(); 95 | 96 | var project = {}; 97 | if (options.configfile) { 98 | project = Y.Files.getJSON(options.configfile); 99 | } else { 100 | Y.log('Scanning for yuidoc.json file.', 'info', 'yuidoc'); 101 | project = Y.getProjectData(); 102 | if (!project) { 103 | project = {}; 104 | } 105 | } 106 | 107 | 108 | if (project.options && Object.keys(project.options).length) { 109 | options = Y.merge(project.options, options); 110 | delete project.options; 111 | options.project = project; 112 | } 113 | 114 | if (options.version && options.project) { 115 | options.project.version = options.version; 116 | delete options.version; 117 | } 118 | 119 | if (!options.outdir) { 120 | options.outdir = './out'; 121 | } 122 | 123 | options.paths = Y.validatePaths(options.paths, options.ignorePaths); 124 | 125 | if (!options.paths.length) { 126 | Y.log('Paths argument was empty', 'warn', 'yuidoc'); 127 | console.error(options); 128 | Y.showHelp(); 129 | process.exit(1); 130 | } 131 | 132 | Y.log('Starting YUIDoc with the following options:', 'info', 'yuidoc'); 133 | var opts = Y.clone(options); 134 | if (opts.paths && opts.paths.length && (opts.paths.length > 10)) { 135 | opts.paths = [].concat(opts.paths.slice(0, 5), [''], options.paths.slice(-5)); 136 | } 137 | Y.log(opts, 'info', 'yuidoc'); 138 | 139 | var json = (new Y.YUIDoc(options)).run(); 140 | if (json.project) { 141 | options = Y.merge(options, json.project); 142 | } 143 | if (options.title && !options.name) { 144 | options.name = options.title; 145 | } 146 | 147 | if (!options.parseOnly) { 148 | var builder = new Y.DocBuilder(options, json); 149 | builder.compile(function() { 150 | var endtime = (new Date).getTime(); 151 | Y.log('Completed in ' + ((endtime - starttime) / 1000) + ' seconds' , 'info', 'yuidoc'); 152 | }); 153 | } 154 | -------------------------------------------------------------------------------- /api/modules/yuidoc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | YUIDoc 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
    14 |
    15 |
    16 |

    YUIDoc

    17 |
    18 |
    19 | API Docs for: 0.1.0 20 |
    21 |
    22 |
    23 | 24 | 82 | 83 |
    84 |
    85 |

    yuidoc

    86 |

    This is the module description for the YUIDoc module.

    87 | 88 |
     var options = {
     89 |      paths: [ './lib' ],
     90 |      outdir: './out'
     91 |  };
     92 | 
     93 |  var Y = require('yuidoc');
     94 |  var json = (new Y.YUIDoc(options)).run();
     95 | 
    96 | 97 |
    98 |
    99 | 100 |

    This module has the following classes:

    101 | 118 | 119 |
    120 |
    121 | 122 |
    123 |
    124 |

    125 | Module description found: lib/yuidoc.js:5 126 |
    127 |
    128 |
    129 |
    130 | 131 | 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /api/files/lib_index.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | YUIDoc 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
    14 |
    15 |
    16 |

    YUIDoc

    17 |
    18 |
    19 | API Docs for: 0.1.0 20 |
    21 |
    22 |
    23 | 24 | 82 | 83 |
    84 |

    lib/index.js

    85 | 86 |
     87 | /**
     88 | * Module creates the YUI instance with the required modules, uses them and exports the **Y** to be used
     89 | * by the _CLI class_ or by extenders: require('yuidocjs');  
     90 | * You can use it like this:  
     91 | 
     92 |     var options = {
     93 |         paths: [ './lib' ],
     94 |         outdir: './out'
     95 |     };
     96 | 
     97 |     var Y = require('yuidoc');
     98 |     var json = (new Y.YUIDoc(options)).run();
     99 | 
    100 | * @class index
    101 | * @exports {YUI} Y A YUI instance
    102 | * @module yuidoc
    103 | */
    104 | 
    105 | var YUI = require('yui3').YUI,
    106 |     path = require('path');
    107 | 
    108 | var Y = YUI({
    109 |     modules: {
    110 |         docparser: {
    111 |             fullpath: path.join(__dirname, 'docparser.js'),
    112 |             requires: ['base-base', 'json-stringify']
    113 |         },
    114 |         yuidoc: {
    115 |             fullpath: path.join(__dirname, 'yuidoc.js')
    116 |         },
    117 |         'doc-builder': {
    118 |             fullpath: path.join(__dirname, 'builder.js')
    119 |         },
    120 |         utils: {
    121 |             fullpath: path.join(__dirname, 'utils.js')
    122 |         },
    123 |         docview: {
    124 |             fullpath: path.join(__dirname, 'docview.js')
    125 |         }
    126 |     },
    127 |     logExclude: {
    128 |         yui: true,
    129 |         get: true,
    130 |         loader: true
    131 |     }
    132 | }).useSync('docparser', 'yuidoc', 'utils', 'doc-builder', 'docview', 'files');
    133 | 
    134 | module.exports = Y;
    135 | 
    136 | 
    137 | 138 |
    139 |
    140 |
    141 |
    142 | 143 | 144 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /themes/default/partials/events.handlebars: -------------------------------------------------------------------------------- 1 |
    2 |

    {{name}}

    3 | {{#crossLink type}}{{/crossLink}} 4 | 5 | {{#if deprecated}} 6 | deprecated 7 | {{/if}} 8 | 9 | {{#if access}} 10 | {{access}} 11 | {{/if}} 12 | 13 | {{#if final}} 14 | final 15 | {{/if}} 16 | 17 | {{#if static}} 18 | static 19 | {{/if}} 20 | 21 |
    22 | {{#if overwritten_from}} 23 |

    Inherited from 24 | 25 | {{overwritten_from/class}} 26 | 27 | but overwritten in 28 | {{else}} 29 | {{#if extended_from}} 30 |

    Inherited from 31 | {{extended_from}}: 32 | {{else}} 33 | {{#providedBy}} 34 |

    Provided by the {{.}} module.

    35 | {{/providedBy}} 36 |

    Defined in 37 | {{/if}} 38 | {{/if}} 39 | `{{file}}:{{line}}`

    40 | 41 | {{#if deprecationMessage}} 42 |

    Deprecated: {{deprecationMessage}}

    43 | {{/if}} 44 | 45 | {{#if since}} 46 |

    Available since {{since}}

    47 | {{/if}} 48 |
    49 | 50 |
    51 | {{{eventDescription}}} 52 |
    53 | 54 | {{#if params}} 55 |
    56 |

    Event Payload:

    57 | 58 |
      59 | {{#params}} 60 |
    • 61 | {{#if optional}} 62 | [{{name}}{{#if optdefault}}={{optdefault}}{{/if}}] 63 | {{#crossLink type}}{{/crossLink}} 64 | optional 65 | {{else}} 66 | {{name}} 67 | {{#crossLink type}}{{/crossLink}} 68 | {{/if}} 69 | 70 | {{#if multiple}} 71 | Multiple 72 | {{/if}} 73 | 74 |
      75 | {{{description}}} 76 |
      77 | 78 | {{#if props}} 79 |
        80 | {{#props}} 81 |
      • 82 | {{name}} 83 | {{#crossLink type}}{{/crossLink}} 84 | 85 |
        86 | {{{description}}} 87 |
        88 | 89 | {{#if props}} 90 |
          91 | {{#props}} 92 |
        • 93 | {{name}} 94 | {{#crossLink type}}{{/crossLink}} 95 | 96 |
          97 | {{{description}}} 98 |
          99 |
        • 100 | {{/props}} 101 |
        102 | {{/if}} 103 |
      • 104 | {{/props}} 105 |
      106 | {{/if}} 107 |
    • 108 | {{/params}} 109 |
    110 |
    111 | {{/if}} 112 | 113 | 114 | {{#example}} 115 |
    116 |

    Example:

    117 | 118 |
    119 | {{{.}}} 120 |
    121 |
    122 | {{/example}} 123 |
    124 | -------------------------------------------------------------------------------- /api/files/lib_docview.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | YUIDoc 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
    14 |
    15 |
    16 |

    YUIDoc

    17 |
    18 |
    19 | API Docs for: 0.1.0 20 |
    21 |
    22 |
    23 | 24 | 82 | 83 |
    84 |

    lib/docview.js

    85 | 86 |
     87 | YUI.add('docview', function(Y) {
     88 | 
     89 | 
     90 | /*
     91 | Selleck
     92 | Copyright (c) 2011 Yahoo! Inc.
     93 | Licensed under the BSD License.
     94 | */
     95 | 
     96 |     /**
     97 |     View class borrowed from [Selleck](https://github.com/rgrove/selleck)  
     98 |     The view class is a **handlebars** template helper.
     99 |     @class DocView
    100 |     @constructor
    101 |     @param {Object} data Meta data to use in this template
    102 |     @param {String} templateName The name of the template file to render.
    103 |     */
    104 |     function DocView(data, templateName) {
    105 |         this.templateName = templateName;
    106 |         Y.mix(this, data);
    107 |     }
    108 | 
    109 |     DocView.prototype = {
    110 |         /**
    111 |         * **Mustache** lambda method for setting the HTML title
    112 |         * @method htmlTitle
    113 |         */
    114 |         htmlTitle: function () {
    115 |             var name  = this.displayName || this.name,
    116 |                 title = name;
    117 | 
    118 |             if (title) {
    119 |                 if (this.projectName) {
    120 |                     title += ' - ' + this.projectName;
    121 |                 }
    122 |             } else {
    123 |                 title = this.projectName;
    124 |             }
    125 | 
    126 |             return title;
    127 |         },
    128 | 
    129 |         /**
    130 |         * **Mustache** lambda method for setting the title
    131 |         * @method title
    132 |         */
    133 |         title: function () {
    134 |             var name  = this.displayName || this.name,
    135 |                 title = this.projectName;
    136 | 
    137 |             if (name) {
    138 |                 title += ': ' + name;
    139 |             }
    140 | 
    141 |             return title;
    142 |         }
    143 |     };
    144 | 
    145 |     Y.DocView = DocView;
    146 | });
    147 | 
    148 | 
    149 | 150 |
    151 |
    152 |
    153 |
    154 | 155 | 156 | 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /themes/default/partials/attrs.handlebars: -------------------------------------------------------------------------------- 1 |
    2 | {{! For backwards compatibility }} 3 |

    {{name}}

    4 | {{#crossLink type}}{{/crossLink}} 5 | 6 | {{#if deprecated}} 7 | deprecated 8 | {{/if}} 9 | 10 | {{#if access}} 11 | {{access}} 12 | {{/if}} 13 | 14 | {{#if final}} 15 | final 16 | {{/if}} 17 | 18 | {{#if static}} 19 | static 20 | {{/if}} 21 | 22 |
    23 | {{#if overwritten_from}} 24 |

    Inherited from 25 | 26 | {{overwritten_from/class}} 27 | 28 | but overwritten in 29 | {{else}} 30 | {{#if extended_from}} 31 |

    Inherited from 32 | {{extended_from}}: 33 | {{else}} 34 | {{#providedBy}} 35 |

    Provided by the {{.}} module.

    36 | {{/providedBy}} 37 |

    Defined in 38 | {{/if}} 39 | {{/if}} 40 | `{{file}}:{{line}}`

    41 | 42 | {{#if deprecationMessage}} 43 |

    Deprecated: {{deprecationMessage}}

    44 | {{/if}} 45 | 46 | {{#if since}} 47 |

    Available since {{since}}

    48 | {{/if}} 49 |
    50 | 51 |
    52 | {{{attrDescription}}} 53 |
    54 | 55 | {{#if default}} 56 |

    Default: {{default}}

    57 | {{/if}} 58 | 59 | {{#if emit}} 60 |
    61 |

    Fires event {{name}}Change

    62 | 63 |

    64 | Fires when the value for the configuration attribute `{{name}}` is 65 | changed. You can listen for the event using the `on` method if you 66 | wish to be notified before the attribute's value has changed, or 67 | using the `after` method if you wish to be notified after the 68 | attribute's value has changed. 69 |

    70 | 71 |
    72 |

    Parameters:

    73 | 74 |
      75 |
    • 76 | e 77 | {{#crossLink "EventFacade"}}{{/crossLink}} 78 | 79 |
      80 | An Event Facade object with the following 81 | attribute-specific properties added: 82 |
      83 | 84 |
        85 |
      • 86 | prevVal 87 | Any 88 |
        The value of the attribute, prior to it being set.
        89 |
      • 90 |
      • 91 | newVal 92 | Any 93 |
        The value the attribute is to be set to.
        94 |
      • 95 |
      • 96 | attrName 97 | {{#crossLink "String"}}{{/crossLink}} 98 |
        The name of the attribute being set.
        99 |
      • 100 |
      • 101 | subAttrName 102 | {{#crossLink "String"}}{{/crossLink}} 103 |
        If setting a property within the attribute's value, the name of the sub-attribute property being set.
        104 |
      • 105 |
      106 |
    • 107 |
    108 |
    109 |
    110 | {{/if}} 111 | 112 | {{#example}} 113 |
    114 |

    Example:

    115 | 116 |
    117 | {{{.}}} 118 |
    119 |
    120 | {{/example}} 121 |
    122 | -------------------------------------------------------------------------------- /api/files/lib_cli.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | YUIDoc 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
    14 |
    15 |
    16 |

    YUIDoc

    17 |
    18 |
    19 | API Docs for: 0.1.0 20 |
    21 |
    22 |
    23 | 24 | 82 | 83 |
    84 |

    lib/cli.js

    85 | 86 |
     87 | #!/usr/bin/env node
     88 | 
     89 | /**
     90 | * Parses the arguments, creates the options and passes them to Y.YUIDoc.
     91 | * @class cli
     92 | * @module yuidoc
     93 | */
     94 | 
     95 | var Y = require('yuidocjs'),
     96 |     fs = require('fs'),
     97 |     path = require('path');
     98 | 
     99 | var args = Y.Array(process.argv, 2),
    100 |     options = {};
    101 | 
    102 | while (args.length > 0) {
    103 |     var v = args.shift();
    104 |     switch (v) {
    105 |         case "-c":
    106 |         case "--config":
    107 |         case "--configfile":
    108 |             options.configfile = args.shift();
    109 |             break;
    110 |         case "-e":
    111 |         case "--extension":
    112 |             options.extension = args.shift();
    113 |             break;
    114 |         case "-x":
    115 |         case "--exclude":
    116 |             options.extension = args.shift();
    117 |             break;
    118 |         case "-v":
    119 |         case "--version":
    120 |             options.version = args.shift();
    121 |             break;
    122 |         case "-n":
    123 |         case "--norecurse":
    124 |             options.norecurse = true;
    125 |             break;
    126 |         case "-o":
    127 |         case "--outdir":
    128 |             options.outdir = args.shift();
    129 |             break;
    130 |         default:
    131 |             if (!options.paths) {
    132 |                 options.paths = [];
    133 |             }
    134 |             options.paths.push(v);
    135 |     }
    136 | }
    137 | 
    138 | var starttime = (new Date).getTime();
    139 | 
    140 | var project = {};
    141 | if (options.configfile) {
    142 |     project = Y.Files.getJSON(options.configfile);
    143 | } else {
    144 |     project = Y.getProjectData();
    145 |     if (!project) {
    146 |         project = {};
    147 |     }
    148 | }
    149 | 
    150 | if (project.options && Object.keys(project.options).length) {
    151 |     options = Y.merge(project.options, options);
    152 |     delete project.options;
    153 |     options.project = project;
    154 | }
    155 | 
    156 | if (!options.outdir) {
    157 |     options.outdir = './out';
    158 | }
    159 | 
    160 | options.paths = Y.validatePaths(options.paths, options.ignorePaths);
    161 | 
    162 | var json = (new Y.YUIDoc(options)).run();
    163 | if (json.project) {
    164 |     options = Y.merge(options, json.project);
    165 | }
    166 | if (options.title && !options.name) {
    167 |     options.name = options.title;
    168 | }
    169 | var builder = new Y.DocBuilder(options, json);
    170 | builder.compile(function() {
    171 |     var endtime = (new Date).getTime();
    172 |     Y.log('Completed in ' + ((endtime - starttime) / 1000) + ' seconds' , 'info', 'yuidoc');
    173 | });
    174 | 
    175 | 
    176 | 177 |
    178 |
    179 |
    180 |
    181 | 182 | 183 | 184 | 185 | 186 | 187 | -------------------------------------------------------------------------------- /api/classes/DocView.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | YUIDoc 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
    14 |
    15 |
    16 |

    YUIDoc

    17 |
    18 |
    19 | API Docs for: 0.1.0 20 |
    21 |
    22 |
    23 | 24 | 82 | 83 |
    84 |

    Class DocView

    85 | 86 | 87 | Class defined in: lib/docview.js:10 88 |

    View class borrowed from Selleck
    89 | The view class is a handlebars template helper.

    90 | 91 | 92 | 93 | 94 |
    95 | DocView ( data, templateName ) 96 |
    97 | 98 | 99 | 100 | 101 | lib/docview.js:10 102 | 103 | 104 | 105 | Parameters: 106 |
      107 | 108 |
    • 109 | 110 | data <Object> 111 | 112 | 113 | Meta data to use in this template 114 | 115 |
    • 116 | 117 |
    • 118 | 119 | templateName <String> 120 | 121 | 122 | The name of the template file to render. 123 | 124 |
    • 125 | 126 |
    127 | 128 | 129 | 130 |
    131 | 132 | 133 | 134 | 135 |
    136 |
      137 | 138 |
    • Methods
    • 139 | 140 | 141 | 142 | 143 |
    144 |
    145 | 146 |
    147 | 148 | 149 |
    150 | htmlTitle ( ) 151 |
    152 | 153 | 154 | 155 | 156 | lib/docview.js:24 157 | 158 |

    Mustache lambda method for setting the HTML title

    159 | 160 | 161 | 162 |
    163 | 164 | 165 | 166 |
    167 | title ( ) 168 |
    169 | 170 | 171 | 172 | 173 | lib/docview.js:43 174 | 175 |

    Mustache lambda method for setting the title

    176 | 177 | 178 | 179 |
    180 | 181 | 182 |
    183 | 184 | 185 | 186 | 187 |
    188 |
    189 |
    190 |
    191 |
    192 |
    193 | 194 | 195 | 196 | 197 | 198 | 199 | -------------------------------------------------------------------------------- /themes/default/partials/method.handlebars: -------------------------------------------------------------------------------- 1 |
    2 |

    {{name}}

    3 | 4 | {{#if params}} 5 |
    6 | (
      7 | {{#params}} 8 |
    • 9 | {{#if optional}} 10 | [{{name}}{{#if optdefault}}={{optdefault}}{{/if}}] 11 | {{else}} 12 | {{name}} 13 | {{/if}} 14 |
    • 15 | {{/params}} 16 |
    ) 17 |
    18 | {{else}} 19 | () 20 | {{/if}} 21 | 22 | {{#if return}} 23 | 24 | {{#crossLink returnType}}{{/crossLink}} 25 | 26 | {{/if}} 27 | 28 | {{#if deprecated}} 29 | deprecated 30 | {{/if}} 31 | 32 | {{#if access}} 33 | {{access}} 34 | {{/if}} 35 | 36 | {{#if final}} 37 | final 38 | {{/if}} 39 | 40 | {{#if static}} 41 | static 42 | {{/if}} 43 | 44 | {{#if chainable}} 45 | chainable 46 | {{/if}} 47 | 48 |
    49 | {{#if overwritten_from}} 50 |

    Inherited from 51 | 52 | {{overwritten_from/class}} 53 | 54 | but overwritten in 55 | {{else}} 56 | {{#if extended_from}} 57 |

    Inherited from 58 | {{extended_from}}: 59 | {{else}} 60 | {{#providedBy}} 61 |

    Provided by the {{.}} module.

    62 | {{/providedBy}} 63 |

    Defined in 64 | {{/if}} 65 | {{/if}} 66 | `{{file}}:{{line}}`

    67 | 68 | {{#if deprecationMessage}} 69 |

    Deprecated: {{deprecationMessage}}

    70 | {{/if}} 71 | 72 | {{#if since}} 73 |

    Available since {{since}}

    74 | {{/if}} 75 |
    76 | 77 |
    78 | {{{methodDescription}}} 79 |
    80 | 81 | {{#if params}} 82 |
    83 |

    Parameters:

    84 | 85 |
      86 | {{#params}} 87 |
    • 88 | {{#if optional}} 89 | [{{name}}{{#if optdefault}}={{optdefault}}{{/if}}] 90 | {{#crossLink type}}{{/crossLink}} 91 | optional 92 | {{else}} 93 | {{name}} 94 | {{#crossLink type}}{{/crossLink}} 95 | {{/if}} 96 | 97 | {{#if multiple}} 98 | multiple 99 | {{/if}} 100 | 101 |
      102 | {{{description}}} 103 |
      104 | 105 | {{#if props}} 106 |
        107 | {{#props}} 108 |
      • 109 | {{name}} 110 | {{#crossLink type}}{{/crossLink}} 111 | 112 |
        113 | {{{description}}} 114 |
        115 | 116 | {{#if props}} 117 |
          118 | {{#props}} 119 |
        • 120 | {{name}} 121 | {{#crossLink type}}{{/crossLink}} 122 | 123 |
          124 | {{{description}}} 125 |
          126 |
        • 127 | {{/props}} 128 |
        129 | {{/if}} 130 |
      • 131 | {{/props}} 132 |
      133 | {{/if}} 134 |
    • 135 | {{/params}} 136 |
    137 |
    138 | {{/if}} 139 | 140 | {{#return}} 141 |
    142 |

    Returns:

    143 | 144 |
    145 | {{#if description}} 146 | {{#if type}} 147 | {{#crossLink type}}{{/crossLink}}: 148 | {{/if}} 149 | {{{description}}} 150 | {{else}} 151 | {{#if type}} 152 | {{#crossLink type}}{{/crossLink}}: 153 | {{/if}} 154 | {{/if}} 155 |
    156 |
    157 | {{/return}} 158 | 159 | {{#example}} 160 |
    161 |

    Example:

    162 | 163 |
    164 | {{{.}}} 165 |
    166 |
    167 | {{/example}} 168 |
    169 | -------------------------------------------------------------------------------- /api/assets/vendor/prettify/CHANGES.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Change Log 5 | 6 | 7 | README 8 | 9 |

    Known Issues

    10 |
      11 |
    • Perl formatting is really crappy. Partly because the author is lazy and 12 | partly because Perl is 13 | hard to parse. 14 |
    • On some browsers, <code> elements with newlines in the text 15 | which use CSS to specify white-space:pre will have the newlines 16 | improperly stripped if the element is not attached to the document at the time 17 | the stripping is done. Also, on IE 6, all newlines will be stripped from 18 | <code> elements because of the way IE6 produces 19 | innerHTML. Workaround: use <pre> for code with 20 | newlines. 21 |
    22 | 23 |

    Change Log

    24 |

    29 March 2007

    25 |
      26 |
    • Added tests for PHP support 27 | to address 28 | issue 3. 30 |
    • Fixed 31 | bug: prettyPrintOne was not halting. This was not 33 | reachable through the normal entry point. 34 |
    • Fixed 35 | bug: recursing into a script block or PHP tag that was not properly 37 | closed would not silently drop the content. 38 | (test) 39 |
    • Fixed 40 | bug: was eating tabs 42 | (test) 43 |
    • Fixed entity handling so that the caveat 44 |
      45 |

      Caveats: please properly escape less-thans. x&lt;y 46 | instead of x<y, and use " instead of 47 | &quot; for string delimiters.

      48 |
      49 | is no longer applicable. 50 |
    • Added noisefree's C# 51 | patch 53 |
    • Added a distribution that has comments and 54 | whitespace removed to reduce download size from 45.5kB to 12.8kB. 55 |
    56 |

    4 Jul 2008

    57 |
      58 |
    • Added language specific formatters that are triggered by the presence 59 | of a lang-<language-file-extension>
    • 60 |
    • Fixed bug: python handling of '''string''' 61 |
    • Fixed bug: / in regex [charsets] should not end regex 62 |
    63 |

    5 Jul 2008

    64 |
      65 |
    • Defined language extensions for Lisp and Lua 66 |
    67 |

    14 Jul 2008

    68 |
      69 |
    • Language handlers for F#, OCAML, SQL 70 |
    • Support for nocode spans to allow embedding of line 71 | numbers and code annotations which should not be styled or otherwise 72 | affect the tokenization of prettified code. 73 | See the issue 22 74 | testcase. 75 |
    76 |

    6 Jan 2009

    77 |
      78 |
    • Language handlers for Visual Basic, Haskell, CSS, and WikiText
    • 79 |
    • Added .mxml extension to the markup style handler for 80 | Flex MXML files. See 81 | issue 37. 84 |
    • Added .m extension to the C style handler so that Objective 85 | C source files properly highlight. See 86 | issue 58. 89 |
    • Changed HTML lexer to use the same embedded source mechanism as the 90 | wiki language handler, and changed to use the registered 91 | CSS handler for STYLE element content. 92 |
    93 |

    21 May 2009

    94 |
      95 |
    • Rewrote to improve performance on large files. 96 | See benchmarks.
    • 97 |
    • Fixed bugs with highlighting of Haskell line comments, Lisp 98 | number literals, Lua strings, C preprocessor directives, 99 | newlines in Wiki code on Windows, and newlines in IE6.
    • 100 |
    101 |

    14 August 2009

    102 |
      103 |
    • Fixed prettifying of <code> blocks with embedded newlines. 104 |
    105 |

    3 October 2009

    106 |
      107 |
    • Fixed prettifying of XML/HTML tags that contain uppercase letters. 108 |
    109 |

    19 July 2010

    110 |
      111 |
    • Added support for line numbers. Bug 112 | 22
    • 114 |
    • Added YAML support. Bug 115 | 123
    • 117 |
    • Added VHDL support courtesy Le Poussin.
    • 118 |
    • IE performance improvements. Bug 119 | 102 courtesy jacobly.
    • 121 |
    • A variety of markup formatting fixes courtesy smain and thezbyg.
    • 122 |
    • Fixed copy and paste in IE[678]. 123 |
    • Changed output to use &#160; instead of 124 | &nbsp; so that the output works when embedded in XML. 125 | Bug 126 | 108.
    • 128 |
    129 | 130 | 131 | -------------------------------------------------------------------------------- /themes/default/assets/vendor/prettify/CHANGES.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Change Log 5 | 6 | 7 | README 8 | 9 |

    Known Issues

    10 |
      11 |
    • Perl formatting is really crappy. Partly because the author is lazy and 12 | partly because Perl is 13 | hard to parse. 14 |
    • On some browsers, <code> elements with newlines in the text 15 | which use CSS to specify white-space:pre will have the newlines 16 | improperly stripped if the element is not attached to the document at the time 17 | the stripping is done. Also, on IE 6, all newlines will be stripped from 18 | <code> elements because of the way IE6 produces 19 | innerHTML. Workaround: use <pre> for code with 20 | newlines. 21 |
    22 | 23 |

    Change Log

    24 |

    29 March 2007

    25 |
      26 |
    • Added tests for PHP support 27 | to address 28 | issue 3. 30 |
    • Fixed 31 | bug: prettyPrintOne was not halting. This was not 33 | reachable through the normal entry point. 34 |
    • Fixed 35 | bug: recursing into a script block or PHP tag that was not properly 37 | closed would not silently drop the content. 38 | (test) 39 |
    • Fixed 40 | bug: was eating tabs 42 | (test) 43 |
    • Fixed entity handling so that the caveat 44 |
      45 |

      Caveats: please properly escape less-thans. x&lt;y 46 | instead of x<y, and use " instead of 47 | &quot; for string delimiters.

      48 |
      49 | is no longer applicable. 50 |
    • Added noisefree's C# 51 | patch 53 |
    • Added a distribution that has comments and 54 | whitespace removed to reduce download size from 45.5kB to 12.8kB. 55 |
    56 |

    4 Jul 2008

    57 |
      58 |
    • Added language specific formatters that are triggered by the presence 59 | of a lang-<language-file-extension>
    • 60 |
    • Fixed bug: python handling of '''string''' 61 |
    • Fixed bug: / in regex [charsets] should not end regex 62 |
    63 |

    5 Jul 2008

    64 |
      65 |
    • Defined language extensions for Lisp and Lua 66 |
    67 |

    14 Jul 2008

    68 |
      69 |
    • Language handlers for F#, OCAML, SQL 70 |
    • Support for nocode spans to allow embedding of line 71 | numbers and code annotations which should not be styled or otherwise 72 | affect the tokenization of prettified code. 73 | See the issue 22 74 | testcase. 75 |
    76 |

    6 Jan 2009

    77 |
      78 |
    • Language handlers for Visual Basic, Haskell, CSS, and WikiText
    • 79 |
    • Added .mxml extension to the markup style handler for 80 | Flex MXML files. See 81 | issue 37. 84 |
    • Added .m extension to the C style handler so that Objective 85 | C source files properly highlight. See 86 | issue 58. 89 |
    • Changed HTML lexer to use the same embedded source mechanism as the 90 | wiki language handler, and changed to use the registered 91 | CSS handler for STYLE element content. 92 |
    93 |

    21 May 2009

    94 |
      95 |
    • Rewrote to improve performance on large files. 96 | See benchmarks.
    • 97 |
    • Fixed bugs with highlighting of Haskell line comments, Lisp 98 | number literals, Lua strings, C preprocessor directives, 99 | newlines in Wiki code on Windows, and newlines in IE6.
    • 100 |
    101 |

    14 August 2009

    102 |
      103 |
    • Fixed prettifying of <code> blocks with embedded newlines. 104 |
    105 |

    3 October 2009

    106 |
      107 |
    • Fixed prettifying of XML/HTML tags that contain uppercase letters. 108 |
    109 |

    19 July 2010

    110 |
      111 |
    • Added support for line numbers. Bug 112 | 22
    • 114 |
    • Added YAML support. Bug 115 | 123
    • 117 |
    • Added VHDL support courtesy Le Poussin.
    • 118 |
    • IE performance improvements. Bug 119 | 102 courtesy jacobly.
    • 121 |
    • A variety of markup formatting fixes courtesy smain and thezbyg.
    • 122 |
    • Fixed copy and paste in IE[678]. 123 |
    • Changed output to use &#160; instead of 124 | &nbsp; so that the output works when embedded in XML. 125 | Bug 126 | 108.
    • 128 |
    129 | 130 | 131 | -------------------------------------------------------------------------------- /themes/simple/assets/vendor/prettify/CHANGES.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Change Log 5 | 6 | 7 | README 8 | 9 |

    Known Issues

    10 |
      11 |
    • Perl formatting is really crappy. Partly because the author is lazy and 12 | partly because Perl is 13 | hard to parse. 14 |
    • On some browsers, <code> elements with newlines in the text 15 | which use CSS to specify white-space:pre will have the newlines 16 | improperly stripped if the element is not attached to the document at the time 17 | the stripping is done. Also, on IE 6, all newlines will be stripped from 18 | <code> elements because of the way IE6 produces 19 | innerHTML. Workaround: use <pre> for code with 20 | newlines. 21 |
    22 | 23 |

    Change Log

    24 |

    29 March 2007

    25 |
      26 |
    • Added tests for PHP support 27 | to address 28 | issue 3. 30 |
    • Fixed 31 | bug: prettyPrintOne was not halting. This was not 33 | reachable through the normal entry point. 34 |
    • Fixed 35 | bug: recursing into a script block or PHP tag that was not properly 37 | closed would not silently drop the content. 38 | (test) 39 |
    • Fixed 40 | bug: was eating tabs 42 | (test) 43 |
    • Fixed entity handling so that the caveat 44 |
      45 |

      Caveats: please properly escape less-thans. x&lt;y 46 | instead of x<y, and use " instead of 47 | &quot; for string delimiters.

      48 |
      49 | is no longer applicable. 50 |
    • Added noisefree's C# 51 | patch 53 |
    • Added a distribution that has comments and 54 | whitespace removed to reduce download size from 45.5kB to 12.8kB. 55 |
    56 |

    4 Jul 2008

    57 |
      58 |
    • Added language specific formatters that are triggered by the presence 59 | of a lang-<language-file-extension>
    • 60 |
    • Fixed bug: python handling of '''string''' 61 |
    • Fixed bug: / in regex [charsets] should not end regex 62 |
    63 |

    5 Jul 2008

    64 |
      65 |
    • Defined language extensions for Lisp and Lua 66 |
    67 |

    14 Jul 2008

    68 |
      69 |
    • Language handlers for F#, OCAML, SQL 70 |
    • Support for nocode spans to allow embedding of line 71 | numbers and code annotations which should not be styled or otherwise 72 | affect the tokenization of prettified code. 73 | See the issue 22 74 | testcase. 75 |
    76 |

    6 Jan 2009

    77 |
      78 |
    • Language handlers for Visual Basic, Haskell, CSS, and WikiText
    • 79 |
    • Added .mxml extension to the markup style handler for 80 | Flex MXML files. See 81 | issue 37. 84 |
    • Added .m extension to the C style handler so that Objective 85 | C source files properly highlight. See 86 | issue 58. 89 |
    • Changed HTML lexer to use the same embedded source mechanism as the 90 | wiki language handler, and changed to use the registered 91 | CSS handler for STYLE element content. 92 |
    93 |

    21 May 2009

    94 |
      95 |
    • Rewrote to improve performance on large files. 96 | See benchmarks.
    • 97 |
    • Fixed bugs with highlighting of Haskell line comments, Lisp 98 | number literals, Lua strings, C preprocessor directives, 99 | newlines in Wiki code on Windows, and newlines in IE6.
    • 100 |
    101 |

    14 August 2009

    102 |
      103 |
    • Fixed prettifying of <code> blocks with embedded newlines. 104 |
    105 |

    3 October 2009

    106 |
      107 |
    • Fixed prettifying of XML/HTML tags that contain uppercase letters. 108 |
    109 |

    19 July 2010

    110 |
      111 |
    • Added support for line numbers. Bug 112 | 22
    • 114 |
    • Added YAML support. Bug 115 | 123
    • 117 |
    • Added VHDL support courtesy Le Poussin.
    • 118 |
    • IE performance improvements. Bug 119 | 102 courtesy jacobly.
    • 121 |
    • A variety of markup formatting fixes courtesy smain and thezbyg.
    • 122 |
    • Fixed copy and paste in IE[678]. 123 |
    • Changed output to use &#160; instead of 124 | &nbsp; so that the output works when embedded in XML. 125 | Bug 126 | 108.
    • 128 |
    129 | 130 | 131 | -------------------------------------------------------------------------------- /themes/default/partials/classes.handlebars: -------------------------------------------------------------------------------- 1 |

    {{moduleName}} Class

    2 |
    3 | {{#if uses}} 4 |
    5 | Uses 6 |
      7 | {{#uses}} 8 |
    • {{.}}
    • 9 | {{/uses}} 10 |
    11 |
    12 | {{/if}} 13 | {{#if extension_for.length}} 14 |
    15 | Extension For 16 |
      17 | {{#extension_for}} 18 |
    • {{.}}
    • 19 | {{/extension_for}} 20 |
    21 |
    22 | {{/if}} 23 | 24 | {{#if extends}} 25 |
    26 | Extends {{#crossLink extends}}{{/crossLink}} 27 |
    28 | {{/if}} 29 | 30 | {{#if foundAt}} 31 |
    32 | Defined in: `{{file}}:{{line}}` 33 |
    34 | {{/if}} 35 | 36 | {{#if since}} 37 |

    Available since {{since}}

    38 | {{/if}} 39 |
    40 | 41 | {{#if deprecated}} 42 |
    43 |

    44 | {{#if deprecationMessage}} 45 | Deprecated: {{deprecationMessage}} 46 | {{else}} 47 | This class is deprecated. 48 | {{/if}} 49 |

    50 |
    51 | {{/if}} 52 | 53 |
    54 | {{{classDescription}}} 55 |
    56 | 57 | {{#is_constructor}} 58 |
    59 |

    Constructor

    60 | {{>method}} 61 |
    62 | {{/is_constructor}} 63 | 64 |
    65 |
      66 |
    • Index
    • 67 | 68 | {{#if methods}} 69 |
    • Methods
    • 70 | {{/if}} 71 | {{#if properties}} 72 |
    • Properties
    • 73 | {{/if}} 74 | {{#if attrs}} 75 |
    • Attributes
    • 76 | {{/if}} 77 | {{#if events}} 78 |
    • Events
    • 79 | {{/if}} 80 |
    81 | 82 |
    83 |
    84 |

    Item Index

    85 | 86 | {{#if methods}} 87 |
    88 |

    Methods

    89 | 90 |
      91 | {{#methods}} 92 |
    • 93 | {{name}} 94 | 95 | {{#if static}} 96 | static 97 | {{/if}} 98 |
    • 99 | {{/methods}} 100 |
    101 |
    102 | {{/if}} 103 | 104 | {{#if properties}} 105 |
    106 |

    Properties

    107 | 108 |
      109 | {{#properties}} 110 |
    • 111 | {{name}} 112 | 113 | {{#if static}} 114 | static 115 | {{/if}} 116 |
    • 117 | {{/properties}} 118 |
    119 |
    120 | {{/if}} 121 | 122 | {{#if attrs}} 123 |
    124 |

    Attributes

    125 | 126 |
      127 | {{#attrs}} 128 |
    • 129 | {{name}} 130 |
    • 131 | {{/attrs}} 132 |
    133 |
    134 | {{/if}} 135 | 136 | {{#if events}} 137 |
    138 |

    Events

    139 | 140 |
      141 | {{#events}} 142 |
    • 143 | {{name}} 144 | 145 | {{#if static}} 146 | static 147 | {{/if}} 148 |
    • 149 | {{/events}} 150 |
    151 |
    152 | {{/if}} 153 |
    154 | 155 | {{#if methods}} 156 |
    157 |

    Methods

    158 | 159 | {{#methods}} 160 | {{>method}} 161 | {{/methods}} 162 |
    163 | {{/if}} 164 | 165 | {{#if properties}} 166 |
    167 |

    Properties

    168 | 169 | {{#properties}} 170 | {{>props}} 171 | {{/properties}} 172 |
    173 | {{/if}} 174 | 175 | {{#if attrs}} 176 |
    177 |

    Attributes

    178 | 179 | {{#attrs}} 180 | {{>attrs}} 181 | {{/attrs}} 182 |
    183 | {{/if}} 184 | 185 | {{#if events}} 186 |
    187 |

    Events

    188 | 189 | {{#events}} 190 | {{>events}} 191 | {{/events}} 192 |
    193 | {{/if}} 194 |
    195 |
    196 | -------------------------------------------------------------------------------- /themes/default/assets/js/api-list.js: -------------------------------------------------------------------------------- 1 | YUI.add('api-list', function (Y) { 2 | 3 | var Lang = Y.Lang, 4 | YArray = Y.Array, 5 | 6 | APIList = Y.namespace('APIList'), 7 | 8 | classesNode = Y.one('#api-classes'), 9 | inputNode = Y.one('#api-filter'), 10 | modulesNode = Y.one('#api-modules'), 11 | tabviewNode = Y.one('#api-tabview'), 12 | 13 | tabs = APIList.tabs = {}, 14 | 15 | filter = APIList.filter = new Y.APIFilter({ 16 | inputNode : inputNode, 17 | maxResults: 1000, 18 | 19 | on: { 20 | results: onFilterResults 21 | } 22 | }), 23 | 24 | search = APIList.search = new Y.APISearch({ 25 | inputNode : inputNode, 26 | maxResults: 100, 27 | 28 | on: { 29 | clear : onSearchClear, 30 | results: onSearchResults 31 | } 32 | }), 33 | 34 | tabview = APIList.tabview = new Y.TabView({ 35 | srcNode : tabviewNode, 36 | panelNode: '#api-tabview-panel', 37 | render : true, 38 | 39 | on: { 40 | selectionChange: onTabSelectionChange 41 | } 42 | }), 43 | 44 | focusManager = APIList.focusManager = tabviewNode.plug(Y.Plugin.NodeFocusManager, { 45 | circular : true, 46 | descendants: '#api-filter, .yui3-tab-panel-selected .api-list-item a, .yui3-tab-panel-selected .result a', 47 | keys : {next: 'down:40', previous: 'down:38'} 48 | }).focusManager, 49 | 50 | LIST_ITEM_TEMPLATE = 51 | '
  • ' + 52 | '{displayName}' + 53 | '
  • '; 54 | 55 | // -- Init --------------------------------------------------------------------- 56 | 57 | // Duckpunch FocusManager's key event handling to prevent it from handling key 58 | // events when a modifier is pressed. 59 | Y.before(function (e, activeDescendant) { 60 | if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) { 61 | return new Y.Do.Prevent(); 62 | } 63 | }, focusManager, '_focusPrevious', focusManager); 64 | 65 | Y.before(function (e, activeDescendant) { 66 | if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) { 67 | return new Y.Do.Prevent(); 68 | } 69 | }, focusManager, '_focusNext', focusManager); 70 | 71 | // Create a mapping of tabs in the tabview so we can refer to them easily later. 72 | tabview.each(function (tab, index) { 73 | var name = tab.get('label').toLowerCase(); 74 | 75 | tabs[name] = { 76 | index: index, 77 | name : name, 78 | tab : tab 79 | }; 80 | }); 81 | 82 | // Switch tabs on Ctrl/Cmd-Left/Right arrows. 83 | tabviewNode.on('key', onTabSwitchKey, 'down:37,39'); 84 | 85 | // Focus the filter input when the `/` key is pressed. 86 | Y.one(Y.config.doc).on('key', onSearchKey, 'down:83'); 87 | 88 | // Keep the Focus Manager up to date. 89 | inputNode.on('focus', function () { 90 | focusManager.set('activeDescendant', inputNode); 91 | }); 92 | 93 | // -- Private Functions -------------------------------------------------------- 94 | function getFilterResultNode() { 95 | return filter.get('queryType') === 'classes' ? classesNode : modulesNode; 96 | } 97 | 98 | // -- Event Handlers ----------------------------------------------------------- 99 | function onFilterResults(e) { 100 | var frag = Y.one(Y.config.doc.createDocumentFragment()), 101 | resultNode = getFilterResultNode(), 102 | typePlural = filter.get('queryType'), 103 | typeSingular = typePlural === 'classes' ? 'class' : 'module'; 104 | 105 | if (e.results.length) { 106 | YArray.each(e.results, function (result) { 107 | frag.append(Lang.sub(LIST_ITEM_TEMPLATE, { 108 | rootPath : APIList.rootPath, 109 | displayName : result.highlighted, 110 | name : result.text, 111 | typePlural : typePlural, 112 | typeSingular: typeSingular 113 | })); 114 | }); 115 | } else { 116 | frag.append( 117 | '
  • ' + 118 | 'No ' + typePlural + ' found.' + 119 | '
  • ' 120 | ); 121 | } 122 | 123 | resultNode.empty(true); 124 | resultNode.append(frag); 125 | 126 | focusManager.refresh(); 127 | } 128 | 129 | function onSearchClear(e) { 130 | 131 | focusManager.refresh(); 132 | } 133 | 134 | function onSearchKey(e) { 135 | var target = e.target; 136 | 137 | if (target.test('input,select,textarea') 138 | || target.get('isContentEditable')) { 139 | return; 140 | } 141 | 142 | e.preventDefault(); 143 | 144 | inputNode.focus(); 145 | focusManager.refresh(); 146 | } 147 | 148 | function onSearchResults(e) { 149 | var frag = Y.one(Y.config.doc.createDocumentFragment()); 150 | 151 | if (e.results.length) { 152 | YArray.each(e.results, function (result) { 153 | frag.append(result.display); 154 | }); 155 | } else { 156 | frag.append( 157 | '
  • ' + 158 | 'No results found. Maybe you\'ll have better luck with a ' + 159 | 'different query?' + 160 | '
  • ' 161 | ); 162 | } 163 | 164 | 165 | focusManager.refresh(); 166 | } 167 | 168 | function onTabSelectionChange(e) { 169 | var tab = e.newVal, 170 | name = tab.get('label').toLowerCase(); 171 | 172 | tabs.selected = { 173 | index: tab.get('index'), 174 | name : name, 175 | tab : tab 176 | }; 177 | 178 | switch (name) { 179 | case 'classes': // fallthru 180 | case 'modules': 181 | filter.setAttrs({ 182 | minQueryLength: 0, 183 | queryType : name 184 | }); 185 | 186 | search.set('minQueryLength', -1); 187 | 188 | // Only send a request if this isn't the initially-selected tab. 189 | if (e.prevVal) { 190 | filter.sendRequest(filter.get('value')); 191 | } 192 | break; 193 | 194 | case 'everything': 195 | filter.set('minQueryLength', -1); 196 | search.set('minQueryLength', 1); 197 | 198 | if (search.get('value')) { 199 | search.sendRequest(search.get('value')); 200 | } else { 201 | inputNode.focus(); 202 | } 203 | break; 204 | 205 | default: 206 | // WTF? We shouldn't be here! 207 | filter.set('minQueryLength', -1); 208 | search.set('minQueryLength', -1); 209 | } 210 | 211 | if (focusManager) { 212 | setTimeout(function () { 213 | focusManager.refresh(); 214 | }, 1); 215 | } 216 | } 217 | 218 | function onTabSwitchKey(e) { 219 | var currentTabIndex = tabs.selected.index; 220 | 221 | if (!(e.ctrlKey || e.metaKey)) { 222 | return; 223 | } 224 | 225 | e.preventDefault(); 226 | 227 | switch (e.keyCode) { 228 | case 37: // left arrow 229 | if (currentTabIndex > 0) { 230 | tabview.selectChild(currentTabIndex - 1); 231 | inputNode.focus(); 232 | } 233 | break; 234 | 235 | case 39: // right arrow 236 | if (currentTabIndex < (Y.Object.size(tabs) - 2)) { 237 | tabview.selectChild(currentTabIndex + 1); 238 | inputNode.focus(); 239 | } 240 | break; 241 | } 242 | } 243 | 244 | }, '3.4.0', {requires: [ 245 | 'api-filter', 'api-search', 'event-key', 'node-focusmanager', 'tabview' 246 | ]}); 247 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [yui-customevents]: http://yuilibrary.com/yui/docs/event-custom/ 2 | [yui-element]: http://developer.yahoo.com/yui/element/ 3 | 4 | # YUIDoc Doc parser 5 | 6 | Updated yuidoc parser, written in js -- *early work in progress* 7 | 8 | ## Usage 9 | 10 | Clone this repo, then: 11 | 12 | cd yuidocjs 13 | npm -g install . 14 | 15 | yuidoc /path/to/yui3/src/ 16 | yuidoc /path/to/yui2/src/ 17 | yuidoc ./test/ 18 | 19 | This will produce a data structure in `out/data.json` by default. 20 | 21 | ## Code implementation 22 | 23 | To log during a build: 24 | `Y.log("message", "console[method]", "module")` 25 | 26 | ## Command Line flags 27 | Usage: yuidoc 28 | 29 | Common Options: 30 | -c, --config, --configfile A JSON config file to provide configuration data. 31 | You can also create a yuidoc.json file and place it 32 | anywhere under your source tree and YUI Doc will find it 33 | and use it. 34 | -e, --extension The list of file extensions to parse 35 | for api documentation. (defaults to .js) 36 | -x, --exclude Directorys to exclude from parsing 37 | (defaults to '.DS_Store,.svn,CVS,.git,build_rollup_tmp,build_tmp') 38 | -v, --version Show the current YUIDoc version 39 | --project-version Set the doc version for the template 40 | -N, --no-color Turn off terminal colors (for automation) 41 | -n, --norecurse Do not recurse directories (default is to recurse) 42 | -S, --selleck Look for Selleck component data and attach to API meta data 43 | -V, --view Dump the Handlebars.js view data instead of writing template files 44 | -p, --parse-only Only parse the API docs and create the JSON data, do not render templates 45 | -o, --out Path to put the generated files (defaults to ./out) 46 | -t, --themedir Path to a custom theme directory containing Handlebars templates 47 | -h, --help Show this help 48 | -T, --theme Choose one of the built in themes (default is default) 49 | Supply a list of paths (shell globbing is handy here) 50 | 51 | ## Commenting Markup Guide 52 | YUIDoc original Python build - http://developer.yahoo.com/yui/yuidoc/ 53 | (republished here for convenience, if that's ok) 54 | 55 | ### Primary tags - Each comment block must have one (and only one) of the following tags 56 | - **module**: There must be one module per source tree. By convention, put your module declaration at the top of the file that contains the main class for your module. 57 | - **class**: The string identifying the functional class on its parent object; for example, the class for YAHOO.util.Event would be Event (and its @namespace would be "YAHOO.util"). 58 | - **method**: The name of a method on the current class. 59 | - **event**: In YUI, events are [Custom Events][yui-customevents] fired off programmatically at interesting moments in a component's execution. The event tag is similar to method, but there is no return tag and its params are arguments passed to the event listener. 60 | - **property**: The name of a property on the current class. 61 | 62 | ### Secondary tags - After choosing one of the four primary tags, you can further document a module, class, method, event or property with one or more of the following secondary tags. 63 | - **submodule**: YUI Doc supports the notion that a module is a submodule of a parent module. For example, in YUI 3.x anim-scroll is a submodule of anim. A submodule encompasses a subset of the parent module's functionality. To use submodule designation, provide the parent module's name as the module property and the submodule's name in the submodule property. 64 | - **namespace**: While it is optional to provide a namespace, it is recommended. This lets you describe your class just with the name: For example, YAHOO.util.Event has a namespace of YAHOO.util and a class of Event. 65 | - **extends**: Sets up an inheritance relationship between the current class and a parent class; API docs will show and link to items inherited from the parent class. 66 | - **config**: A config is a managed configuration attribute. In YUI parlance, this is typically an attribute created and managed with the Config class (part of the Container Family). 67 | - **attribute**: An attribute is a managed configuration attribute. In YUI parlance, this is typically an attribute created and managed with AttributeProvider (part of the [YUI Element Utility][[yui-element]]). An attribute is similar to a config, but YUI Doc will autogenerate documentation for the change events associated with the attribute as provided by Element. (Note: Unless you're using YUI and referring to an attribute managed by AttributeProvider, you should avoid using this tag.) 68 | - **constructor**: The presence of this tag (which requires no description) indicates that this class is instantiable. 69 | - **static**: If a class does not have a constructor, then the static tag should be present to signal that it is a static class. 70 | - **final**: For constants and for read-only configs and attributes. 71 | - **param**: Defined as @param {type} name description or @param name {type} description, params can be used with classes, methods and events. Use [name] to indicate the param is optional, name* to indicate it is a place holder for 1..n arguments, and [name*] for 0..n arguments. 72 | - **return**: Defined as @return {type} description. 73 | - **for**: 74 | 75 | Used to define an inner class: 76 | 77 | /** 78 | * An inner class 79 | * @class foo 80 | * @for OuterClass 81 | */ 82 | 83 | After the class is done, you need to inform the parser to start working on the outer class again: 84 | 85 | /** 86 | * Another method for the outer class 87 | * @method bar 88 | * @for OuterClass 89 | */ 90 | 91 | - **type**: For properties, configs and attributes. 92 | - **private**: Privates by default are suppressed from the API docs. All methods and properties are assumed to be public unless marked as private. 93 | - **protected**: Used to designate members that should not be modified by implementers unless they are creating a subclass. 94 | - **requires**: Used to identify dependencies in the module declaration. 95 | - **default**: The default value of a property, config or attribute. 96 | - **uses**: For classes that use YAHOO.lang.augmentProto or YAHOO.lang.augmentObject. Optional method/properties (supplied to augmentProto or augmentObject) are not parsed by YUI Doc. 97 | 98 | Example: 99 | 100 | /** 101 | * My method description. Like other pieces of your comment blocks, 102 | * this can span multiple lines. 103 | * @method methodName 104 | */ 105 | 106 | ## Released under the YUI BSB License 107 | 108 | Copyright 2011 Yahoo! Inc. 109 | All rights reserved. 110 | 111 | Redistribution and use in source and binary forms, with or without 112 | modification, are permitted provided that the following conditions are met: 113 | * Redistributions of source code must retain the above copyright 114 | notice, this list of conditions and the following disclaimer. 115 | * Redistributions in binary form must reproduce the above copyright 116 | notice, this list of conditions and the following disclaimer in the 117 | documentation and/or other materials provided with the distribution. 118 | * Neither the name of the Yahoo! Inc. nor the 119 | names of its contributors may be used to endorse or promote products 120 | derived from this software without specific prior written permission. 121 | 122 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 123 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 124 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 125 | DISCLAIMED. IN NO EVENT SHALL YAHOO! INC. BE LIABLE FOR ANY 126 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 127 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 128 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 129 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 130 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 131 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 132 | -------------------------------------------------------------------------------- /api/assets/vendor/prettify/README.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Javascript code prettifier 7 | 8 | 9 | 10 | 11 | 12 | 16 | 17 | 18 | 19 | Languages : CH 20 |

    Javascript code prettifier

    21 | 22 |

    Setup

    23 |
      24 |
    1. Download a distribution 25 |
    2. Include the script and stylesheets in your document 26 | (you will need to make sure the css and js file are on your server, and 27 | adjust the paths in the script and link tag) 28 |
       29 | <link href="prettify.css" type="text/css" rel="stylesheet" />
       30 | <script type="text/javascript" src="prettify.js"></script>
      31 |
    3. Add onload="prettyPrint()" to your 32 | document's body tag. 33 |
    4. Modify the stylesheet to get the coloring you prefer
    5. 34 |
    35 | 36 |

    Usage

    37 |

    Put code snippets in 38 | <pre class="prettyprint">...</pre> 39 | or <code class="prettyprint">...</code> 40 | and it will automatically be pretty printed. 41 | 42 | 43 | 44 | 47 |
    The original 45 | Prettier 46 |
    class Voila {
     49 | public:
     50 |   // Voila
     51 |   static const string VOILA = "Voila";
     52 | 
     53 |   // will not interfere with embedded tags.
     54 | }
    55 | 56 |
    class Voila {
     57 | public:
     58 |   // Voila
     59 |   static const string VOILA = "Voila";
     60 | 
     61 |   // will not interfere with embedded tags.
     62 | }
    63 |
    64 | 65 |

    FAQ

    66 |

    Which languages does it work for?

    67 |

    The comments in prettify.js are authoritative but the lexer 68 | should work on a number of languages including C and friends, 69 | Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, and Makefiles. 70 | It works passably on Ruby, PHP, VB, and Awk and a decent subset of Perl 71 | and Ruby, but, because of commenting conventions, doesn't work on 72 | Smalltalk, or CAML-like languages.

    73 | 74 |

    LISPy languages are supported via an extension: 75 | lang-lisp.js.

    77 |

    And similarly for 78 | CSS, 80 | Haskell, 82 | Lua, 84 | OCAML, SML, F#, 86 | Visual Basic, 88 | SQL, 90 | Protocol Buffers, and 92 | WikiText.. 94 | 95 |

    If you'd like to add an extension for your favorite language, please 96 | look at src/lang-lisp.js and file an 97 | issue including your language extension, and a testcase.

    99 | 100 |

    How do I specify which language my code is in?

    101 |

    You don't need to specify the language since prettyprint() 102 | will guess. You can specify a language by specifying the language extension 103 | along with the prettyprint class like so:

    104 |
    <pre class="prettyprint lang-html">
    106 |   The lang-* class specifies the language file extensions.
    107 |   File extensions supported by default include
    108 |     "bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html",
    109 |     "java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh",
    110 |     "xhtml", "xml", "xsl".
    111 | </pre>
    112 | 113 |

    It doesn't work on <obfuscated code sample>?

    114 |

    Yes. Prettifying obfuscated code is like putting lipstick on a pig 115 | — i.e. outside the scope of this tool.

    116 | 117 |

    Which browsers does it work with?

    118 |

    It's been tested with IE 6, Firefox 1.5 & 2, and Safari 2.0.4. 119 | Look at the test page to see if it 120 | works in your browser.

    121 | 122 |

    What's changed?

    123 |

    See the change log

    124 | 125 |

    Why doesn't Prettyprinting of strings work on WordPress?

    126 |

    Apparently wordpress does "smart quoting" which changes close quotes. 127 | This causes end quotes to not match up with open quotes. 128 |

    This breaks prettifying as well as copying and pasting of code samples. 129 | See 130 | WordPress's help center for info on how to stop smart quoting of code 132 | snippets.

    133 | 134 |

    How do I put line numbers in my code?

    135 |

    You can use the linenums class to turn on line 136 | numbering. If your code doesn't start at line number 1, you can 137 | add a colon and a line number to the end of that class as in 138 | linenums:52. 139 | 140 |

    For example 141 |

    <pre class="prettyprint linenums:4"
    142 | >// This is line 4.
    143 | foo();
    144 | bar();
    145 | baz();
    146 | boo();
    147 | far();
    148 | faz();
    149 | <pre>
    150 | produces 151 |
    // This is line 4.
    153 | foo();
    154 | bar();
    155 | baz();
    156 | boo();
    157 | far();
    158 | faz();
    159 | 
    160 | 161 |

    How do I prevent a portion of markup from being marked as code?

    162 |

    You can use the nocode class to identify a span of markup 163 | that is not code. 164 |

    <pre class=prettyprint>
    165 | int x = foo();  /* This is a comment  <span class="nocode">This is not code</span>
    166 |   Continuation of comment */
    167 | int y = bar();
    168 | </pre>
    169 | produces 170 |
    171 | int x = foo();  /* This is a comment  This is not code
    172 |   Continuation of comment */
    173 | int y = bar();
    174 | 
    175 | 176 |

    For a more complete example see the issue22 177 | testcase.

    178 | 179 |

    I get an error message "a is not a function" or "opt_whenDone is not a function"

    180 |

    If you are calling prettyPrint via an event handler, wrap it in a function. 181 | Instead of doing 182 |

    183 | addEventListener('load', prettyPrint, false); 185 |
    186 | wrap it in a closure like 187 |
    188 | addEventListener('load', function (event) { prettyPrint() }, false); 190 |
    191 | so that the browser does not pass an event object to prettyPrint which 192 | will confuse it. 193 | 194 |


    195 | 196 | 202 | 203 | 204 | -------------------------------------------------------------------------------- /themes/default/assets/vendor/prettify/README.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Javascript code prettifier 7 | 8 | 9 | 10 | 11 | 12 | 16 | 17 | 18 | 19 | Languages : CH 20 |

    Javascript code prettifier

    21 | 22 |

    Setup

    23 |
      24 |
    1. Download a distribution 25 |
    2. Include the script and stylesheets in your document 26 | (you will need to make sure the css and js file are on your server, and 27 | adjust the paths in the script and link tag) 28 |
       29 | <link href="prettify.css" type="text/css" rel="stylesheet" />
       30 | <script type="text/javascript" src="prettify.js"></script>
      31 |
    3. Add onload="prettyPrint()" to your 32 | document's body tag. 33 |
    4. Modify the stylesheet to get the coloring you prefer
    5. 34 |
    35 | 36 |

    Usage

    37 |

    Put code snippets in 38 | <pre class="prettyprint">...</pre> 39 | or <code class="prettyprint">...</code> 40 | and it will automatically be pretty printed. 41 | 42 | 43 | 44 | 47 |
    The original 45 | Prettier 46 |
    class Voila {
     49 | public:
     50 |   // Voila
     51 |   static const string VOILA = "Voila";
     52 | 
     53 |   // will not interfere with embedded tags.
     54 | }
    55 | 56 |
    class Voila {
     57 | public:
     58 |   // Voila
     59 |   static const string VOILA = "Voila";
     60 | 
     61 |   // will not interfere with embedded tags.
     62 | }
    63 |
    64 | 65 |

    FAQ

    66 |

    Which languages does it work for?

    67 |

    The comments in prettify.js are authoritative but the lexer 68 | should work on a number of languages including C and friends, 69 | Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, and Makefiles. 70 | It works passably on Ruby, PHP, VB, and Awk and a decent subset of Perl 71 | and Ruby, but, because of commenting conventions, doesn't work on 72 | Smalltalk, or CAML-like languages.

    73 | 74 |

    LISPy languages are supported via an extension: 75 | lang-lisp.js.

    77 |

    And similarly for 78 | CSS, 80 | Haskell, 82 | Lua, 84 | OCAML, SML, F#, 86 | Visual Basic, 88 | SQL, 90 | Protocol Buffers, and 92 | WikiText.. 94 | 95 |

    If you'd like to add an extension for your favorite language, please 96 | look at src/lang-lisp.js and file an 97 | issue including your language extension, and a testcase.

    99 | 100 |

    How do I specify which language my code is in?

    101 |

    You don't need to specify the language since prettyprint() 102 | will guess. You can specify a language by specifying the language extension 103 | along with the prettyprint class like so:

    104 |
    <pre class="prettyprint lang-html">
    106 |   The lang-* class specifies the language file extensions.
    107 |   File extensions supported by default include
    108 |     "bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html",
    109 |     "java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh",
    110 |     "xhtml", "xml", "xsl".
    111 | </pre>
    112 | 113 |

    It doesn't work on <obfuscated code sample>?

    114 |

    Yes. Prettifying obfuscated code is like putting lipstick on a pig 115 | — i.e. outside the scope of this tool.

    116 | 117 |

    Which browsers does it work with?

    118 |

    It's been tested with IE 6, Firefox 1.5 & 2, and Safari 2.0.4. 119 | Look at the test page to see if it 120 | works in your browser.

    121 | 122 |

    What's changed?

    123 |

    See the change log

    124 | 125 |

    Why doesn't Prettyprinting of strings work on WordPress?

    126 |

    Apparently wordpress does "smart quoting" which changes close quotes. 127 | This causes end quotes to not match up with open quotes. 128 |

    This breaks prettifying as well as copying and pasting of code samples. 129 | See 130 | WordPress's help center for info on how to stop smart quoting of code 132 | snippets.

    133 | 134 |

    How do I put line numbers in my code?

    135 |

    You can use the linenums class to turn on line 136 | numbering. If your code doesn't start at line number 1, you can 137 | add a colon and a line number to the end of that class as in 138 | linenums:52. 139 | 140 |

    For example 141 |

    <pre class="prettyprint linenums:4"
    142 | >// This is line 4.
    143 | foo();
    144 | bar();
    145 | baz();
    146 | boo();
    147 | far();
    148 | faz();
    149 | <pre>
    150 | produces 151 |
    // This is line 4.
    153 | foo();
    154 | bar();
    155 | baz();
    156 | boo();
    157 | far();
    158 | faz();
    159 | 
    160 | 161 |

    How do I prevent a portion of markup from being marked as code?

    162 |

    You can use the nocode class to identify a span of markup 163 | that is not code. 164 |

    <pre class=prettyprint>
    165 | int x = foo();  /* This is a comment  <span class="nocode">This is not code</span>
    166 |   Continuation of comment */
    167 | int y = bar();
    168 | </pre>
    169 | produces 170 |
    171 | int x = foo();  /* This is a comment  This is not code
    172 |   Continuation of comment */
    173 | int y = bar();
    174 | 
    175 | 176 |

    For a more complete example see the issue22 177 | testcase.

    178 | 179 |

    I get an error message "a is not a function" or "opt_whenDone is not a function"

    180 |

    If you are calling prettyPrint via an event handler, wrap it in a function. 181 | Instead of doing 182 |

    183 | addEventListener('load', prettyPrint, false); 185 |
    186 | wrap it in a closure like 187 |
    188 | addEventListener('load', function (event) { prettyPrint() }, false); 190 |
    191 | so that the browser does not pass an event object to prettyPrint which 192 | will confuse it. 193 | 194 |


    195 | 196 | 202 | 203 | 204 | -------------------------------------------------------------------------------- /themes/simple/assets/vendor/prettify/README.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Javascript code prettifier 7 | 8 | 9 | 10 | 11 | 12 | 16 | 17 | 18 | 19 | Languages : CH 20 |

    Javascript code prettifier

    21 | 22 |

    Setup

    23 |
      24 |
    1. Download a distribution 25 |
    2. Include the script and stylesheets in your document 26 | (you will need to make sure the css and js file are on your server, and 27 | adjust the paths in the script and link tag) 28 |
       29 | <link href="prettify.css" type="text/css" rel="stylesheet" />
       30 | <script type="text/javascript" src="prettify.js"></script>
      31 |
    3. Add onload="prettyPrint()" to your 32 | document's body tag. 33 |
    4. Modify the stylesheet to get the coloring you prefer
    5. 34 |
    35 | 36 |

    Usage

    37 |

    Put code snippets in 38 | <pre class="prettyprint">...</pre> 39 | or <code class="prettyprint">...</code> 40 | and it will automatically be pretty printed. 41 | 42 | 43 | 44 | 47 |
    The original 45 | Prettier 46 |
    class Voila {
     49 | public:
     50 |   // Voila
     51 |   static const string VOILA = "Voila";
     52 | 
     53 |   // will not interfere with embedded tags.
     54 | }
    55 | 56 |
    class Voila {
     57 | public:
     58 |   // Voila
     59 |   static const string VOILA = "Voila";
     60 | 
     61 |   // will not interfere with embedded tags.
     62 | }
    63 |
    64 | 65 |

    FAQ

    66 |

    Which languages does it work for?

    67 |

    The comments in prettify.js are authoritative but the lexer 68 | should work on a number of languages including C and friends, 69 | Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, and Makefiles. 70 | It works passably on Ruby, PHP, VB, and Awk and a decent subset of Perl 71 | and Ruby, but, because of commenting conventions, doesn't work on 72 | Smalltalk, or CAML-like languages.

    73 | 74 |

    LISPy languages are supported via an extension: 75 | lang-lisp.js.

    77 |

    And similarly for 78 | CSS, 80 | Haskell, 82 | Lua, 84 | OCAML, SML, F#, 86 | Visual Basic, 88 | SQL, 90 | Protocol Buffers, and 92 | WikiText.. 94 | 95 |

    If you'd like to add an extension for your favorite language, please 96 | look at src/lang-lisp.js and file an 97 | issue including your language extension, and a testcase.

    99 | 100 |

    How do I specify which language my code is in?

    101 |

    You don't need to specify the language since prettyprint() 102 | will guess. You can specify a language by specifying the language extension 103 | along with the prettyprint class like so:

    104 |
    <pre class="prettyprint lang-html">
    106 |   The lang-* class specifies the language file extensions.
    107 |   File extensions supported by default include
    108 |     "bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html",
    109 |     "java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh",
    110 |     "xhtml", "xml", "xsl".
    111 | </pre>
    112 | 113 |

    It doesn't work on <obfuscated code sample>?

    114 |

    Yes. Prettifying obfuscated code is like putting lipstick on a pig 115 | — i.e. outside the scope of this tool.

    116 | 117 |

    Which browsers does it work with?

    118 |

    It's been tested with IE 6, Firefox 1.5 & 2, and Safari 2.0.4. 119 | Look at the test page to see if it 120 | works in your browser.

    121 | 122 |

    What's changed?

    123 |

    See the change log

    124 | 125 |

    Why doesn't Prettyprinting of strings work on WordPress?

    126 |

    Apparently wordpress does "smart quoting" which changes close quotes. 127 | This causes end quotes to not match up with open quotes. 128 |

    This breaks prettifying as well as copying and pasting of code samples. 129 | See 130 | WordPress's help center for info on how to stop smart quoting of code 132 | snippets.

    133 | 134 |

    How do I put line numbers in my code?

    135 |

    You can use the linenums class to turn on line 136 | numbering. If your code doesn't start at line number 1, you can 137 | add a colon and a line number to the end of that class as in 138 | linenums:52. 139 | 140 |

    For example 141 |

    <pre class="prettyprint linenums:4"
    142 | >// This is line 4.
    143 | foo();
    144 | bar();
    145 | baz();
    146 | boo();
    147 | far();
    148 | faz();
    149 | <pre>
    150 | produces 151 |
    // This is line 4.
    153 | foo();
    154 | bar();
    155 | baz();
    156 | boo();
    157 | far();
    158 | faz();
    159 | 
    160 | 161 |

    How do I prevent a portion of markup from being marked as code?

    162 |

    You can use the nocode class to identify a span of markup 163 | that is not code. 164 |

    <pre class=prettyprint>
    165 | int x = foo();  /* This is a comment  <span class="nocode">This is not code</span>
    166 |   Continuation of comment */
    167 | int y = bar();
    168 | </pre>
    169 | produces 170 |
    171 | int x = foo();  /* This is a comment  This is not code
    172 |   Continuation of comment */
    173 | int y = bar();
    174 | 
    175 | 176 |

    For a more complete example see the issue22 177 | testcase.

    178 | 179 |

    I get an error message "a is not a function" or "opt_whenDone is not a function"

    180 |

    If you are calling prettyPrint via an event handler, wrap it in a function. 181 | Instead of doing 182 |

    183 | addEventListener('load', prettyPrint, false); 185 |
    186 | wrap it in a closure like 187 |
    188 | addEventListener('load', function (event) { prettyPrint() }, false); 190 |
    191 | so that the browser does not pass an event object to prettyPrint which 192 | will confuse it. 193 | 194 |


    195 | 196 | 202 | 203 | 204 | -------------------------------------------------------------------------------- /api/assets/css/main.css: -------------------------------------------------------------------------------- 1 | /* 2 | Font sizes for all selectors other than the body are given in percentages, 3 | with 100% equal to 13px. To calculate a font size percentage, multiply the 4 | desired size in pixels by 7.6923076923. 5 | 6 | Here's a quick lookup table: 7 | 8 | 10px - 76.923% 9 | 11px - 84.615% 10 | 12px - 92.308% 11 | 13px - 100% 12 | 14px - 107.692% 13 | 15px - 115.385% 14 | 16px - 123.077% 15 | 17px - 130.769% 16 | 18px - 138.462% 17 | 19px - 146.154% 18 | 20px - 153.846% 19 | */ 20 | 21 | html { 22 | background: #fff; 23 | color: #333; 24 | overflow-y: scroll; 25 | } 26 | 27 | body { 28 | font: 13px/1.4 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', 'Bitstream Vera Sans', 'Helvetica', 'Arial', sans-serif; 29 | margin: 0; 30 | padding: 0; 31 | } 32 | 33 | /* -- Links ----------------------------------------------------------------- */ 34 | a { 35 | color: #356de4; 36 | text-decoration: none; 37 | } 38 | 39 | a:hover { text-decoration: underline; } 40 | 41 | /* "Jump to Table of Contents" link is shown to assistive tools, but hidden from 42 | sight until it's focused. */ 43 | .jump { 44 | position: absolute; 45 | padding: 3px 6px; 46 | left: -99999px; 47 | top: 0; 48 | } 49 | 50 | .jump:focus { left: 40%; } 51 | 52 | /* -- Paragraphs ------------------------------------------------------------ */ 53 | p { margin: 1.3em 0; } 54 | dd p, td p { margin-bottom: 0; } 55 | dd p:first-child, td p:first-child { margin-top: 0; } 56 | 57 | /* -- Headings -------------------------------------------------------------- */ 58 | h1, h2, h3, h4, h5, h6 { 59 | font-weight: bold; 60 | line-height: 1.1; 61 | margin: 1.5em 0 1em; 62 | } 63 | 64 | h2, h3, h4, h5, h6 { color: #f80; } 65 | 66 | h1 { 67 | font-family: Verdana, 'DejaVu Sans', 'Bitstream Vera Sans', Helvetica, sans-serif; 68 | font-size: 261.538%; /* 34px */ 69 | margin: 25px 0 18px 25px; 70 | -moz-text-shadow: 1px 1px 2px #999; 71 | -webkit-text-shadow: 1px 1px 2px #999; 72 | text-shadow: 1px 1px 2px #999; 73 | } 74 | 75 | h2 { 76 | font-size: 153.846%; 77 | margin-top: 1.2em; 78 | } 79 | 80 | h3 { font-size: 138.462%; } 81 | 82 | h4 { 83 | border-bottom: 1px solid #d9d9d9; 84 | color: #555; 85 | font-size: 115.385%; 86 | font-weight: normal; 87 | text-transform: uppercase; 88 | } 89 | 90 | h5, h6 { font-size: 107.692%; } 91 | 92 | /* -- Code and examples ----------------------------------------------------- */ 93 | code, kbd, pre, samp, .comment { 94 | font-family: Menlo, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Consolas', 'Monaco', fixed; 95 | font-size: 92.308%; 96 | line-height: 1.35; 97 | } 98 | 99 | p code, p kbd, p samp { 100 | background: #f6f6f6; 101 | border: 1px solid #ededed; 102 | padding: 0 3px; 103 | } 104 | 105 | a code, a kbd, a samp, 106 | pre code, pre kbd, pre samp, 107 | table code, table kbd, table samp, 108 | .intro code, .intro kbd, .intro samp, 109 | .toc code, .toc kbd, .toc samp { 110 | background: none; 111 | border: none; 112 | padding: 0; 113 | } 114 | 115 | pre.code, pre.terminal { 116 | overflow-x: auto; 117 | padding: 0.3em 0.6em; 118 | } 119 | 120 | pre.code { 121 | background: #f8f8f8; 122 | border: 1px solid #ececec; 123 | border-left: 5px solid #e2e2e2; 124 | } 125 | 126 | pre.terminal { 127 | background: #F0EFFC; 128 | border: 1px solid #D0CBFB; 129 | border-left: 5px solid #D0CBFB; 130 | } 131 | 132 | /* Don't reduce the font size of // elements inside
    133 |    blocks. */
    134 | pre code, pre kbd, pre samp { font-size: 100%; }
    135 | 
    136 | /* Used to denote text that shouldn't be selectable, such as line numbers or
    137 |    shell prompts. Guess which browser this doesn't work in. */
    138 | .noselect {
    139 |     -moz-user-select: -moz-none;
    140 |     -khtml-user-select: none;
    141 |     -webkit-user-select: none;
    142 |     -o-user-select: none;
    143 |     user-select: none;
    144 | }
    145 | 
    146 | /* -- Tables ---------------------------------------------------------------- */
    147 | caption, th { text-align: left; }
    148 | 
    149 | table {
    150 |     border-collapse: collapse;
    151 |     width: 100%;
    152 | }
    153 | 
    154 | td, th {
    155 |     border: 1px solid #fff;
    156 |     padding: 5px 12px;
    157 |     vertical-align: top;
    158 | }
    159 | 
    160 | td { background: #E5EDF1; }
    161 | td dl { margin: 0; }
    162 | td dl dl { margin: 1em 0; }
    163 | td pre:first-child { margin-top: 0; }
    164 | 
    165 | th {
    166 |     background: #6C8EA1;
    167 |     color: #fff;
    168 |     font-weight: bold;
    169 |     line-height: 1.3;
    170 |     text-transform: uppercase;
    171 |     white-space: nowrap;
    172 | }
    173 | 
    174 | /* -- Lists ----------------------------------------------------------------- */
    175 | .spaced li { margin: 0.8em 0; }
    176 | 
    177 | dd { margin: 0.2em 0 0.7em 1em; }
    178 | dl { margin: 1em 0; }
    179 | dt { font-weight: bold; }
    180 | 
    181 | /* -- Layout and Content ---------------------------------------------------- */
    182 | #doc {
    183 |     margin: auto;
    184 |     width: 1024px;
    185 | }
    186 | 
    187 | #main { width: 754px; }
    188 | #sidebar { width: 270px; }
    189 | 
    190 | .content { padding: 0 20px 0 25px; }
    191 | 
    192 | /* -- Sidebar --------------------------------------------------------------- */
    193 | .sidebox {
    194 |     -moz-border-radius: 4px;
    195 |     -webkit-border-radius: 4px;
    196 |     border-radius: 4px;
    197 |     -moz-box-shadow: 0 0 3px #afafaf;
    198 |     -webkit-box-shadow: 0 0 3px #afafaf;
    199 |     box-shadow: 0 0 3px #afafaf;
    200 |     font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Lucida Sans', 'Helvetica', 'Arial', sans-serif;
    201 |     margin: 0 20px 15px 5px;
    202 |     padding: 2px;
    203 | }
    204 | 
    205 | .sidebox h2 {
    206 |     background: #efefef;
    207 |     -moz-border-radius: 4px;
    208 |     -webkit-border-radius: 4px;
    209 |     border-radius: 4px;
    210 |     color: #333;
    211 |     font-size: 107.692%;
    212 |     margin: 0;
    213 |     padding: 2px 6px 3px;
    214 | }
    215 | 
    216 | .sidebox .bd { font-size: 84.615%; }
    217 | .sidebox li { list-style-type: square; }
    218 | 
    219 | .sidebox ol, .sidebox ul {
    220 |     margin-left: 0;
    221 |     padding-left: 24px;
    222 | }
    223 | 
    224 | .sidebox ol ol, .sidebox ol ul,
    225 | .sidebox ul ol, .sidebox ul ul {
    226 |     margin: 0;
    227 |     padding-left: 16px;
    228 | }
    229 | 
    230 | /* -- Table of Contents ----------------------------------------------------- */
    231 | 
    232 | /* The #toc id refers to the single global table of contents, while the .toc
    233 |    class refers to generic TOC lists that could be used throughout the page. */
    234 | 
    235 | .toc code, .toc kbd, .toc samp { font-size: 100%; }
    236 | .toc li { font-weight: bold; }
    237 | .toc li li { font-weight: normal; }
    238 | 
    239 | /* -- Intro and Example Boxes ----------------------------------------------- */
    240 | .intro, .example { margin-bottom: 2em; }
    241 | 
    242 | .example {
    243 |     -moz-border-radius: 4px;
    244 |     -webkit-border-radius: 4px;
    245 |     border-radius: 4px;
    246 |     -moz-box-shadow: 0 0 5px #bfbfbf;
    247 |     -webkit-box-shadow: 0 0 5px #bfbfbf;
    248 |     box-shadow: 0 0 5px #bfbfbf;
    249 |     padding: 1em;
    250 | }
    251 | 
    252 | .intro {
    253 |     background: #E2EEFB;
    254 |     border: 1px solid #BDD6F4;
    255 |     padding: 0em 1em;
    256 | }
    257 | 
    258 | /* -- Other Styles ---------------------------------------------------------- */
    259 | 
    260 | /* These are probably YUI-specific, and should be moved out of Selleck's default
    261 |    theme. */
    262 | 
    263 | .button {
    264 |     border: 1px solid #dadada;
    265 |     -moz-border-radius: 3px;
    266 |     -webkit-border-radius: 3px;
    267 |     border-radius: 3px;
    268 |     color: #444;
    269 |     display: inline-block;
    270 |     font-family: Helvetica, Arial, sans-serif;
    271 |     font-size: 92.308%;
    272 |     font-weight: bold;
    273 |     padding: 4px 13px 3px;
    274 |     -moz-text-shadow: 1px 1px 0 #fff;
    275 |     -webkit-text-shadow: 1px 1px 0 #fff;
    276 |     text-shadow: 1px 1px 0 #fff;
    277 |     white-space: nowrap;
    278 | 
    279 |     background: #EFEFEF; /* old browsers */
    280 |     background: -moz-linear-gradient(top, #f5f5f5 0%, #efefef 50%, #e5e5e5 51%, #dfdfdf 100%); /* firefox */
    281 |     background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f5f5f5), color-stop(50%,#efefef), color-stop(51%,#e5e5e5), color-stop(100%,#dfdfdf)); /* webkit */
    282 |     filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5f5f5', endColorstr='#dfdfdf',GradientType=0 ); /* ie */
    283 | }
    284 | 
    285 | .button:hover {
    286 |     border-color: #466899;
    287 |     color: #fff;
    288 |     text-decoration: none;
    289 |     -moz-text-shadow: 1px 1px 0 #222;
    290 |     -webkit-text-shadow: 1px 1px 0 #222;
    291 |     text-shadow: 1px 1px 0 #222;
    292 | 
    293 |     background: #6396D8; /* old browsers */
    294 |     background: -moz-linear-gradient(top, #6396D8 0%, #5A83BC 50%, #547AB7 51%, #466899 100%); /* firefox */
    295 |     background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6396D8), color-stop(50%,#5A83BC), color-stop(51%,#547AB7), color-stop(100%,#466899)); /* webkit */
    296 |     filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6396D8', endColorstr='#466899',GradientType=0 ); /* ie */
    297 | }
    298 | 
    299 | .newwindow { text-align: center; }
    300 | 
    301 | .header .version em {
    302 |     display: block;
    303 |     text-align: right;
    304 | }
    305 | 
    306 | .yui3-skin-sam #classdocs .yui3-tabview-panel {
    307 |     background-color: transparent;
    308 | }
    309 | 
    310 | .yui3-skin-sam #classdocs .yui3-tabview-panel {
    311 |     border: none;
    312 | }
    313 | 
    314 | a.external {
    315 |     background-image: url(external-small.png);
    316 |     background-repeat: no-repeat;
    317 |     background-position: 0 0;
    318 |     padding-left: 16px;
    319 | }
    320 | 
    321 | #classdocs .item {
    322 |     border-bottom: 1px solid #466899;
    323 |     margin: 1em 0;
    324 |     padding: 1.5em;
    325 | }
    326 | 
    327 | #classdocs .item .params p,
    328 |     #classdocs .item .returns p,{
    329 |     display: inline;
    330 | }
    331 | 
    332 | #classdocs .item em code, #classdocs .item em.comment {
    333 |     color: green;
    334 | }
    335 | 
    336 | #classdocs .item em.comment a {
    337 |     color: green;
    338 |     text-decoration: underline;
    339 | }
    340 | 
    341 | #classdocs .foundat {
    342 |     font-size: 76.923%;
    343 |     font-style: italic;
    344 | }
    345 | 
    346 | .attrs .emits {
    347 |     margin-left: 2em;
    348 |     padding: .5em;
    349 |     border-left: 1px dashed #ccc;
    350 | }
    351 | 
    352 | abbr {
    353 |     border-bottom: 1px dashed #ccc;
    354 |     font-size: 80%;
    355 |     cursor: help;
    356 | }
    357 | 
    358 | .prettyprint li.L0, 
    359 | .prettyprint li.L1, 
    360 | .prettyprint li.L2, 
    361 | .prettyprint li.L3, 
    362 | .prettyprint li.L5, 
    363 | .prettyprint li.L6, 
    364 | .prettyprint li.L7, 
    365 | .prettyprint li.L8 {
    366 |     list-style: decimal;
    367 | }
    368 | 
    
    
    --------------------------------------------------------------------------------
    /lib/utils.js:
    --------------------------------------------------------------------------------
      1 | /*
      2 | Copyright (c) 2011, Yahoo! Inc. All rights reserved.
      3 | Code licensed under the BSD License:
      4 | http://yuilibrary.com/license/
      5 | */
      6 | var path = require('path'),
      7 |     util = require('util'),
      8 |     minimatch = require('minimatch'),
      9 |     fs = require('fs');
     10 | 
     11 | /**
     12 | * Utilities Class
     13 | * @class utils
     14 | * @module yuidoc
     15 | */
     16 | 
     17 | YUI.add('utils', function(Y) {
     18 |     
     19 | var HTML_CHARS = {
     20 |     '&': '&',
     21 |     '<': '<',
     22 |     '>': '>',
     23 |     '"': '"',
     24 |     "'": ''',
     25 |     '/': '/',
     26 |     '`': '`'
     27 | };
     28 | 
     29 |     /**
     30 |     Escapes HTML characters in _html_.
     31 | 
     32 |     @method escapeHTML
     33 |     @param {String} html String to escape.
     34 |     @return {String} Escaped string.
     35 |     **/
     36 |     Y.escapeHTML = function(html) {
     37 |         return html.replace(/[&<>"'\/`]/g, function (match) {
     38 |             return HTML_CHARS[match];
     39 |         });
     40 |     };
     41 | 
     42 |     /**
     43 |     Normalizes the initial indentation of the given _content_ so that the first line
     44 |     is unindented, and all other lines are unindented to the same degree as the
     45 |     first line. So if the first line has four spaces at the beginning, then all
     46 |     lines will be unindented four spaces.
     47 | 
     48 |     @method unindent
     49 |     @param {String} content Text to unindent.
     50 |     @return {String} Unindented text.
     51 |     @private
     52 |     **/
     53 |     Y.unindent = function(content) {
     54 |         var indent = content.match(/^(\s+)/);
     55 | 
     56 |         if (indent) {
     57 |             content = content.replace(new RegExp('^' + indent[1], 'gm'), '');
     58 |         }
     59 | 
     60 |         return content;
     61 |     };
     62 |     
     63 | /**
     64 | Like `getPages()`, but returns only the files under the `layout/` subdirectory
     65 | of the specified _dir_.
     66 | 
     67 | @method getLayouts
     68 | @param {String} dir Directory path.
     69 | @return {Object} Mapping of layout names to layout content.
     70 | **/
     71 | function getLayouts(dir) {
     72 |     return getPages(path.join(dir, 'layouts'));
     73 | }
     74 | Y.getLayouts = getLayouts;
     75 | 
     76 | /**
     77 | Loads and returns the content of the specified page file.
     78 | 
     79 | @method getPage
     80 | @param {String} pagePath Path to a single `.handlebars` page.
     81 | @return {String|null} Page content, or `null` if not found.
     82 | **/
     83 | function getPage(pagePath) {
     84 |     if (!Y.Files.isFile(pagePath)) { return null; }
     85 |     return fs.readFileSync(pagePath, 'utf8');
     86 | }
     87 | Y.getPage = getPage;
     88 | 
     89 | /**
     90 | Loads pages (files with a `.handlebars` extension) in the specified directory and
     91 | returns an object containing a mapping of page names (the part of the filename)
     92 | preceding the `.handlebars` extension) to page content.
     93 | 
     94 | @method getPages
     95 | @param {String} dir Directory path.
     96 | @return {Object} Mapping of page names to page content.
     97 | **/
     98 | var cache = {};
     99 | function getPages(dir) {
    100 |     if (cache[dir]) {
    101 |         return cache[dir];
    102 |     }
    103 |     var pages = {};
    104 | 
    105 |     if (!Y.Files.isDirectory(dir)) { return pages; }
    106 | 
    107 |     fs.readdirSync(dir).forEach(function (filename) {
    108 |         var filePath = path.join(dir, filename);
    109 | 
    110 |         if (path.extname(filename) === '.handlebars' && Y.Files.isFile(filePath)) {
    111 |             pages[path.basename(filename, '.handlebars')] = fs.readFileSync(filePath, 'utf8');
    112 |         }
    113 |     });
    114 |     cache[dir] = pages;
    115 | 
    116 |     return pages;
    117 | }
    118 | Y.getPages = getPages;
    119 | 
    120 | /**
    121 | Like `getPages()`, but returns only the files under the `partial/` subdirectory
    122 | of the specified _dir_.
    123 | 
    124 | @method getPartials
    125 | @param {String} dir Directory path.
    126 | @return {Object} Mapping of partial names to partial content.
    127 | **/
    128 | function getPartials(dir) {
    129 |     return getPages(path.join(dir, 'partials'));
    130 | }
    131 | Y.getPartials = getPartials;
    132 | 
    133 | 
    134 | /**
    135 | Mix/merge/munge data into the template.
    136 | @method prepare
    137 | @param {String} inDir The starting directory
    138 | @param {Object} options The `options` for the meta data.
    139 | @param {callback}
    140 | @param {Error} callback.err
    141 | @param {Object} callback.options Merged options.
    142 | **/
    143 | function prepare(inDir, options, callback) {
    144 |     var compiled = {},
    145 |         meta     = {},
    146 |         type     = 'project';
    147 | 
    148 |     if (options && options.skipLoad) {
    149 |         // Skip loading layouts, metadata, pages, and partials and assume that
    150 |         // the caller has provided them if they want them.
    151 |         options = Y.merge({
    152 |             layouts  : {},
    153 |             meta     : {},
    154 |             pages    : {},
    155 |             partials : {},
    156 |             viewClass: Y.DocView
    157 |         }, options);
    158 |     } else {
    159 | 
    160 |         // Gather layouts, metadata, pages, and partials from the specified
    161 |         // input directory, then merge them into the provided options (if any).
    162 |         //
    163 |         // Gathered data will override provided data if there are conflicts, in
    164 |         // order to support a use case where global data are provided by the
    165 |         // caller and overridden by more specific component-level data gathered
    166 |         // from the input directory.
    167 |         //
    168 |         // The metadata inheritance chain looks like this:
    169 |         //
    170 |         //   - override metadata specified via CLI (highest precedence)
    171 |         //   - component metadata (if this is a component)
    172 |         //   - project-level component default metadata (if specified and this is a component)
    173 |         //   - theme-level component default metadata (if specified and this is a component)
    174 |         //   - project metadata
    175 |         //   - theme metadata (lowest precedence)
    176 | 
    177 |         try {
    178 |             options = Y.merge(
    179 |                 {viewClass: Y.DocView},
    180 |                 options || {},
    181 |                 {
    182 |                     layouts : getLayouts(inDir),
    183 |                     meta    : options.meta,
    184 |                     partials: getPartials(inDir)
    185 |                 }
    186 |             );
    187 |         } catch (ex) {
    188 |             return callback(ex);
    189 |         }
    190 |     }
    191 | 
    192 |     // Pages are never merged.
    193 |     options.pages = getPages(inDir);
    194 | 
    195 |     // Mix in the override metadata, if any. It takes precedence over everything
    196 |     // else.
    197 |     Y.mix(options.meta, options.overrideMeta);
    198 | 
    199 |     // Set a default asset path if one isn't specified in the metadata.
    200 |     if (!options.meta.projectAssets) {
    201 |         options.meta.projectAssets = options.component ? '../assets' : 'assets';
    202 |     }
    203 | 
    204 |     if (!options.meta.componentAssets && options.component) {
    205 |         options.meta.componentAssets = '../assets/' + options.meta.name;
    206 |     }
    207 | 
    208 |     if (typeof options.meta.layout === 'undefined') {
    209 |         options.meta.layout = options.layouts[type] ? type : 'main';
    210 |     }
    211 |     
    212 |     callback(null, options);
    213 | }
    214 | 
    215 | Y.prepare = prepare;
    216 | 
    217 | 
    218 | var projectData, dirCount = 0;
    219 | /**
    220 | * Walk the directory tree to locate the yuidoc.json file.
    221 | * @method getProjectData
    222 | * @param {Path} [dir=process.cwd()] The directory to start from
    223 | */
    224 | var getProjectData = function(dir) {
    225 |     if (dirCount > 5000) {
    226 |         Y.log('Scanned ' + dirCount + ' directories looking for a yuidoc.json file, something is probably wrong here..', 'error', 'yuidoc');
    227 |         process.exit(1);
    228 |     }
    229 |     if (!dir) {
    230 |         dir = process.cwd();
    231 |     }
    232 |     var dirs = fs.readdirSync(dir);
    233 |     dirs.forEach(function(d) {
    234 |         if (d.indexOf('.') === 0) {
    235 |             return;
    236 |         }
    237 |         var p = path.join(dir, d);
    238 |         if (projectData) {
    239 |             return;
    240 |         }
    241 |         if (Y.Files.isFile(p)) {
    242 |             if (d === 'yuidoc.json') {
    243 |                 Y.log('Loading project data from: ' + p, 'info', 'yuidoc');
    244 |                 projectData = Y.Files.getJSON(p);
    245 |             }
    246 |         }
    247 |         if (!projectData && Y.Files.isDirectory(p)) {
    248 |             dirCount++
    249 |             projectData = getProjectData(p);
    250 |         }
    251 |     });
    252 |     return projectData;
    253 | };
    254 | 
    255 | Y.getProjectData = getProjectData;
    256 | 
    257 | 
    258 | /**
    259 | * Walks the tree from this dir and returns all the subdirs
    260 | * @method getDirs
    261 | * @param {String} dir The dir to begin at
    262 | * @return {Array} The array of directories..
    263 | */
    264 | 
    265 | var getDirs = function(dir) {
    266 |     var dirs = fs.readdirSync(dir),
    267 |         paths = [];
    268 | 
    269 |     dirs.forEach(function(d) {
    270 |         var _dir = path.join(dir, d),
    271 |             stat = fs.statSync(_dir);
    272 | 
    273 |         if (stat.isDirectory()) {
    274 |             if (_dir.indexOf('.') !== 0) {
    275 |                 paths = [].concat(paths, _dir, getDirs(_dir));
    276 |             }
    277 |         }
    278 |     });
    279 | 
    280 |     return paths;
    281 | };
    282 | 
    283 | Y.getDirs = getDirs;
    284 | 
    285 | /**
    286 | * Make sure all the paths passed are directories and that they are not in the ignore list.
    287 | * @method validatePaths
    288 | * @param {Array} paths The array of paths to validate
    289 | * @param {String} [ignore=false] A string to call `.indexOf` on a path to determine if it should be ignored
    290 | */
    291 | 
    292 | var validatePaths = function(paths, ignore) {
    293 |     if (!paths || !paths.forEach) {
    294 |         var glob = paths || '';
    295 |         paths = [];
    296 |         var glob_paths = getDirs('.');
    297 |         glob_paths.forEach(function(dir) {
    298 |             if (minimatch(dir, glob, { period: true })) {
    299 |                 paths.push(dir);
    300 |             }
    301 |         });
    302 |     }
    303 |     if (paths.forEach) {
    304 |         paths.forEach(function(p) {
    305 |             try {
    306 |                 if (!Y.Files.isDirectory(p)) {
    307 |                     throw('Path not a directory: ' + p);
    308 |                 }
    309 |             } catch (e) {}
    310 |         });
    311 |     }
    312 |     if (!paths || !paths.forEach) {
    313 |         throw('Paths should be an array of paths');
    314 |     }
    315 |     if (ignore) {
    316 |         if (!(ignore instanceof Array)) {
    317 |             ignore = [ignore];
    318 |         }
    319 |         var p = [];
    320 |         paths.forEach(function(v) {
    321 |             ignore.forEach(function(i) {
    322 |                 if (v.indexOf(i) === -1) {
    323 |                     p.push(v);
    324 |                 }
    325 |             });
    326 |         });
    327 |         paths = p;
    328 |     }
    329 |     return paths;
    330 | };
    331 | 
    332 | Y.validatePaths = validatePaths;
    333 | 
    334 | });
    335 | 
    
    
    --------------------------------------------------------------------------------
    /lib/yuidoc.js:
    --------------------------------------------------------------------------------
      1 | /*
      2 | Copyright (c) 2011, Yahoo! Inc. All rights reserved.
      3 | Code licensed under the BSD License:
      4 | http://yuilibrary.com/license/
      5 | */
      6 | var fs = require("fs"),
      7 |     sys = require("sys"),
      8 |     path = require("path");
      9 | 
     10 | /**
     11 | This is the **module** description for the `YUIDoc` module.
     12 | 
     13 |     var options = {
     14 |         paths: [ './lib' ],
     15 |         outdir: './out'
     16 |     };
     17 | 
     18 |     var Y = require('yuidoc');
     19 |     var json = (new Y.YUIDoc(options)).run();
     20 | 
     21 | * @main yuidoc
     22 | */
     23 | 
     24 | 
     25 | YUI.add('yuidoc', function(Y) {
     26 | 
     27 | 
     28 |     /**
     29 |      * The default list of configuration options
     30 |      * @property OPTIONS
     31 |      * @type Object
     32 |      * @final
     33 |      * @for YUIDoc
     34 |      */
     35 | 
     36 |     var OPTIONS = {
     37 |         writeJSON: true,
     38 |         outdir: path.join(process.cwd(),  'out'),
     39 |         extension: '.js',
     40 |         exclude: '.DS_Store,.svn,CVS,.git,build_rollup_tmp,build_tmp',
     41 |         norecurse: false,
     42 |         version: '0.1.0',
     43 |         paths: [],
     44 |         themedir: path.join(__dirname,  'themes', 'default')
     45 |     };
     46 | 
     47 |     /**
     48 |      * YUIDoc main class
     49 | 
     50 |     var options = {
     51 |         paths: [ './lib' ],
     52 |         outdir: './out'
     53 |     };
     54 | 
     55 |     var Y = require('yuidoc');
     56 |     var json = (new Y.YUIDoc(options)).run();
     57 |      
     58 |      * @class YUIDoc
     59 |      * @module yuidoc
     60 |      * @constructor
     61 |      * @param config The config object
     62 |      */
     63 |     Y.YUIDoc = function(config) {
     64 |         /**
     65 |          * Holds the number of files that we are processing.
     66 |          * @property filecount
     67 |          * @type Boolean
     68 |          * @private
     69 |          */
     70 |         this.filecount = 0;
     71 |         /**
     72 |          * Hash map of dirnames to selleck config options.
     73 |          * @property selleck
     74 |          * @type Object
     75 |          * @private
     76 |          */
     77 |         this.selleck = {};
     78 |         /**
     79 |          * Holder for the list of files we are processing.
     80 |          * @property filemap
     81 |          * @type Object
     82 |          * @private
     83 |          */
     84 |         this.filemap = {};
     85 |         /**
     86 |          * Holder for the list of directories we are processing.
     87 |          * @property dirmap
     88 |          * @type Object
     89 |          * @private
     90 |          */
     91 |         this.dirmap = {};
     92 | 
     93 |         /**
     94 |          * Internal holder for configuration options.
     95 |          * @property options
     96 |          * @type Object
     97 |          * @private
     98 |          */
     99 |         this.options = Y.merge(OPTIONS, config);
    100 | 
    101 |     };
    102 | 
    103 |     Y.YUIDoc.prototype = {
    104 |         /**
    105 |          * Does post process on self.options.
    106 |          * @method _processConfig
    107 |          * @private
    108 |          */
    109 |         _processConfig: function() {
    110 |             this.options.extensions = Y.Array.hash(this.options.extension.split(','));
    111 |             this.options.excludes = Y.Array.hash(this.options.exclude.split(','));
    112 |             this.options.wildcardExcludes = {};
    113 |             var excludesArray = Y.Object.keys(this.options.excludes);
    114 |             for (var i = 0; i < excludesArray.length; i++) {
    115 |                 var exclude = excludesArray[i];
    116 |                 if (exclude.charAt(exclude.length - 1) === "*") {
    117 |                     this.options.wildcardExcludes[exclude.substring(0, exclude.length - 1)] = true;
    118 |                 }
    119 |             }
    120 |         },
    121 |         /**
    122 |          * Walks the paths and parses the directory contents
    123 |          * @method walk
    124 |          * @private
    125 |          */
    126 |         walk: function() {
    127 |             Y.each(this.options.paths, function(dir) {
    128 |                 this.parsedir(dir);
    129 |             }, this);
    130 |         },
    131 |         /**
    132 |          * Walks the passed directory and grabs all the files recursively.
    133 |          * @method parsedir
    134 |          * @param {String} dir The directory to parse the contents of.
    135 |          * @private
    136 |          */
    137 |         parsedir: function(dir) {
    138 |             if (!Y.Files.isDirectory(dir)) {
    139 |                 throw('Can not find directory: ' + dir);
    140 |             }
    141 |             var allfiles = fs.readdirSync(dir), stats,
    142 |                 files = [], fullpath, excluded, self = this;
    143 |             
    144 |             Y.each(allfiles, function(filename) {
    145 |                 fullpath = path.join(dir, filename);
    146 |                 
    147 |                 // check if file is excluded
    148 |                 excluded = false;
    149 |                 if (filename in self.options.excludes) { 
    150 |                     excluded = true;
    151 |                 } else {
    152 |                   for (var exclude in self.options.wildcardExcludes) {
    153 |                       if (fullpath.indexOf(exclude) === 0) { 
    154 |                           excluded = true;
    155 |                       }
    156 |                   }
    157 |                 }
    158 |                 
    159 |                 if (!excluded) {
    160 |                     stats = fs.statSync(fullpath);
    161 | 
    162 |                     if (stats.isDirectory() && !self.options.norecurse) {
    163 |                         self.parsedir(fullpath);
    164 |                     } else {
    165 |                         files.push(filename);
    166 |                     }
    167 |                 }
    168 |             });
    169 | 
    170 |             this.parsefiles(dir, files);
    171 |         },
    172 |         /**
    173 |          * Gathers all the file data and populates the filemap and dirmap hashes.
    174 |          * @method parsefiles
    175 |          * @param {String} dir The directory to start from.
    176 |          * @param {Array} files List of files to parse.
    177 |          * @private
    178 |          */
    179 |         parsefiles: function(dir, files) {
    180 |             var self = this;
    181 | 
    182 |             Y.each(files, function(filename) {
    183 |                 var ext = path.extname(filename), text, fullpath;
    184 | 
    185 |                 if (ext) {
    186 |                     if (ext in self.options.extensions) {
    187 |                         fullpath = path.join(dir, filename);
    188 | 
    189 |                         if (path.existsSync(fullpath)) {
    190 |                             self.filecount++;
    191 |                             text = fs.readFileSync(fullpath, "utf8");
    192 | 
    193 |                             self.filemap[fullpath] = text;
    194 |                             self.dirmap[fullpath] = dir;
    195 |                             self.getSelleck(fullpath);
    196 | 
    197 |                         } else {
    198 |                             Y.log('File skipped: ' + fullpath, 'warn', 'yuidoc');
    199 |                         }
    200 |                     }
    201 |                 }
    202 |             });
    203 |         },
    204 |         getSelleck: function(fullpath) {
    205 |             var self = this,
    206 |                 base, comp, json;
    207 | 
    208 |             if (self.options.selleck) {
    209 |                 base = path.dirname(fullpath);
    210 |                 comp = path.join(base, '../', 'docs', 'component.json');
    211 |                 if (path.existsSync(comp)) {
    212 |                     try {
    213 |                         var json = JSON.parse(fs.readFileSync(comp, 'utf8'));
    214 |                         delete json.examples; //Remove the selleck example data, we only want the comp info
    215 |                         self.selleck[fullpath] = json;
    216 |                     } catch (e) {
    217 |                         Y.log('JSON parse failed on Selleck component.json file: ' + comp, 'error', 'yuidoc');
    218 |                     }
    219 |                 }
    220 |             }
    221 |         },
    222 |         /**
    223 |          * Writes the parser JSON data to disk.
    224 |          * @method writeJSON
    225 |          * @param {Object} parser The DocParser instance to use
    226 |          * @private
    227 |          * @return {Object} The JSON data returned from the DocParser
    228 |          */
    229 |         writeJSON: function(parser) {
    230 |             var self = this,
    231 |             data;
    232 | 
    233 |             data = parser.data;
    234 | 
    235 |             if (self.selleck && self.options.selleck && data.files && data.modules) {
    236 |                 Object.keys(self.selleck).forEach(function(file) {
    237 |                     Object.keys(data.files).forEach(function(f) {
    238 |                         if (file === f) {
    239 |                             var mods = data.files[f].modules;
    240 |                             if (mods) {
    241 |                                 Object.keys(mods).forEach(function(mod) {
    242 |                                     if (data.modules[mod]) {
    243 |                                         if (!data.modules[mod].extra) {
    244 |                                             data.modules[mod].extra = {};
    245 |                                         }
    246 |                                         data.modules[mod].extra.selleck = self.selleck[file];
    247 |                                     }
    248 |                                 });
    249 |                             }
    250 |                         }
    251 |                     });
    252 |                 });
    253 |             }
    254 | 
    255 |             if (self.options.writeJSON) {
    256 |                 // Y.log(Y.JSON.stringify(parser.data, null, 4));
    257 |                 var file = path.join(self.options.outdir, 'data.json'), out;
    258 |                 if (!path.existsSync(self.options.outdir)) {
    259 |                     Y.log('Making out dir: ' + self.options.outdir, 'warn', 'yuidoc');
    260 |                     fs.mkdirSync(self.options.outdir, 0777);
    261 |                 } else {
    262 |                     Y.log('Using output directory: ' + self.options.outdir, 'info', 'yuidoc');
    263 |                 }
    264 |                 if (self.options.project) {
    265 |                     parser.data.project = self.options.project;
    266 |                 }
    267 |                 
    268 |                 out = fs.createWriteStream(file, {
    269 |                         flags: "w", encoding: "utf8", mode: 0644
    270 |                 });
    271 |                 out.write(JSON.stringify(data, null, 4));
    272 |                 out.end();
    273 |             }
    274 | 
    275 |             return data;
    276 |         },
    277 |         /**
    278 |          * Process the config, walk the file tree and write out the JSON data.
    279 |          * @method run
    280 |          * @retdrn {Object} The JSON data returned from the DocParser
    281 |          */
    282 |         run: function() {
    283 |             /**
    284 |              * Timestamp holder so we know when YUIDoc started the parse process.
    285 |              * @property starttime
    286 |              * @type Timestamp
    287 |              */
    288 |             Y.log('YUIDoc Starting from: ' + this.options.paths.join(','), 'info', 'yuidoc');
    289 |             this.starttime = new Date().getTime();
    290 | 
    291 |             var self = this;
    292 | 
    293 |             this._processConfig();
    294 |             this.walk();
    295 | 
    296 |             var json = this.writeJSON(new Y.DocParser({
    297 |                 filemap: self.filemap,
    298 |                 dirmap: self.dirmap
    299 |             }).parse());
    300 | 
    301 |             /**
    302 |              * Timestamp holder so we know when YUIDoc has finished the parse process.
    303 |              * @property endtime
    304 |              * @type Timestamp
    305 |              */
    306 |             this.endtime = new Date().getTime();
    307 |             Y.log('Parsed ' + this.filecount + ' files in ' + ((this.endtime - this.starttime) / 1000) + ' seconds', 'info', 'yuidoc');
    308 | 
    309 |             return json;
    310 |         }
    311 |     };
    312 | 
    313 | });
    314 | 
    
    
    --------------------------------------------------------------------------------