From bfb1e523d1e30495b3714fb673fb2dbcbea6fc2c Mon Sep 17 00:00:00 2001 From: Caridy Patino Date: Sat, 8 Mar 2014 18:41:25 -0500 Subject: [PATCH] generating docs --- docs/args/partials/help.mustache | 2 +- output/api/assets/js/apidocs.js | 4 +- output/api/classes/CLI.html | 4 +- output/api/classes/DocBuilder.html | 74 +- output/api/classes/DocParser.html | 308 ++++- output/api/classes/DocView.html | 10 +- output/api/classes/Files.html | 30 +- output/api/classes/Help.html | 2 +- output/api/classes/Main.html | 4 +- output/api/classes/Options.html | 2 +- output/api/classes/Server.html | 14 +- output/api/classes/Utils.html | 133 +- output/api/classes/YUIDoc.html | 32 +- output/api/data.json | 282 +++-- output/api/files/lib_builder.js.html | 1164 ++++++++--------- output/api/files/lib_cli.js.html | 24 +- output/api/files/lib_docparser.js.html | 1578 ++++++++++++------------ output/api/files/lib_docview.js.html | 33 +- output/api/files/lib_files.js.html | 781 ++++++------ output/api/files/lib_help.js.html | 46 +- output/api/files/lib_index.js.html | 9 +- output/api/files/lib_options.js.html | 287 ++--- output/api/files/lib_server.js.html | 418 +++---- output/api/files/lib_utils.js.html | 757 ++++++------ output/api/files/lib_yuidoc.js.html | 105 +- output/api/index.html | 2 +- output/api/modules/yuidoc.html | 4 +- output/args/index.html | 2 +- 28 files changed, 3343 insertions(+), 2768 deletions(-) diff --git a/docs/args/partials/help.mustache b/docs/args/partials/help.mustache index db120834..0563c350 100644 --- a/docs/args/partials/help.mustache +++ b/docs/args/partials/help.mustache @@ -1,7 +1,7 @@ YUI Doc generates API documentation from a modified JavaDoc syntax. -Current version (0.3.47) +Current version (0.3.49) Usage: yuidoc diff --git a/output/api/assets/js/apidocs.js b/output/api/assets/js/apidocs.js index c64bb463..e00591c1 100644 --- a/output/api/assets/js/apidocs.js +++ b/output/api/assets/js/apidocs.js @@ -284,7 +284,7 @@ pjax.handleClasses = function (req, res, next) { var status = res.ioResponse.status; // Handles success and local filesystem XHRs. - if (!status || (status >= 200 && status < 300)) { + if (res.ioResponse.readyState === 4 && (!status || (status >= 200 && status < 300))) { pjax.initClassTabView(); } @@ -295,7 +295,7 @@ pjax.handleFiles = function (req, res, next) { var status = res.ioResponse.status; // Handles success and local filesystem XHRs. - if (!status || (status >= 200 && status < 300)) { + if (res.ioResponse.readyState === 4 && (!status || (status >= 200 && status < 300))) { pjax.initLineNumbers(); } diff --git a/output/api/classes/CLI.html b/output/api/classes/CLI.html index d717588b..b5020f14 100644 --- a/output/api/classes/CLI.html +++ b/output/api/classes/CLI.html @@ -19,7 +19,7 @@

- API Docs for: 0.3.47 + API Docs for: 0.3.49
@@ -112,7 +112,7 @@

CLI Class

- Defined in: lib/cli.js:8 + Defined in: lib/cli.js:9
diff --git a/output/api/classes/DocBuilder.html b/output/api/classes/DocBuilder.html index 46597f6d..c0936534 100644 --- a/output/api/classes/DocBuilder.html +++ b/output/api/classes/DocBuilder.html @@ -19,7 +19,7 @@

- API Docs for: 0.3.47 + API Docs for: 0.3.49
@@ -470,7 +470,7 @@

_addHelpers

- lib/builder.js:119 + lib/builder.js:120

@@ -565,7 +565,7 @@

_inlineCode

- lib/builder.js:750 + lib/builder.js:770

@@ -661,7 +661,7 @@

_mixExternal

- lib/builder.js:323 + lib/builder.js:324

@@ -672,7 +672,7 @@

_mixExternal

-

Mixes the various external data soures together into the local data, augmenting +

Mixes the various external data soures together into the local data, augmenting it with flags.

@@ -733,7 +733,7 @@

_parseCode

- lib/builder.js:737 + lib/builder.js:757

@@ -850,7 +850,7 @@

_parseCrossLink

- lib/builder.js:163 + lib/builder.js:164

@@ -977,7 +977,7 @@

addFoundAt

- lib/builder.js:602 + lib/builder.js:622

@@ -1084,7 +1084,7 @@

augmentData

- lib/builder.js:618 + lib/builder.js:638

@@ -1188,7 +1188,7 @@

compile

- lib/builder.js:1551 + lib/builder.js:1605

@@ -1281,7 +1281,7 @@

filterFileName

- lib/builder.js:1538 + lib/builder.js:1592

@@ -1380,7 +1380,7 @@

getProjectMeta

- lib/builder.js:451 + lib/builder.js:452

@@ -1469,7 +1469,7 @@

hasProperty

- lib/builder.js:985 + lib/builder.js:1019

@@ -1586,7 +1586,7 @@

makeDirs

- lib/builder.js:684 + lib/builder.js:704

@@ -1681,7 +1681,7 @@

markdown

- lib/builder.js:136 + lib/builder.js:137

@@ -1796,7 +1796,7 @@

mergeExtends

- lib/builder.js:1009 + lib/builder.js:1043

@@ -1919,7 +1919,7 @@

mixExternal

- lib/builder.js:371 + lib/builder.js:372

@@ -2018,7 +2018,7 @@

nameSort

- lib/builder.js:1380 + lib/builder.js:1422

@@ -2143,7 +2143,7 @@

NATIVES_LINKER

- lib/builder.js:309 + lib/builder.js:310

@@ -2250,7 +2250,7 @@

populateClasses

- lib/builder.js:494 + lib/builder.js:495

@@ -2357,7 +2357,7 @@

populateFiles

- lib/builder.js:553 + lib/builder.js:565

@@ -2464,7 +2464,7 @@

populateModules

- lib/builder.js:516 + lib/builder.js:519

@@ -2591,7 +2591,7 @@

render

- lib/builder.js:769 + lib/builder.js:789

@@ -2779,7 +2779,7 @@

renderAPIMeta

- lib/builder.js:1508 + lib/builder.js:1560

@@ -2874,7 +2874,7 @@

renderClass

- lib/builder.js:1060 + lib/builder.js:1095

@@ -3003,7 +3003,7 @@

renderFile

- lib/builder.js:1441 + lib/builder.js:1493

@@ -3132,7 +3132,7 @@

renderIndex

- lib/builder.js:823 + lib/builder.js:845

@@ -3261,7 +3261,7 @@

renderModule

- lib/builder.js:872 + lib/builder.js:894

@@ -3386,7 +3386,7 @@

writeAPIMeta

- lib/builder.js:1495 + lib/builder.js:1547

@@ -3475,7 +3475,7 @@

writeClasses

- lib/builder.js:1345 + lib/builder.js:1381

@@ -3564,7 +3564,7 @@

writeFiles

- lib/builder.js:1403 + lib/builder.js:1445

@@ -3653,7 +3653,7 @@

writeIndex

- lib/builder.js:848 + lib/builder.js:870

@@ -3742,7 +3742,7 @@

writeModules

- lib/builder.js:950 + lib/builder.js:978

@@ -3822,7 +3822,7 @@

_mergeCounter

- lib/builder.js:1002 + lib/builder.js:1036

@@ -3869,7 +3869,7 @@

_meta

- lib/builder.js:444 + lib/builder.js:445

@@ -3914,7 +3914,7 @@

files

- lib/builder.js:438 + lib/builder.js:439

@@ -3959,7 +3959,7 @@

NATIVES

- lib/builder.js:270 + lib/builder.js:271

diff --git a/output/api/classes/DocParser.html b/output/api/classes/DocParser.html index 8db2dddc..290dcb53 100644 --- a/output/api/classes/DocParser.html +++ b/output/api/classes/DocParser.html @@ -19,7 +19,7 @@

- API Docs for: 0.3.47 + API Docs for: 0.3.49
@@ -116,7 +116,7 @@

DocParser Class

- Defined in: lib/docparser.js:722 + Defined in: lib/docparser.js:727
@@ -183,7 +183,7 @@

DocParser

- lib/docparser.js:722 + lib/docparser.js:727

@@ -686,6 +686,20 @@

Methods

+ + +
  • + implodeString + + + +
  • + +
  • + implodeString + + +
  • @@ -2903,7 +2917,7 @@

    Parameters:

  • attrs - Array | boolean + String[] | Boolean @@ -4906,7 +4920,7 @@

    _resolveFor

    - lib/docparser.js:995 + lib/docparser.js:1011

    @@ -5483,7 +5497,7 @@

    _setAttrVal

    - Booolean + Boolean @@ -5641,7 +5655,7 @@

    Returns:

    - Booolean: + Boolean:

    true if the new attribute value was stored, false if not.

    @@ -7075,7 +7089,7 @@

    extract

    - lib/docparser.js:1161 + lib/docparser.js:1182

    @@ -7476,7 +7490,7 @@

    Parameters:

  • attrs - Array | boolean + String[] | Boolean @@ -7763,7 +7777,7 @@

    handlecomment

    - lib/docparser.js:1090 + lib/docparser.js:1106

    @@ -7774,12 +7788,10 @@

    handlecomment

  • -

    Transforms a JavaDoc style comment block (less the start -and end of it) into a list -of tag/text pairs. The leading space and '*' are removed, -but the remaining whitespace is preserved so that the -output should be friendly for both markdown and html -parsers.

    +

    Transforms a JavaDoc style comment block (less the start and end of it) +into a list of tag/text pairs. The leading space and '*' are removed, +but the remaining whitespace is preserved so that the output should be +friendly for both markdown and html parsers.

    @@ -7844,6 +7856,224 @@

    Parameters:

    + + + +
    +

    implodeString

    + + +
    + (
      + +
    • + + str + +
    • + +
    ) +
    + + + + + String + + + + + + + private + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + lib/docparser.js:38 + +

    + + + + + +
    + +
    +

    Flatten a string, remove all line breaks and replace them with a token

    + +
    + + +
    +

    Parameters:

    + +
      + +
    • + + str + String + + + + +
      +

      The string to operate on

      + +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + String: + +

    The modified string

    + + +
    +
    + + + +
    + + +
    +

    implodeString

    + + +
    + (
      + +
    • + + str + +
    • + +
    ) +
    + + + + + String + + + + + + + private + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + lib/docparser.js:48 + +

    + + + + + +
    + +
    +

    Un-flatten a string, replace tokens injected with implodeString

    + +
    + + +
    +

    Parameters:

    + +
      + +
    • + + str + String + + + + +
      +

      The string to operate on

      + +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + String: + +

    The modified string

    + + +
    +
    + + +
    @@ -8660,7 +8890,7 @@

    parse

    - lib/docparser.js:1402 + lib/docparser.js:1424

    @@ -8753,7 +8983,7 @@

    parseType

  • - [pre=this._yuievt.config.prefix] + [pre]
  • @@ -8832,7 +9062,7 @@

    Parameters:

  • - [pre=this._yuievt.config.prefix] + [pre] String optional @@ -8840,7 +9070,7 @@

    Parameters:

    -

    the prefix

    +

    The prefix. Defaults to this._yuievt.config.prefix

    @@ -8917,7 +9147,7 @@

    processblock

    - lib/docparser.js:1215 + lib/docparser.js:1237

    @@ -9760,7 +9990,7 @@

    stringlog

    - lib/docparser.js:12 + lib/docparser.js:11

    @@ -9771,8 +10001,8 @@

    stringlog

    -

    Parses the JSON data and formats it into a nice log string for filename and line number: - /file/name.js:123

    +

    Parses the JSON data and formats it into a nice log string for +filename and line number: /file/name.js:123

    @@ -9995,7 +10225,7 @@

    transform

    - lib/docparser.js:1289 + lib/docparser.js:1310

    @@ -10106,7 +10336,7 @@

    unindent

    - lib/docparser.js:1068 + lib/docparser.js:1085

    @@ -10401,7 +10631,7 @@

    CORRECTIONS

    - lib/docparser.js:175 + lib/docparser.js:174

    @@ -10448,7 +10678,7 @@

    DIGESTERS

    - lib/docparser.js:198 + lib/docparser.js:197

    @@ -10544,7 +10774,7 @@

    TAGLIST

    - lib/docparser.js:95 + lib/docparser.js:94

    @@ -10606,7 +10836,7 @@

    currentclass

    - lib/docparser.js:959 + lib/docparser.js:971

    @@ -10709,7 +10939,7 @@

    currentfile

    - lib/docparser.js:810 + lib/docparser.js:815

    @@ -10812,7 +11042,7 @@

    currentmodule

    - lib/docparser.js:867 + lib/docparser.js:872

    @@ -10915,7 +11145,7 @@

    currentsubmodule

    - lib/docparser.js:919 + lib/docparser.js:931

    @@ -11123,7 +11353,7 @@

    digesters

    - lib/docparser.js:750 + lib/docparser.js:755

    @@ -11236,7 +11466,7 @@

    dirmap

    - lib/docparser.js:800 + lib/docparser.js:805

    @@ -11341,7 +11571,7 @@

    emitters

    - lib/docparser.js:772 + lib/docparser.js:777

    @@ -11445,7 +11675,7 @@

    filemap

    - lib/docparser.js:792 + lib/docparser.js:797

    @@ -11653,7 +11883,7 @@

    mainmodule

    - lib/docparser.js:831 + lib/docparser.js:836

    @@ -11756,7 +11986,7 @@

    syntaxtype

    - lib/docparser.js:783 + lib/docparser.js:788

    diff --git a/output/api/classes/DocView.html b/output/api/classes/DocView.html index 64fe9f46..a8eee88e 100644 --- a/output/api/classes/DocView.html +++ b/output/api/classes/DocView.html @@ -19,7 +19,7 @@

    - API Docs for: 0.3.47 + API Docs for: 0.3.49
    @@ -112,7 +112,7 @@

    DocView Class

    - Defined in: lib/docview.js:15 + Defined in: lib/docview.js:14
    @@ -183,7 +183,7 @@

    DocView

    - lib/docview.js:15 + lib/docview.js:14

    @@ -331,7 +331,7 @@

    htmlTitle

    - lib/docview.js:29 + lib/docview.js:28

    @@ -386,7 +386,7 @@

    title

    - lib/docview.js:48 + lib/docview.js:47

    diff --git a/output/api/classes/Files.html b/output/api/classes/Files.html index 57e00646..b689060a 100644 --- a/output/api/classes/Files.html +++ b/output/api/classes/Files.html @@ -19,7 +19,7 @@

    - API Docs for: 0.3.47 + API Docs for: 0.3.49
    @@ -316,7 +316,7 @@

    copyAssets

    - lib/files.js:338 + lib/files.js:363

    @@ -471,7 +471,7 @@

    copyDirectory

    - lib/files.js:36 + lib/files.js:32

    @@ -535,7 +535,7 @@

    Parameters:

    Whether or not to overwrite destination files - if they already exist.

    + if they already exist.

    @@ -628,7 +628,7 @@

    copyFile

    - lib/files.js:113 + lib/files.js:122

    @@ -692,7 +692,7 @@

    Parameters:

    Whether or not to overwrite destination files - if they already exist.

    + if they already exist.

    @@ -803,7 +803,7 @@

    copyPath

    - lib/files.js:159 + lib/files.js:175

    @@ -966,7 +966,7 @@

    deletePath

    - lib/files.js:206 + lib/files.js:221

    @@ -1061,7 +1061,7 @@

    getJSON

    - lib/files.js:386 + lib/files.js:411

    @@ -1174,7 +1174,7 @@

    isDirectory

    - lib/files.js:230 + lib/files.js:246

    @@ -1304,7 +1304,7 @@

    isFile

    - lib/files.js:258 + lib/files.js:277

    @@ -1428,7 +1428,7 @@

    isSymbolicLink

    - lib/files.js:284 + lib/files.js:306

    @@ -1535,7 +1535,7 @@

    lstatSync

    - lib/files.js:296 + lib/files.js:320

    @@ -1643,7 +1643,7 @@

    statSync

    - lib/files.js:317 + lib/files.js:342

    @@ -1759,7 +1759,7 @@

    writeFile

    - lib/files.js:400 + lib/files.js:426

    diff --git a/output/api/classes/Help.html b/output/api/classes/Help.html index aac08d44..80cf9dd4 100644 --- a/output/api/classes/Help.html +++ b/output/api/classes/Help.html @@ -19,7 +19,7 @@

    - API Docs for: 0.3.47 + API Docs for: 0.3.49
    diff --git a/output/api/classes/Main.html b/output/api/classes/Main.html index 0f07994b..445ac96b 100644 --- a/output/api/classes/Main.html +++ b/output/api/classes/Main.html @@ -19,7 +19,7 @@

    - API Docs for: 0.3.47 + API Docs for: 0.3.49
    @@ -112,7 +112,7 @@

    Main Class

    - Defined in: lib/index.js:6 + Defined in: lib/index.js:7
    diff --git a/output/api/classes/Options.html b/output/api/classes/Options.html index 37de411c..18f3adee 100644 --- a/output/api/classes/Options.html +++ b/output/api/classes/Options.html @@ -19,7 +19,7 @@

    - API Docs for: 0.3.47 + API Docs for: 0.3.49
    diff --git a/output/api/classes/Server.html b/output/api/classes/Server.html index b301abed..d8425370 100644 --- a/output/api/classes/Server.html +++ b/output/api/classes/Server.html @@ -19,7 +19,7 @@

    - API Docs for: 0.3.47 + API Docs for: 0.3.49
    @@ -293,7 +293,7 @@

    clazz

    - lib/server.js:132 + lib/server.js:131

    @@ -404,7 +404,7 @@

    files

    - lib/server.js:106 + lib/server.js:105

    @@ -515,7 +515,7 @@

    home

    - lib/server.js:164 + lib/server.js:163

    @@ -610,7 +610,7 @@

    init

    - lib/server.js:176 + lib/server.js:175

    @@ -681,7 +681,7 @@

    modules

    - lib/server.js:148 + lib/server.js:147

    @@ -974,7 +974,7 @@

    start

    - lib/server.js:194 + lib/server.js:193

    diff --git a/output/api/classes/Utils.html b/output/api/classes/Utils.html index 1e402011..d489b838 100644 --- a/output/api/classes/Utils.html +++ b/output/api/classes/Utils.html @@ -19,7 +19,7 @@

    - API Docs for: 0.3.47 + API Docs for: 0.3.49
    @@ -231,6 +231,13 @@

    Methods

    +
  • + +
  • + webpath + + +
  • @@ -402,7 +409,7 @@

    fixType

    - lib/utils.js:446 + lib/utils.js:454

    @@ -509,7 +516,7 @@

    getDirs

    - lib/utils.js:336 + lib/utils.js:340

    @@ -831,7 +838,7 @@

    getPages

    - lib/utils.js:91 + lib/utils.js:93

    @@ -940,7 +947,7 @@

    getPartials

    - lib/utils.js:122 + lib/utils.js:126

    @@ -1044,7 +1051,7 @@

    getProjectData

    - lib/utils.js:223 + lib/utils.js:226

    @@ -1146,7 +1153,7 @@

    prepare

    - lib/utils.js:136 + lib/utils.js:140

    @@ -1416,7 +1423,7 @@

    validatePaths

    - lib/utils.js:363 + lib/utils.js:366

    @@ -1477,6 +1484,116 @@

    Parameters:

    + + + +
    +

    webpath

    + + +
    + (
      + +
    • + + url + +
    • + +
    ) +
    + + + + + String + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + lib/utils.js:476 + +

    + + + + + +
    + +
    +

    Produces a normalized web path by joining all the parts and normalizing the +filesystem-like path into web compatible url. +Supports relative and absolute paths. +Courtesy of Mojito's utils

    + +
    + + +
    +

    Parameters:

    + +
      + +
    • + + url + Array | String* + + + + +
      +

      the list of parts to be joined and normalized

      + +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + String: + +

    The joined and normalized url

    + + +
    +
    + + +
    diff --git a/output/api/classes/YUIDoc.html b/output/api/classes/YUIDoc.html index b281f2bd..437b3dbe 100644 --- a/output/api/classes/YUIDoc.html +++ b/output/api/classes/YUIDoc.html @@ -19,7 +19,7 @@

    - API Docs for: 0.3.47 + API Docs for: 0.3.49
    @@ -112,7 +112,7 @@

    YUIDoc Class

    - Defined in: lib/yuidoc.js:50 + Defined in: lib/yuidoc.js:49
    @@ -184,7 +184,7 @@

    YUIDoc

    - lib/yuidoc.js:50 + lib/yuidoc.js:49

    @@ -476,7 +476,7 @@

    _setDefaultExcludes

    - lib/yuidoc.js:113 + lib/yuidoc.js:112

    @@ -543,7 +543,7 @@

    parsedir

    - lib/yuidoc.js:147 + lib/yuidoc.js:149

    @@ -640,7 +640,7 @@

    parsefiles

    - lib/yuidoc.js:182 + lib/yuidoc.js:190

    @@ -739,7 +739,7 @@

    run

    - lib/yuidoc.js:311 + lib/yuidoc.js:334

    @@ -810,7 +810,7 @@

    walk

    - lib/yuidoc.js:137 + lib/yuidoc.js:138

    @@ -881,7 +881,7 @@

    writeJSON

    - lib/yuidoc.js:233 + lib/yuidoc.js:248

    @@ -975,7 +975,7 @@

    dirmap

    - lib/yuidoc.js:88 + lib/yuidoc.js:87

    @@ -1020,7 +1020,7 @@

    endtime

    - lib/yuidoc.js:341 + lib/yuidoc.js:362

    @@ -1067,7 +1067,7 @@

    filecount

    - lib/yuidoc.js:67 + lib/yuidoc.js:66

    @@ -1114,7 +1114,7 @@

    filemap

    - lib/yuidoc.js:81 + lib/yuidoc.js:80

    @@ -1208,7 +1208,7 @@

    options

    - lib/yuidoc.js:96 + lib/yuidoc.js:95

    @@ -1255,7 +1255,7 @@

    selleck

    - lib/yuidoc.js:74 + lib/yuidoc.js:73

    @@ -1300,7 +1300,7 @@

    starttime

    - lib/yuidoc.js:317 + lib/yuidoc.js:340

    diff --git a/output/api/data.json b/output/api/data.json index 9aeede68..d44f2351 100644 --- a/output/api/data.json +++ b/output/api/data.json @@ -3,7 +3,7 @@ "name": "yuidoc-root", "logo": "http://yuilibrary.com/img/yui-logo.png", "description": "YUIDoc, YUI's JavaScript Documentation engine.", - "version": "0.3.47" + "version": "0.3.49" }, "files": { "lib/builder.js": { @@ -136,7 +136,7 @@ "namespaces": {}, "tag": "main", "file": "lib/yuidoc.js", - "line": 50, + "line": 49, "description": "This is the __module__ description for the `YUIDoc` module.\n\n var options = {\n paths: [ './lib' ],\n outdir: './out'\n };\n\n var Y = require('yuidocjs');\n var json = (new Y.YUIDoc(options)).run();", "itemtype": "main" } @@ -166,7 +166,7 @@ "module": "yuidoc", "namespace": "", "file": "lib/cli.js", - "line": 8, + "line": 9, "description": "Parses the arguments, creates the options and passes them to `Y.YUIDoc` and then `Y.DocBuilder`." }, "DocParser": { @@ -180,7 +180,7 @@ "module": "yuidoc", "namespace": "", "file": "lib/docparser.js", - "line": 722, + "line": 727, "description": "The doc parser accepts a **map** of files to file content.\nOnce `parse()` is called, various properties will be populated\nwith the parsers data (aggregated in the `'data'` property).", "extends": "Base", "is_constructor": 1, @@ -203,7 +203,7 @@ "module": "yuidoc", "namespace": "", "file": "lib/docview.js", - "line": 15, + "line": 14, "description": "View class borrowed from [Selleck](https://github.com/rgrove/selleck) \nThe view class is a **`handlebars`** template helper.", "is_constructor": 1, "params": [ @@ -258,7 +258,7 @@ "module": "yuidoc", "namespace": "", "file": "lib/index.js", - "line": 6, + "line": 7, "description": "Module creates the YUI instance with the required modules, uses them and exports the **Y** to be used\nby the _CLI class_ or by extenders: `require('yuidocjs');` \nYou can use it like this: \n\n var options = {\n paths: [ './lib' ],\n outdir: './out'\n };\n\n var Y = require('yuidocjs');\n var json = (new Y.YUIDoc(options)).run();", "exports": "{YUI} Y A YUI instance" }, @@ -315,7 +315,7 @@ "module": "yuidoc", "namespace": "", "file": "lib/yuidoc.js", - "line": 50, + "line": 49, "description": "YUIDoc main class\n\n var options = {\n paths: [ './lib' ],\n outdir: './out'\n };\n\n var Y = require('yuidoc');\n var json = (new Y.YUIDoc(options)).run();", "mainName": "yuidoc", "tag": "main", @@ -333,7 +333,7 @@ "classitems": [ { "file": "lib/builder.js", - "line": 119, + "line": 120, "description": "Register a `Y.Handlebars` helper method", "itemtype": "method", "name": "_addHelpers", @@ -349,7 +349,7 @@ }, { "file": "lib/builder.js", - "line": 136, + "line": 137, "description": "Wrapper around the Markdown parser so it can be normalized or even side stepped", "itemtype": "method", "name": "markdown", @@ -371,7 +371,7 @@ }, { "file": "lib/builder.js", - "line": 163, + "line": 164, "description": "Parse the item to be cross linked and return an HREF linked to the item", "itemtype": "method", "name": "_parseCrossLink", @@ -402,7 +402,7 @@ }, { "file": "lib/builder.js", - "line": 270, + "line": 271, "description": "List of native types to cross link to MDN", "itemtype": "property", "name": "NATIVES", @@ -412,7 +412,7 @@ }, { "file": "lib/builder.js", - "line": 309, + "line": 310, "description": "Function to link an external type uses `NATIVES` object", "itemtype": "method", "name": "NATIVES_LINKER", @@ -434,8 +434,8 @@ }, { "file": "lib/builder.js", - "line": 323, - "description": "Mixes the various external data soures together into the local data, augmenting \nit with flags.", + "line": 324, + "description": "Mixes the various external data soures together into the local data, augmenting\nit with flags.", "itemtype": "method", "name": "_mixExternal", "access": "private", @@ -445,7 +445,7 @@ }, { "file": "lib/builder.js", - "line": 371, + "line": 372, "description": "Fetches the remote data and fires the callback when it's all complete", "itemtype": "method", "name": "mixExternal", @@ -462,7 +462,7 @@ }, { "file": "lib/builder.js", - "line": 438, + "line": 439, "description": "File counter", "itemtype": "property", "name": "files", @@ -472,7 +472,7 @@ }, { "file": "lib/builder.js", - "line": 444, + "line": 445, "description": "Holder for project meta data", "itemtype": "property", "name": "_meta", @@ -484,7 +484,7 @@ }, { "file": "lib/builder.js", - "line": 451, + "line": 452, "description": "Prep the meta data to be fed to Selleck", "itemtype": "method", "name": "getProjectMeta", @@ -497,7 +497,7 @@ }, { "file": "lib/builder.js", - "line": 494, + "line": 495, "description": "Populate the meta data for classes", "itemtype": "method", "name": "populateClasses", @@ -517,7 +517,7 @@ }, { "file": "lib/builder.js", - "line": 516, + "line": 519, "description": "Populate the meta data for modules", "itemtype": "method", "name": "populateModules", @@ -537,7 +537,7 @@ }, { "file": "lib/builder.js", - "line": 553, + "line": 565, "description": "Populate the meta data for files", "itemtype": "method", "name": "populateFiles", @@ -557,7 +557,7 @@ }, { "file": "lib/builder.js", - "line": 602, + "line": 622, "description": "Parses file and line number from an item object and build's an HREF", "itemtype": "method", "name": "addFoundAt", @@ -577,7 +577,7 @@ }, { "file": "lib/builder.js", - "line": 618, + "line": 638, "description": "Augments the **DocParser** meta data to provide default values for certain keys as well as parses all descriptions\nwith the `Markdown Parser`", "itemtype": "method", "name": "augmentData", @@ -597,7 +597,7 @@ }, { "file": "lib/builder.js", - "line": 684, + "line": 704, "description": "Makes the default directories needed", "itemtype": "method", "name": "makeDirs", @@ -613,7 +613,7 @@ }, { "file": "lib/builder.js", - "line": 737, + "line": 757, "description": "Parses `
    ` tags and adds the __prettyprint__ `className` to them",
                 "itemtype": "method",
                 "name": "_parseCode",
    @@ -635,7 +635,7 @@
             },
             {
                 "file": "lib/builder.js",
    -            "line": 750,
    +            "line": 770,
                 "description": "Ported from [Selleck](https://github.com/rgrove/selleck), this handles ```'s in fields\n       that are not parsed by the **Markdown** parser.",
                 "itemtype": "method",
                 "name": "_inlineCode",
    @@ -657,7 +657,7 @@
             },
             {
                 "file": "lib/builder.js",
    -            "line": 769,
    +            "line": 789,
                 "description": "Ported from [Selleck](https://github.com/rgrove/selleck)\n       Renders the handlebars templates with the default View class.",
                 "itemtype": "method",
                 "name": "render",
    @@ -709,7 +709,7 @@
             },
             {
                 "file": "lib/builder.js",
    -            "line": 823,
    +            "line": 845,
                 "description": "Render the index file",
                 "itemtype": "method",
                 "name": "renderIndex",
    @@ -737,7 +737,7 @@
             },
             {
                 "file": "lib/builder.js",
    -            "line": 848,
    +            "line": 870,
                 "description": "Generates the index.html file",
                 "itemtype": "method",
                 "name": "writeIndex",
    @@ -753,7 +753,7 @@
             },
             {
                 "file": "lib/builder.js",
    -            "line": 872,
    +            "line": 894,
                 "description": "Render a module",
                 "itemtype": "method",
                 "name": "renderModule",
    @@ -781,7 +781,7 @@
             },
             {
                 "file": "lib/builder.js",
    -            "line": 950,
    +            "line": 978,
                 "description": "Generates the module files under \"out\"/modules/",
                 "itemtype": "method",
                 "name": "writeModules",
    @@ -797,7 +797,7 @@
             },
             {
                 "file": "lib/builder.js",
    -            "line": 985,
    +            "line": 1019,
                 "description": "Checks an array of items (class items) to see if an item is in that list",
                 "itemtype": "method",
                 "name": "hasProperty",
    @@ -821,7 +821,7 @@
             },
             {
                 "file": "lib/builder.js",
    -            "line": 1002,
    +            "line": 1036,
                 "description": "Counter for stepping into merges",
                 "access": "private",
                 "tagname": "",
    @@ -833,7 +833,7 @@
             },
             {
                 "file": "lib/builder.js",
    -            "line": 1009,
    +            "line": 1043,
                 "description": "Merge superclass data into a child class",
                 "itemtype": "method",
                 "name": "mergeExtends",
    @@ -859,7 +859,7 @@
             },
             {
                 "file": "lib/builder.js",
    -            "line": 1060,
    +            "line": 1095,
                 "description": "Render the class file",
                 "itemtype": "method",
                 "name": "renderClass",
    @@ -887,7 +887,7 @@
             },
             {
                 "file": "lib/builder.js",
    -            "line": 1345,
    +            "line": 1381,
                 "description": "Generates the class files under \"out\"/classes/",
                 "itemtype": "method",
                 "name": "writeClasses",
    @@ -903,7 +903,7 @@
             },
             {
                 "file": "lib/builder.js",
    -            "line": 1380,
    +            "line": 1422,
                 "description": "Sort method of array of objects with a property called __name__",
                 "itemtype": "method",
                 "name": "nameSort",
    @@ -928,7 +928,7 @@
             },
             {
                 "file": "lib/builder.js",
    -            "line": 1403,
    +            "line": 1445,
                 "description": "Generates the syntax files under `\"out\"/files/`",
                 "itemtype": "method",
                 "name": "writeFiles",
    @@ -944,7 +944,7 @@
             },
             {
                 "file": "lib/builder.js",
    -            "line": 1441,
    +            "line": 1493,
                 "description": "Render the source file",
                 "itemtype": "method",
                 "name": "renderFile",
    @@ -972,7 +972,7 @@
             },
             {
                 "file": "lib/builder.js",
    -            "line": 1495,
    +            "line": 1547,
                 "description": "Write the API meta data used for the AutoComplete widget",
                 "itemtype": "method",
                 "name": "writeAPIMeta",
    @@ -989,7 +989,7 @@
             },
             {
                 "file": "lib/builder.js",
    -            "line": 1508,
    +            "line": 1560,
                 "description": "Render the API meta and return the Javascript",
                 "itemtype": "method",
                 "name": "renderAPIMeta",
    @@ -1006,7 +1006,7 @@
             },
             {
                 "file": "lib/builder.js",
    -            "line": 1538,
    +            "line": 1592,
                 "description": "Normalizes a file path to a writable filename:\n\n   var path = 'lib/file.js';\n   returns 'lib_file.js';",
                 "itemtype": "method",
                 "name": "filterFileName",
    @@ -1026,7 +1026,7 @@
             },
             {
                 "file": "lib/builder.js",
    -            "line": 1551,
    +            "line": 1605,
                 "description": "Compiles the templates from the meta-data provided by DocParser",
                 "itemtype": "method",
                 "name": "compile",
    @@ -1042,8 +1042,8 @@
             },
             {
                 "file": "lib/docparser.js",
    -            "line": 12,
    -            "description": "Parses the JSON data and formats it into a nice log string for filename and line number:\n   `/file/name.js:123`",
    +            "line": 11,
    +            "description": "Parses the JSON data and formats it into a nice log string for\nfilename and line number: `/file/name.js:123`",
                 "itemtype": "method",
                 "name": "stringlog",
                 "access": "private",
    @@ -1064,7 +1064,51 @@
             },
             {
                 "file": "lib/docparser.js",
    -            "line": 95,
    +            "line": 38,
    +            "description": "Flatten a string, remove all line breaks and replace them with a token",
    +            "itemtype": "method",
    +            "name": "implodeString",
    +            "access": "private",
    +            "tagname": "",
    +            "params": [
    +                {
    +                    "name": "str",
    +                    "description": "The string to operate on",
    +                    "type": "String"
    +                }
    +            ],
    +            "return": {
    +                "description": "The modified string",
    +                "type": "String"
    +            },
    +            "class": "DocParser",
    +            "module": "yuidoc"
    +        },
    +        {
    +            "file": "lib/docparser.js",
    +            "line": 48,
    +            "description": "Un-flatten a string, replace tokens injected with `implodeString`",
    +            "itemtype": "method",
    +            "name": "implodeString",
    +            "access": "private",
    +            "tagname": "",
    +            "params": [
    +                {
    +                    "name": "str",
    +                    "description": "The string to operate on",
    +                    "type": "String"
    +                }
    +            ],
    +            "return": {
    +                "description": "The modified string",
    +                "type": "String"
    +            },
    +            "class": "DocParser",
    +            "module": "yuidoc"
    +        },
    +        {
    +            "file": "lib/docparser.js",
    +            "line": 94,
                 "description": "A list of known tags.  This populates a member variable\nduring initialization, and will be updated if additional\ndigesters are added.",
                 "itemtype": "property",
                 "name": "TAGLIST",
    @@ -1075,7 +1119,7 @@
             },
             {
                 "file": "lib/docparser.js",
    -            "line": 175,
    +            "line": 174,
                 "description": "Common errors will get scrubbed instead of being ignored.",
                 "itemtype": "property",
                 "name": "CORRECTIONS",
    @@ -1086,7 +1130,7 @@
             },
             {
                 "file": "lib/docparser.js",
    -            "line": 198,
    +            "line": 197,
                 "description": "A map of the default tag processors, keyed by the\ntag name.  Multiple tags can use the same digester\nby supplying the string name that points to the\nimplementation rather than a function.",
                 "itemtype": "property",
                 "name": "DIGESTERS",
    @@ -1097,7 +1141,7 @@
             },
             {
                 "file": "lib/docparser.js",
    -            "line": 750,
    +            "line": 755,
                 "description": "Digesters process the tag/text pairs found in a\ncomment block.  They are looked up by tag name.\nThe digester gets the tagname, the value, the\ntarget object to apply values to, and the full\nblock that is being processed.  Digesters can\nbe declared as strings instead of a function --\nin that case, the program will try to look up\nthe key listed and use the function there instead\n(it is an alias).  Digesters can return a host\nobject in the case the tag defines a new key\nblock type (modules/classes/methods/events/properties)",
                 "itemtype": "attribute",
                 "name": "digesters",
    @@ -1106,7 +1150,7 @@
             },
             {
                 "file": "lib/docparser.js",
    -            "line": 772,
    +            "line": 777,
                 "description": "Emitters will be schemas for the types of payloads\nthe parser will emit.  Not implemented.",
                 "itemtype": "attribute",
                 "name": "emitters",
    @@ -1115,7 +1159,7 @@
             },
             {
                 "file": "lib/docparser.js",
    -            "line": 783,
    +            "line": 788,
                 "description": "Comment syntax type.",
                 "itemtype": "attribute",
                 "name": "syntaxtype",
    @@ -1125,7 +1169,7 @@
             },
             {
                 "file": "lib/docparser.js",
    -            "line": 792,
    +            "line": 797,
                 "description": "The map of file names to file content.",
                 "itemtype": "attribute",
                 "name": "filemap",
    @@ -1134,7 +1178,7 @@
             },
             {
                 "file": "lib/docparser.js",
    -            "line": 800,
    +            "line": 805,
                 "description": "A map of file names to directory name.  Provided in\ncase this needs to be used to reset the module name\nappropriately -- currently not used",
                 "itemtype": "attribute",
                 "name": "dirmap",
    @@ -1143,7 +1187,7 @@
             },
             {
                 "file": "lib/docparser.js",
    -            "line": 810,
    +            "line": 815,
                 "description": "The file currently being parsed",
                 "itemtype": "attribute",
                 "name": "currentfile",
    @@ -1153,7 +1197,7 @@
             },
             {
                 "file": "lib/docparser.js",
    -            "line": 831,
    +            "line": 836,
                 "description": "The main documentation block for the module itself.",
                 "itemtype": "attribute",
                 "name": "mainmodule",
    @@ -1163,7 +1207,7 @@
             },
             {
                 "file": "lib/docparser.js",
    -            "line": 867,
    +            "line": 872,
                 "description": "The module currently being parsed",
                 "itemtype": "attribute",
                 "name": "currentmodule",
    @@ -1173,7 +1217,7 @@
             },
             {
                 "file": "lib/docparser.js",
    -            "line": 919,
    +            "line": 931,
                 "description": "The submodule currently being parsed",
                 "itemtype": "attribute",
                 "name": "currentsubmodule",
    @@ -1183,7 +1227,7 @@
             },
             {
                 "file": "lib/docparser.js",
    -            "line": 959,
    +            "line": 971,
                 "description": "The class currently being parsed",
                 "itemtype": "attribute",
                 "name": "currentclass",
    @@ -1193,7 +1237,7 @@
             },
             {
                 "file": "lib/docparser.js",
    -            "line": 995,
    +            "line": 1011,
                 "description": "Takes a non-namespaced classname and resolves it to a namespace (to support `@for`)",
                 "access": "private",
                 "tagname": "",
    @@ -1215,7 +1259,7 @@
             },
             {
                 "file": "lib/docparser.js",
    -            "line": 1068,
    +            "line": 1085,
                 "description": "Normalizes the initial indentation of the given _content_ so that the first line\nis unindented, and all other lines are unindented to the same degree as the\nfirst line. So if the first line has four spaces at the beginning, then all\nlines will be unindented four spaces. Ported from [Selleck](https://github.com/rgrove/selleck)",
                 "itemtype": "method",
                 "name": "unindent",
    @@ -1237,8 +1281,8 @@
             },
             {
                 "file": "lib/docparser.js",
    -            "line": 1090,
    -            "description": "Transforms a JavaDoc style comment block (less the start\nand end of it) into a list\nof tag/text pairs.  The leading space and '*' are removed,\nbut the remaining whitespace is preserved so that the\noutput should be friendly for both markdown and html\nparsers.",
    +            "line": 1106,
    +            "description": "Transforms a JavaDoc style comment block (less the start and end of it)\ninto a list of tag/text pairs. The leading space and '*' are removed,\nbut the remaining whitespace is preserved so that the output should be\nfriendly for both markdown and html parsers.",
                 "itemtype": "method",
                 "name": "handlecomment",
                 "params": [
    @@ -1263,7 +1307,7 @@
             },
             {
                 "file": "lib/docparser.js",
    -            "line": 1161,
    +            "line": 1182,
                 "description": "Accepts a map of filenames to file content.  Returns\na map of filenames to an array of API comment block\ntext.  This expects the comment to start with / **\non its own line, and end with * / on its own\nline.  Override this function to provide an\nalternative comment parser.",
                 "itemtype": "method",
                 "name": "extract",
    @@ -1288,7 +1332,7 @@
             },
             {
                 "file": "lib/docparser.js",
    -            "line": 1215,
    +            "line": 1237,
                 "description": "Processes all the tags in a single comment block",
                 "itemtype": "method",
                 "name": "processblock",
    @@ -1304,7 +1348,7 @@
             },
             {
                 "file": "lib/docparser.js",
    -            "line": 1289,
    +            "line": 1310,
                 "description": "Transforms a map of filenames to arrays of comment blocks into a\nJSON structure that represents the entire processed API doc info\nand relationships between elements for the entire project.",
                 "itemtype": "method",
                 "name": "transform",
    @@ -1324,7 +1368,7 @@
             },
             {
                 "file": "lib/docparser.js",
    -            "line": 1402,
    +            "line": 1424,
                 "description": "Extracts and transforms the filemap provided to constructor",
                 "itemtype": "method",
                 "name": "parse",
    @@ -1349,7 +1393,7 @@
             },
             {
                 "file": "lib/docview.js",
    -            "line": 29,
    +            "line": 28,
                 "description": "**Mustache** `lambda` method for setting the HTML title",
                 "itemtype": "method",
                 "name": "htmlTitle",
    @@ -1358,7 +1402,7 @@
             },
             {
                 "file": "lib/docview.js",
    -            "line": 48,
    +            "line": 47,
                 "description": "**Mustache** `lambda` method for setting the title",
                 "itemtype": "method",
                 "name": "title",
    @@ -1367,7 +1411,7 @@
             },
             {
                 "file": "lib/files.js",
    -            "line": 36,
    +            "line": 32,
                 "description": "Copy a directory from one location to another",
                 "itemtype": "method",
                 "name": "copyDirectory",
    @@ -1384,7 +1428,7 @@
                     },
                     {
                         "name": "overwrite",
    -                    "description": "Whether or not to overwrite destination files\n if they already exist.",
    +                    "description": "Whether or not to overwrite destination files\n    if they already exist.",
                         "type": "Boolean",
                         "optional": true,
                         "optdefault": "false"
    @@ -1400,7 +1444,7 @@
             },
             {
                 "file": "lib/files.js",
    -            "line": 113,
    +            "line": 122,
                 "description": "Copy a file from one location to another",
                 "itemtype": "method",
                 "name": "copyFile",
    @@ -1417,7 +1461,7 @@
                     },
                     {
                         "name": "overwrite",
    -                    "description": "Whether or not to overwrite destination files\n if they already exist.",
    +                    "description": "Whether or not to overwrite destination files\n    if they already exist.",
                         "type": "Boolean",
                         "optional": true,
                         "optdefault": "false"
    @@ -1440,7 +1484,7 @@
             },
             {
                 "file": "lib/files.js",
    -            "line": 159,
    +            "line": 175,
                 "description": "If _source_ is a file, copies it to _dest_. If it's a directory, recursively\ncopies it and all files and directories it contains to _dest_.\n\nNote that when attempting to copy a file into a directory, you should specify\nthe full path to the new file (including the new filename). Otherwise, it will\nbe interpreted as an attempt to copy the _source_ file *over* the _dest_\ndirectory instead of *into* it.\n\nKnown issues:\n- Doesn't preserve ownership or permissions on copied files/directories.",
                 "itemtype": "method",
                 "name": "copyPath",
    @@ -1480,7 +1524,7 @@
             },
             {
                 "file": "lib/files.js",
    -            "line": 206,
    +            "line": 221,
                 "description": "If _path_ is a file, deletes it. If _path_ is a directory, recursively deletes\nit and all files and directories it contains.\n\nThis method is synchronous.",
                 "itemtype": "method",
                 "name": "deletePath",
    @@ -1496,7 +1540,7 @@
             },
             {
                 "file": "lib/files.js",
    -            "line": 230,
    +            "line": 246,
                 "description": "Check to see if this is a directory",
                 "itemtype": "method",
                 "name": "isDirectory",
    @@ -1523,7 +1567,7 @@
             },
             {
                 "file": "lib/files.js",
    -            "line": 258,
    +            "line": 277,
                 "description": "Check to see if this is a File",
                 "itemtype": "method",
                 "name": "isFile",
    @@ -1550,7 +1594,7 @@
             },
             {
                 "file": "lib/files.js",
    -            "line": 284,
    +            "line": 306,
                 "description": "Check to see if this is a SymLink",
                 "itemtype": "method",
                 "name": "isSymbolicLink",
    @@ -1570,7 +1614,7 @@
             },
             {
                 "file": "lib/files.js",
    -            "line": 296,
    +            "line": 320,
                 "description": "Like `fs.lstatSync()`, but returns `null` instead of throwing when _path_\ndoesn't exist. Will still throw on other types of errors.",
                 "itemtype": "method",
                 "name": "lstatSync",
    @@ -1590,7 +1634,7 @@
             },
             {
                 "file": "lib/files.js",
    -            "line": 317,
    +            "line": 342,
                 "description": "Like `fs.statSync()`, but returns `null` instead of throwing when _path_\ndoesn't exist. Will still throw on other types of errors.",
                 "itemtype": "method",
                 "name": "statSync",
    @@ -1610,7 +1654,7 @@
             },
             {
                 "file": "lib/files.js",
    -            "line": 338,
    +            "line": 363,
                 "description": "Copy the theme assets directory",
                 "itemtype": "method",
                 "name": "copyAssets",
    @@ -1641,7 +1685,7 @@
             },
             {
                 "file": "lib/files.js",
    -            "line": 386,
    +            "line": 411,
                 "description": "Helper method for getting JSON data from a local file",
                 "itemtype": "method",
                 "name": "getJSON",
    @@ -1661,7 +1705,7 @@
             },
             {
                 "file": "lib/files.js",
    -            "line": 400,
    +            "line": 426,
                 "description": "Helper method for writing files to disk. It wraps the NodeJS file API",
                 "itemtype": "method",
                 "name": "writeFile",
    @@ -1789,7 +1833,7 @@
             },
             {
                 "file": "lib/server.js",
    -            "line": 106,
    +            "line": 105,
                 "description": "`/files` endpoint",
                 "itemtype": "method",
                 "name": "files",
    @@ -1810,7 +1854,7 @@
             },
             {
                 "file": "lib/server.js",
    -            "line": 132,
    +            "line": 131,
                 "description": "`/classes` endpoint",
                 "itemtype": "method",
                 "name": "clazz",
    @@ -1831,7 +1875,7 @@
             },
             {
                 "file": "lib/server.js",
    -            "line": 148,
    +            "line": 147,
                 "description": "`/modules` endpoint",
                 "itemtype": "method",
                 "name": "modules",
    @@ -1852,7 +1896,7 @@
             },
             {
                 "file": "lib/server.js",
    -            "line": 164,
    +            "line": 163,
                 "description": "`/` endpoint",
                 "itemtype": "method",
                 "name": "home",
    @@ -1873,7 +1917,7 @@
             },
             {
                 "file": "lib/server.js",
    -            "line": 176,
    +            "line": 175,
                 "description": "Creates the Express server and prep's YUI for serving",
                 "itemtype": "method",
                 "name": "init",
    @@ -1882,7 +1926,7 @@
             },
             {
                 "file": "lib/server.js",
    -            "line": 194,
    +            "line": 193,
                 "description": "Start the server with the supplied options.",
                 "itemtype": "method",
                 "name": "start",
    @@ -1980,7 +2024,7 @@
             },
             {
                 "file": "lib/utils.js",
    -            "line": 91,
    +            "line": 93,
                 "description": "Loads pages (files with a `.handlebars` extension) in the specified directory and\nreturns an object containing a mapping of page names (the part of the filename)\npreceding the `.handlebars` extension) to page content.",
                 "itemtype": "method",
                 "name": "getPages",
    @@ -2000,7 +2044,7 @@
             },
             {
                 "file": "lib/utils.js",
    -            "line": 122,
    +            "line": 126,
                 "description": "Like `getPages()`, but returns only the files under the `partial/` subdirectory\nof the specified _dir_.",
                 "itemtype": "method",
                 "name": "getPartials",
    @@ -2020,7 +2064,7 @@
             },
             {
                 "file": "lib/utils.js",
    -            "line": 136,
    +            "line": 140,
                 "description": "Mix/merge/munge data into the template.",
                 "itemtype": "method",
                 "name": "prepare",
    @@ -2058,7 +2102,7 @@
             },
             {
                 "file": "lib/utils.js",
    -            "line": 223,
    +            "line": 226,
                 "description": "Walk the directory tree to locate the yuidoc.json file.",
                 "itemtype": "method",
                 "name": "getProjectData",
    @@ -2076,7 +2120,7 @@
             },
             {
                 "file": "lib/utils.js",
    -            "line": 336,
    +            "line": 340,
                 "description": "Walks the tree from this dir and returns all the subdirs",
                 "itemtype": "method",
                 "name": "getDirs",
    @@ -2096,7 +2140,7 @@
             },
             {
                 "file": "lib/utils.js",
    -            "line": 363,
    +            "line": 366,
                 "description": "Make sure all the paths passed are directories and that they are not in the ignore list.",
                 "itemtype": "method",
                 "name": "validatePaths",
    @@ -2119,7 +2163,7 @@
             },
             {
                 "file": "lib/utils.js",
    -            "line": 446,
    +            "line": 454,
                 "description": "Takes a type string and converts it to a \"First letter upper cased\" type. e.g. `(string -> String, object -> Object)`",
                 "itemtype": "method",
                 "name": "fixType",
    @@ -2137,6 +2181,26 @@
                 "class": "Utils",
                 "module": "yuidoc"
             },
    +        {
    +            "file": "lib/utils.js",
    +            "line": 476,
    +            "description": "Produces a normalized web path by joining all the parts and normalizing the\nfilesystem-like path into web compatible url.\nSupports relative and absolute paths.\nCourtesy of [Mojito's utils](https://github.com/yahoo/mojito/)",
    +            "itemtype": "method",
    +            "name": "webpath",
    +            "params": [
    +                {
    +                    "name": "url",
    +                    "description": "the list of parts to be joined and normalized",
    +                    "type": "Array|String*"
    +                }
    +            ],
    +            "return": {
    +                "description": "The joined and normalized url",
    +                "type": "String"
    +            },
    +            "class": "Utils",
    +            "module": "yuidoc"
    +        },
             {
                 "file": "lib/yuidoc.js",
                 "line": 29,
    @@ -2150,7 +2214,7 @@
             },
             {
                 "file": "lib/yuidoc.js",
    -            "line": 67,
    +            "line": 66,
                 "description": "Holds the number of files that we are processing.",
                 "itemtype": "property",
                 "name": "filecount",
    @@ -2162,7 +2226,7 @@
             },
             {
                 "file": "lib/yuidoc.js",
    -            "line": 74,
    +            "line": 73,
                 "description": "Hash map of dirnames to selleck config options.",
                 "itemtype": "property",
                 "name": "selleck",
    @@ -2174,7 +2238,7 @@
             },
             {
                 "file": "lib/yuidoc.js",
    -            "line": 81,
    +            "line": 80,
                 "description": "Holder for the list of files we are processing.",
                 "itemtype": "property",
                 "name": "filemap",
    @@ -2186,7 +2250,7 @@
             },
             {
                 "file": "lib/yuidoc.js",
    -            "line": 88,
    +            "line": 87,
                 "description": "Holder for the list of directories we are processing.",
                 "itemtype": "property",
                 "name": "dirmap",
    @@ -2198,7 +2262,7 @@
             },
             {
                 "file": "lib/yuidoc.js",
    -            "line": 96,
    +            "line": 95,
                 "description": "Internal holder for configuration options.",
                 "itemtype": "property",
                 "name": "options",
    @@ -2210,7 +2274,7 @@
             },
             {
                 "file": "lib/yuidoc.js",
    -            "line": 113,
    +            "line": 112,
                 "description": "Always exclude these directories",
                 "itemtype": "method",
                 "name": "_setDefaultExcludes",
    @@ -2232,7 +2296,7 @@
             },
             {
                 "file": "lib/yuidoc.js",
    -            "line": 137,
    +            "line": 138,
                 "description": "Walks the paths and parses the directory contents",
                 "itemtype": "method",
                 "name": "walk",
    @@ -2243,7 +2307,7 @@
             },
             {
                 "file": "lib/yuidoc.js",
    -            "line": 147,
    +            "line": 149,
                 "description": "Walks the passed directory and grabs all the files recursively.",
                 "itemtype": "method",
                 "name": "parsedir",
    @@ -2261,7 +2325,7 @@
             },
             {
                 "file": "lib/yuidoc.js",
    -            "line": 182,
    +            "line": 190,
                 "description": "Gathers all the file data and populates the filemap and dirmap hashes.",
                 "itemtype": "method",
                 "name": "parsefiles",
    @@ -2284,7 +2348,7 @@
             },
             {
                 "file": "lib/yuidoc.js",
    -            "line": 233,
    +            "line": 248,
                 "description": "Writes the parser JSON data to disk.",
                 "itemtype": "method",
                 "name": "writeJSON",
    @@ -2306,7 +2370,7 @@
             },
             {
                 "file": "lib/yuidoc.js",
    -            "line": 311,
    +            "line": 334,
                 "description": "Process the config, walk the file tree and write out the JSON data.",
                 "itemtype": "method",
                 "name": "run",
    @@ -2319,7 +2383,7 @@
             },
             {
                 "file": "lib/yuidoc.js",
    -            "line": 317,
    +            "line": 340,
                 "description": "Timestamp holder so we know when YUIDoc started the parse process.",
                 "itemtype": "property",
                 "name": "starttime",
    @@ -2329,7 +2393,7 @@
             },
             {
                 "file": "lib/yuidoc.js",
    -            "line": 341,
    +            "line": 362,
                 "description": "Timestamp holder so we know when YUIDoc has finished the parse process.",
                 "itemtype": "property",
                 "name": "endtime",
    @@ -2341,7 +2405,7 @@
         "warnings": [
             {
                 "message": "unknown tag: exports",
    -            "line": " lib/index.js:6"
    +            "line": " lib/index.js:7"
             }
         ]
     }
    \ No newline at end of file
    diff --git a/output/api/files/lib_builder.js.html b/output/api/files/lib_builder.js.html
    index 478e12d9..387222e4 100644
    --- a/output/api/files/lib_builder.js.html
    +++ b/output/api/files/lib_builder.js.html
    @@ -19,7 +19,7 @@ 

    - API Docs for: 0.3.47 + API Docs for: 0.3.49
    @@ -113,9 +113,9 @@

    File: lib/builder.js

    Code licensed under the BSD License: http://yuilibrary.com/license/ */ -var marked = require("marked"), +var marked = require('marked'), fs = require('graceful-fs'), - noop = function() {}, + noop = function () {}, path = require('path'), TEMPLATE; @@ -126,35 +126,37 @@

    File: lib/builder.js

    * @module yuidoc */ -YUI.add('doc-builder', function(Y) { +YUI.add('doc-builder', function (Y) { + /*jshint onevar:false */ var fixType = Y.Lang.fixType, - print = function(items) { - var out = '<ul>'; - - Y.each(items, function(i, k) { - out += '<li>'; - if (Y.Lang.isObject(i)) { - if (!i.path) { - out += k + '/' + print(i); - } else { - out += '<a href="../files/' + i.name + '.html">' + k + '</a>'; + print = function (items) { + var out = '<ul>'; + + Y.each(items, function (i, k) { + out += '<li>'; + if (Y.Lang.isObject(i)) { + if (!i.path) { + out += k + '/' + print(i); + } else { + out += '<a href="../files/' + i.name + '.html">' + k + '</a>'; + } } - } - out += '</li>'; - }); + out += '</li>'; + }); - out += '</ul>'; - return out; - }; + out += '</ul>'; + return out; + }; - Y.Handlebars.registerHelper('buildFileTree', function(items, fn) { + Y.Handlebars.registerHelper('buildFileTree', function (items) { return print(items); }); - var DEFAULT_THEME = themeDir = path.join(__dirname, '../', 'themes', 'default'); + var DEFAULT_THEME = path.join(__dirname, '../', 'themes', 'default'), + themeDir = DEFAULT_THEME; - Y.DocBuilder = function(options, data) { + Y.DocBuilder = function (options, data) { this.options = options; if (options.helpers) { this._addHelpers(options.helpers); @@ -168,7 +170,7 @@

    File: lib/builder.js

    this.files = 0; var self = this; - Y.Handlebars.registerHelper('crossLink', function(item, options) { + Y.Handlebars.registerHelper('crossLink', function (item, options) { var str = ''; if (!item) { item = ''; @@ -176,8 +178,8 @@

    File: lib/builder.js

    //console.log('CrossLink:', item); if (item.indexOf('|') > 0) { var parts = item.split('|'), - p = []; - Y.each(parts, function(i) { + p = []; + Y.each(parts, function (i) { p.push(self._parseCrossLink.call(self, i)); }); str = p.join(' | '); @@ -187,28 +189,28 @@

    File: lib/builder.js

    return str; }); - Y.Handlebars.registerHelper('crossLinkModule', function(item, options) { + Y.Handlebars.registerHelper('crossLinkModule', function (item, options) { var str = item; if (self.data.modules[item]) { - var content = options.fn(this); - if (content === "") { - content = item; - } + var content = options.fn(this); + if (content === "") { + content = item; + } str = '<a href="../modules/' + item.replace(/\//g, '_') + - '.html">' + content + '</a>'; + '.html">' + content + '</a>'; } return str; }); - Y.Handlebars.registerHelper('crossLinkRaw', function(item, fn) { + Y.Handlebars.registerHelper('crossLinkRaw', function (item) { var str = ''; if (!item) { item = ''; } if (item.indexOf('|') > 0) { var parts = item.split('|'), - p = []; - Y.each(parts, function(i) { + p = []; + Y.each(parts, function (i) { p.push(self._parseCrossLink.call(self, i, true)); }); str = p.join(' | '); @@ -222,36 +224,35 @@

    File: lib/builder.js

    if (options.cacheTemplates === false) { this.cacheTemplates = false; } - }; Y.DocBuilder.prototype = { /** - * Register a `Y.Handlebars` helper method - * @method _addHelpers - * @param {Object} helpers Object containing a hash of names and functions - */ - _addHelpers: function(helpers) { + * Register a `Y.Handlebars` helper method + * @method _addHelpers + * @param {Object} helpers Object containing a hash of names and functions + */ + _addHelpers: function (helpers) { Y.log('Importing helpers: ' + helpers, 'info', 'builder'); - helpers.forEach(function(imp) { + helpers.forEach(function (imp) { if (!Y.Files.exists(imp) || Y.Files.exists(path.join(process.cwd(), imp))) { - imp= path.join(process.cwd(), imp); + imp = path.join(process.cwd(), imp); } var h = require(imp); - Object.keys(h).forEach(function(name) { + Object.keys(h).forEach(function (name) { Y.Handlebars.registerHelper(name, h[name]); }); }); }, /** - * Wrapper around the Markdown parser so it can be normalized or even side stepped - * @method markdown - * @private - * @param {String} md The Markdown string to parse - * @return {HTML} The rendered HTML - */ - markdown: function(md) { - html = marked(md, this.options.markdown); + * Wrapper around the Markdown parser so it can be normalized or even side stepped + * @method markdown + * @private + * @param {String} md The Markdown string to parse + * @return {HTML} The rendered HTML + */ + markdown: function (md) { + var html = marked(md, this.options.markdown); //Only reprocess if helpers were asked for if (this.options.helpers || (html.indexOf('{{#crossLink') > -1)) { //console.log('MD: ', html); @@ -269,19 +270,19 @@

    File: lib/builder.js

    } return html; }, - + /** - * Parse the item to be cross linked and return an HREF linked to the item - * @method _parseCrossLink - * @private - * @param {String} item The item to crossLink - * @param {Boolean} [raw=false] Do not wrap it in HTML - * @param {String} [content] crossLink helper content - */ - _parseCrossLink: function(item, raw, content) { + * Parse the item to be cross linked and return an HREF linked to the item + * @method _parseCrossLink + * @private + * @param {String} item The item to crossLink + * @param {Boolean} [raw=false] Do not wrap it in HTML + * @param {String} [content] crossLink helper content + */ + _parseCrossLink: function (item, raw, content) { var self = this; var base = '../', - baseName = item, + baseItem, newWin = false, className = 'crosslink'; @@ -322,7 +323,7 @@

    File: lib/builder.js

    if (method.indexOf(':') > -1) { parts = method.split(':'); - method = parts[0], + method = parts[0]; type = parts[1]; if (type.indexOf('attr') === 0) { type = 'attribute'; @@ -331,7 +332,7 @@

    File: lib/builder.js

    if (cls && method) { if (self.data.classes[cls]) { - self.data.classitems.forEach(function(i) { + self.data.classitems.forEach(function (i) { if (i.itemtype === type && i.name === method && i.class === cls) { link = true; baseItem = method; @@ -339,7 +340,7 @@

    File: lib/builder.js

    if (t === 'attribute') { t = 'attr'; } - href = path.join(base, 'classes', cls + '.html#' + t + '_' + method); + href = Y.webpath(base, 'classes', cls + '.html#' + t + '_' + method); } }); } @@ -351,9 +352,9 @@

    File: lib/builder.js

    link = false; } if (!href) { - href = path.join(base, 'classes', item + '.html'); + href = Y.webpath(base, 'classes', item + '.html'); if (base.match(/^https?:\/\//)) { - href = base + path.join('classes', item + '.html'); + href = base + Y.webpath('classes', item + '.html'); } } if (!link && self.options.linkNatives) { @@ -367,21 +368,21 @@

    File: lib/builder.js

    } } if (link) { - if (content !== undefined) { - content = content.trim(); - } - if (!content) { - content = baseItem; - } + if (content !== undefined) { + content = content.trim(); + } + if (!content) { + content = baseItem; + } item = '<a href="' + href + '" class="' + className + '"' + ((newWin) ? ' target="_blank"' : '') + '>' + content + '</a>'; } return (raw) ? href : item; }, /** - * List of native types to cross link to MDN - * @property NATIVES - * @type Object - */ + * List of native types to cross link to MDN + * @property NATIVES + * @type Object + */ NATIVES: { 'Array': 1, 'Boolean': 1, @@ -411,44 +412,44 @@

    File: lib/builder.js

    'TypeError': 1, 'undefined': 1, 'URIError': 1, - 'HTMLElement': 'https:/'+'/developer.mozilla.org/en/Document_Object_Model_(DOM)/', - 'HTMLCollection': 'https:/'+'/developer.mozilla.org/en/Document_Object_Model_(DOM)/', - 'DocumentFragment': 'https:/'+'/developer.mozilla.org/en/Document_Object_Model_(DOM)/', - 'HTMLDocument': 'https:/'+'/developer.mozilla.org/en/Document_Object_Model_(DOM)/' + 'HTMLElement': 'https:/' + '/developer.mozilla.org/en/Document_Object_Model_(DOM)/', + 'HTMLCollection': 'https:/' + '/developer.mozilla.org/en/Document_Object_Model_(DOM)/', + 'DocumentFragment': 'https:/' + '/developer.mozilla.org/en/Document_Object_Model_(DOM)/', + 'HTMLDocument': 'https:/' + '/developer.mozilla.org/en/Document_Object_Model_(DOM)/' }, /** - * Function to link an external type uses `NATIVES` object - * @method NATIVES_LINKER - * @private - * @param {String} name The name of the type to link - * @return {String} The combined URL - */ - NATIVES_LINKER: function(name) { - var url = 'https:/'+'/developer.mozilla.org/en/JavaScript/Reference/Global_Objects/'; + * Function to link an external type uses `NATIVES` object + * @method NATIVES_LINKER + * @private + * @param {String} name The name of the type to link + * @return {String} The combined URL + */ + NATIVES_LINKER: function (name) { + var url = 'https:/' + '/developer.mozilla.org/en/JavaScript/Reference/Global_Objects/'; if (this.NATIVES[name] !== 1) { url = this.NATIVES[name]; } return url + name; }, /** - * Mixes the various external data soures together into the local data, augmenting - * it with flags. - * @method _mixExternal - * @private - */ - _mixExternal: function() { + * Mixes the various external data soures together into the local data, augmenting + * it with flags. + * @method _mixExternal + * @private + */ + _mixExternal: function () { var self = this; Y.log('External data received, mixing', 'info', 'builder'); - self.options.externalData.forEach(function(exData) { - - ['files', 'classes', 'modules'].forEach(function(k) { - Y.each(exData[k], function(item, key) { + self.options.externalData.forEach(function (exData) { + + ['files', 'classes', 'modules'].forEach(function (k) { + Y.each(exData[k], function (item, key) { item.external = true; var file = item.name; if (!item.file) { file = self.filterFileName(item.name); } - + if (item.type) { item.type = fixType(item.type); } @@ -458,33 +459,33 @@

    File: lib/builder.js

    self.data[k][key] = item; }); }); - Y.each(exData.classitems, function(item) { + Y.each(exData.classitems, function (item) { item.external = true; item.path = exData.base + path.join('files', self.filterFileName(item.file) + '.html'); if (item.type) { item.type = fixType(item.type); } if (item.params) { - item.params.forEach(function(p) { + item.params.forEach(function (p) { if (p.type) { p.type = fixType(p.type); } }); } - if (item.return) { - item.return.type = fixType(item.return.type); + if (item["return"]) { + item["return"].type = fixType(item["return"].type); } self.data.classitems.push(item); }); }); }, /** - * Fetches the remote data and fires the callback when it's all complete - * @method mixExternal - * @param {Callback} cb The callback to execute when complete - * @async - */ - mixExternal: function(cb) { + * Fetches the remote data and fires the callback when it's all complete + * @method mixExternal + * @param {Callback} cb The callback to execute when complete + * @async + */ + mixExternal: function (cb) { var self = this, info = self.options.external; @@ -501,20 +502,20 @@

    File: lib/builder.js

    return; } if (!Y.Lang.isArray(info.data)) { - info.data = [ info.data ]; + info.data = [info.data]; } Y.log('Importing external documentation data.', 'info', 'builder'); - + var stack = new Y.Parallel(); - info.data.forEach(function(i) { + info.data.forEach(function (i) { var base; if (i.match(/^https?:\/\//)) { base = i.replace('data.json', ''); - Y.use('io-base', stack.add(function() { + Y.use('io-base', stack.add(function () { Y.log('Fetching: ' + i, 'info', 'builder'); Y.io(i, { on: { - complete: stack.add(function(id, e) { + complete: stack.add(function (id, e) { Y.log('Received: ' + i, 'info', 'builder'); var data = JSON.parse(e.responseText); data.base = base; @@ -539,31 +540,31 @@

    File: lib/builder.js

    } }); - stack.done(function() { + stack.done(function () { Y.log('Finished fetching remote data', 'info', 'builder'); self._mixExternal(); cb(); }); }, /** - * File counter - * @property files - * @type Number - */ + * File counter + * @property files + * @type Number + */ files: null, /** - * Holder for project meta data - * @property _meta - * @type Object - * @private - */ + * Holder for project meta data + * @property _meta + * @type Object + * @private + */ _meta: null, /** - * Prep the meta data to be fed to Selleck - * @method getProjectMeta - * @return {Object} The project metadata - */ - getProjectMeta: function() { + * Prep the meta data to be fed to Selleck + * @method getProjectMeta + * @return {Object} The project metadata + */ + getProjectMeta: function () { var obj = { meta: { yuiSeedUrl: 'http://yui.yahooapis.com/3.5.0/build/yui/yui-min.js', @@ -578,7 +579,7 @@

    File: lib/builder.js

    Y.log('Loading theme from ' + theme, 'info', 'builder'); meta = Y.Files.getJSON(theme); } else if (DEFAULT_THEME !== themeDir) { - theme = path.join(DEFAULT_THEME, 'theme.json') + theme = path.join(DEFAULT_THEME, 'theme.json'); if (Y.Files.exists(theme)) { Y.log('Loading theme from ' + theme, 'info', 'builder'); meta = Y.Files.getJSON(theme); @@ -595,22 +596,24 @@

    File: lib/builder.js

    } else { obj.meta = this._meta; } - Y.each(this.data.project, function(v, k) { + Y.each(this.data.project, function (v, k) { var key = k.substring(0, 1).toUpperCase() + k.substring(1, k.length); obj.meta['project' + key] = v; }); - return obj + return obj; }, /** - * Populate the meta data for classes - * @method populateClasses - * @param {Object} opts The original options - * @return {Object} The modified options - */ - populateClasses: function(opts) { + * Populate the meta data for classes + * @method populateClasses + * @param {Object} opts The original options + * @return {Object} The modified options + */ + populateClasses: function (opts) { opts.meta.classes = []; - Y.each(this.data.classes, function(v) { - if (v.external) { return } + Y.each(this.data.classes, function (v) { + if (v.external) { + return; + } opts.meta.classes.push({ displayName: v.name, name: v.name, @@ -624,31 +627,40 @@

    File: lib/builder.js

    return opts; }, /** - * Populate the meta data for modules - * @method populateModules - * @param {Object} opts The original options - * @return {Object} The modified options - */ - populateModules: function(opts) { + * Populate the meta data for modules + * @method populateModules + * @param {Object} opts The original options + * @return {Object} The modified options + */ + populateModules: function (opts) { var self = this; opts.meta.modules = []; opts.meta.allModules = []; - Y.each(this.data.modules, function(v) { - if (v.external) { return } - opts.meta.allModules.push({ displayName: v.displayName || v.name, name: self.filterFileName(v.name), description: v.description }); + Y.each(this.data.modules, function (v) { + if (v.external) { + return; + } + opts.meta.allModules.push({ + displayName: v.displayName || v.name, + name: self.filterFileName(v.name), + description: v.description + }); if (!v.is_submodule) { - var o = { displayName: v.displayName || v.name, name: self.filterFileName(v.name) }; + var o = { + displayName: v.displayName || v.name, + name: self.filterFileName(v.name) + }; if (v.submodules) { o.submodules = []; - Y.each(v.submodules, function(i, k) { - moddef = self.data.modules[k]; + Y.each(v.submodules, function (i, k) { + var moddef = self.data.modules[k]; if (moddef) { o.submodules.push({ displayName: k, description: moddef.description }); - } else { - //Y.log('Submodule data missing: ' + k + ' for ' + v.name, 'warn', 'builder'); + // } else { + // Y.log('Submodule data missing: ' + k + ' for ' + v.name, 'warn', 'builder'); } }); o.submodules.sort(self.nameSort); @@ -661,30 +673,38 @@

    File: lib/builder.js

    return opts; }, /** - * Populate the meta data for files - * @method populateFiles - * @param {Object} opts The original options - * @return {Object} The modified options - */ - populateFiles: function(opts) { + * Populate the meta data for files + * @method populateFiles + * @param {Object} opts The original options + * @return {Object} The modified options + */ + populateFiles: function (opts) { var self = this; opts.meta.files = []; - Y.each(this.data.files, function(v) { - if (v.external) { return } - opts.meta.files.push({ displayName: v.name, name: self.filterFileName(v.name), path: v.path || v.name }); + Y.each(this.data.files, function (v) { + if (v.external) { + return; + } + opts.meta.files.push({ + displayName: v.name, + name: self.filterFileName(v.name), + path: v.path || v.name + }); }); var tree = {}; var files = []; - Y.each(this.data.files, function(v) { - if (v.external) { return } + Y.each(this.data.files, function (v) { + if (v.external) { + return; + } files.push(v.name); }); files.sort(); - Y.each(files, function(v) { + Y.each(files, function (v) { var p = v.split('/'), par; - p.forEach(function(i, k) { + p.forEach(function (i, k) { if (!par) { if (!tree[i]) { tree[i] = {}; @@ -710,34 +730,34 @@

    File: lib/builder.js

    return opts; }, /** - * Parses file and line number from an item object and build's an HREF - * @method addFoundAt - * @param {Object} a The item to parse - * @return {String} The parsed HREF - */ - addFoundAt: function(a) { + * Parses file and line number from an item object and build's an HREF + * @method addFoundAt + * @param {Object} a The item to parse + * @return {String} The parsed HREF + */ + addFoundAt: function (a) { var self = this; if (a.file && a.line && !self.options.nocode) { a.foundAt = '../files/' + self.filterFileName(a.file) + '.html#l' + a.line; if (a.path) { - a.foundAt = a.path + '#l' + a.line; + a.foundAt = a.path + '#l' + a.line; } } return a; }, /** - * Augments the **DocParser** meta data to provide default values for certain keys as well as parses all descriptions - * with the `Markdown Parser` - * @method augmentData - * @param {Object} o The object to recurse and augment - * @return {Object} The augmented object - */ - augmentData: function(o) { + * Augments the **DocParser** meta data to provide default values for certain keys as well as parses all descriptions + * with the `Markdown Parser` + * @method augmentData + * @param {Object} o The object to recurse and augment + * @return {Object} The augmented object + */ + augmentData: function (o) { var self = this; o = self.addFoundAt(o); - Y.each(o, function(i, k1) { + Y.each(o, function (i, k1) { if (i && i.forEach) { - Y.each(i, function(a, k) { + Y.each(i, function (a, k) { if (!(a instanceof Object)) { return; } @@ -758,7 +778,7 @@

    File: lib/builder.js

    } a = self.addFoundAt(a); - Y.each(a, function(c, d) { + Y.each(a, function (c, d) { if (c.forEach || (c instanceof Object)) { c = self.augmentData(c); a[d] = c; @@ -769,7 +789,7 @@

    File: lib/builder.js

    }); } else if (i instanceof Object) { i = self.addFoundAt(i); - Y.each(i, function(v, k) { + Y.each(i, function (v, k) { if (k === 'final') { o[k1][k] = true; } @@ -792,18 +812,18 @@

    File: lib/builder.js

    return o; }, /** - * Makes the default directories needed - * @method makeDirs - * @param {Callback} cb The callback to execute after it's completed - */ - makeDirs: function(cb) { + * Makes the default directories needed + * @method makeDirs + * @param {Callback} cb The callback to execute after it's completed + */ + makeDirs: function (cb) { var self = this; var dirs = ['classes', 'modules', 'files']; if (self.options.dumpview) { dirs.push('json'); } - var writeRedirect = function(dir, file, cb) { - Y.Files.exists(file, function(x) { + var writeRedirect = function (dir, file, cb) { + Y.Files.exists(file, function (x) { if (x) { var out = path.join(dir, 'index.html'); fs.createReadStream(file).pipe(fs.createWriteStream(out)); @@ -814,11 +834,11 @@

    File: lib/builder.js

    var defaultIndex = path.join(themeDir, 'assets', 'index.html'); var stack = new Y.Parallel(); Y.log('Making default directories: ' + dirs.join(','), 'info', 'builder'); - dirs.forEach(function(d) { + dirs.forEach(function (d) { var dir = path.join(self.options.outdir, d); - Y.Files.exists(dir, stack.add(function(x) { + Y.Files.exists(dir, stack.add(function (x) { if (!x) { - fs.mkdir(dir, 0777, stack.add(function() { + fs.mkdir(dir, 0777, stack.add(function () { writeRedirect(dir, defaultIndex, stack.add(noop)); })); } else { @@ -826,7 +846,7 @@

    File: lib/builder.js

    } })); }); - stack.done(function() { + stack.done(function () { if (cb) { cb(); } @@ -834,23 +854,23 @@

    File: lib/builder.js

    }, - _resolveUrl: function(url, opts) { - if(!url) { - return null; + _resolveUrl: function (url, opts) { + if (!url) { + return null; } - if ( url.indexOf("://") >= 0 ) { + if (url.indexOf("://") >= 0) { return url; } - return path.join(opts.meta.projectRoot,url); + return path.join(opts.meta.projectRoot, url); }, /** - * Parses `<pre><code>` tags and adds the __prettyprint__ `className` to them - * @method _parseCode - * @private - * @param {HTML} html The HTML to parse - * @return {HTML} The parsed HTML - */ + * Parses `<pre><code>` tags and adds the __prettyprint__ `className` to them + * @method _parseCode + * @private + * @param {HTML} html The HTML to parse + * @return {HTML} The parsed HTML + */ _parseCode: function (html) { html = html || ''; //html = html.replace(/<pre><code>/g, '<pre class="code"><code class="prettyprint">'); @@ -865,7 +885,7 @@

    File: lib/builder.js

    * @param {HTML} html The HTML to parse * @return {HTML} The parsed HTML */ - _inlineCode: function(html) { + _inlineCode: function (html) { html = html.replace(/\\`/g, '`'); html = html.replace(/`(.+?)`/g, function (match, code) { @@ -888,12 +908,12 @@

    File: lib/builder.js

    * @param {Error} callback.err * @param {HTML} callback.html The assembled template markup */ - render: function(source, view, layout, partials, callback) { + render: function (source, view, layout, partials, callback) { var html = []; - function buffer(line) { - html.push(line); - } + // function buffer(line) { + // html.push(line); + // } // Allow callback as third or fourth param. if (typeof partials === 'function') { @@ -903,8 +923,10 @@

    File: lib/builder.js

    callback = layout; layout = null; } - var parts = Y.merge(partials || {}, { layout_content: source }); - Y.each(parts, function(source, name) { + var parts = Y.merge(partials || {}, { + layout_content: source + }); + Y.each(parts, function (source, name) { Y.Handlebars.registerPartial(name, source); }); @@ -920,27 +942,27 @@

    File: lib/builder.js

    } else { _v[k] = view[k]; } - }; + } html = TEMPLATE(_v); //html = html.replace(/{{&#x2F;/g, '{{/'); - + //html = (Y.Handlebars.compile(html))({}); html = this._inlineCode(html); callback(null, html); }, /** - * Render the index file - * @method renderIndex - * @param {Function} cb The callback fired when complete - * @param {String} cb.html The HTML to render this view - * @param {Object} cv.view The View Data - */ - renderIndex: function(cb) { + * Render the index file + * @method renderIndex + * @param {Function} cb The callback fired when complete + * @param {String} cb.html The HTML to render this view + * @param {Object} cv.view The View Data + */ + renderIndex: function (cb) { var self = this; - Y.prepare([DEFAULT_THEME, themeDir], self.getProjectMeta(), function(err, opts) { + Y.prepare([DEFAULT_THEME, themeDir], self.getProjectMeta(), function (err, opts) { opts.meta.title = self.data.project.name; opts.meta.projectRoot = './'; opts.meta.projectAssets = './assets'; @@ -948,24 +970,24 @@

    File: lib/builder.js

    opts = self.populateClasses(opts); opts = self.populateModules(opts); - var view = new Y.DocView(opts.meta); - self.render('{{>index}}', view, opts.layouts.main, opts.partials, function(err, html) { + var view = new Y.DocView(opts.meta); + self.render('{{>index}}', view, opts.layouts.main, opts.partials, function (err, html) { self.files++; cb(html, view); }); }); }, /** - * Generates the index.html file - * @method writeIndex - * @param {Callback} cb The callback to execute after it's completed - */ - writeIndex: function(cb) { + * Generates the index.html file + * @method writeIndex + * @param {Callback} cb The callback to execute after it's completed + */ + writeIndex: function (cb) { var self = this, stack = new Y.Parallel(); Y.log('Preparing index.html', 'info', 'builder'); - self.renderIndex(stack.add(function(html, view) { + self.renderIndex(stack.add(function (html, view) { stack.html = html; stack.view = view; if (self.options.dumpview) { @@ -974,25 +996,25 @@

    File: lib/builder.js

    Y.Files.writeFile(path.join(self.options.outdir, 'index.html'), html, stack.add(noop)); })); - stack.done(function(html, view) { + stack.done(function ( /* html, view */ ) { Y.log('Writing index.html', 'info', 'builder'); cb(stack.html, stack.view); }); }, /** - * Render a module - * @method renderModule - * @param {Function} cb The callback fired when complete - * @param {String} cb.html The HTML to render this view - * @param {Object} cv.view The View Data - */ - renderModule: function(cb, data, layout) { + * Render a module + * @method renderModule + * @param {Function} cb The callback fired when complete + * @param {String} cb.html The HTML to render this view + * @param {Object} cv.view The View Data + */ + renderModule: function (cb, data, layout) { var self = this; var stack = new Y.Parallel(); data.displayName = data.name; data.name = self.filterFileName(data.name); - Y.prepare([DEFAULT_THEME, themeDir], self.getProjectMeta(), function(err, opts) { + Y.prepare([DEFAULT_THEME, themeDir], self.getProjectMeta(), function (err, opts) { opts.meta = Y.merge(opts.meta, data); //opts.meta.htmlTitle = v.name + ': ' + self.data.project.name; @@ -1012,10 +1034,13 @@

    File: lib/builder.js

    if (data.classes && Object.keys(data.classes).length) { opts.meta.moduleClasses = []; - Y.each(Object.keys(data.classes), function(name) { + Y.each(Object.keys(data.classes), function (name) { var i = self.data.classes[name]; if (i) { - opts.meta.moduleClasses.push({ name: i.name, displayName: i.name }); + opts.meta.moduleClasses.push({ + name: i.name, + displayName: i.name + }); } }); opts.meta.moduleClasses.sort(self.nameSort); @@ -1023,85 +1048,94 @@

    File: lib/builder.js

    if (data.example && data.example.length) { if (data.example.forEach) { var e = ''; - data.example.forEach(function(v) { + data.example.forEach(function (v) { e += self._parseCode(self.markdown(v)); }); data.example = e; } else { - data.example = self._parseCode(self.markdown(i.example)); + data.example = self._parseCode(self.markdown(data.example)); } opts.meta.example = data.example; } if (data.submodules && Object.keys(data.submodules).length) { opts.meta.subModules = []; - Y.each(Object.keys(data.submodules), function(name) { + Y.each(Object.keys(data.submodules), function (name) { var i = self.data.modules[name]; if (i) { - opts.meta.subModules.push({ name: i.name, displayName: i.name, description: i.description }); + opts.meta.subModules.push({ + name: i.name, + displayName: i.name, + description: i.description + }); } }); opts.meta.subModules.sort(self.nameSort); } - var view = new Y.DocView(opts.meta); + var view = new Y.DocView(opts.meta); var mainLayout = opts.layouts[layout]; - self.render('{{>module}}', view, mainLayout, opts.partials, stack.add(function(err, html) { + self.render('{{>module}}', view, mainLayout, opts.partials, stack.add(function (err, html) { self.files++; stack.html = html; stack.view = view; })); }); - stack.done(function() { + stack.done(function () { cb(stack.html, stack.view); }); - }, /** - * Generates the module files under "out"/modules/ - * @method writeModules - * @param {Callback} cb The callback to execute after it's completed - */ - writeModules: function(cb, layout) { + * Generates the module files under "out"/modules/ + * @method writeModules + * @param {Callback} cb The callback to execute after it's completed + */ + writeModules: function (cb, layout) { layout = layout || 'main'; var self = this, stack = new Y.Parallel(); stack.html = []; stack.view = []; - + var counter = 0; - Object.keys(self.data.modules).forEach(function(k) { - if (!self.data.modules[k].external) { - counter++; - } - }); + Object.keys(self.data.modules).forEach(function (k) { + if (!self.data.modules[k].external) { + counter++; + } + }); Y.log('Rendering and writing ' + counter + ' modules pages.', 'info', 'builder'); - Y.each(self.data.modules, function(v) { - if (v.external) { return } - self.renderModule(function(html, view) { + Y.each(self.data.modules, function (v) { + if (v.external) { + return; + } + self.renderModule(function (html, view) { stack.html.push(html); stack.view.push(view); if (self.options.dumpview) { - Y.Files.writeFile(path.join(self.options.outdir, 'json', 'module_' + v.name + '.json'), JSON.stringify(view), stack.add(noop)); + Y.Files.writeFile( + path.join(self.options.outdir, 'json', 'module_' + v.name + '.json'), + JSON.stringify(view), + stack.add(noop) + ); } Y.Files.writeFile(path.join(self.options.outdir, 'modules', v.name + '.html'), html, stack.add(noop)); }, v, layout); }); - stack.done(function() { + stack.done(function () { Y.log('Finished writing module files', 'info', 'builder'); cb(stack.html, stack.view); }); }, /** - * Checks an array of items (class items) to see if an item is in that list - * @method hasProperty - * @param {Array} a The Array of items to check - * @param {Object} b The object to find - * @return Boolean - */ - hasProperty: function(a, b) { + * Checks an array of items (class items) to see if an item is in that list + * @method hasProperty + * @param {Array} a The Array of items to check + * @param {Object} b The object to find + * @return Boolean + */ + hasProperty: function (a, b) { var other = false; - var h = Y.some(a, function(i, k) { + Y.some(a, function (i, k) { if ((i.itemtype === b.itemtype) && (i.name === b.name)) { other = k; return true; @@ -1110,48 +1144,49 @@

    File: lib/builder.js

    return other; }, /** - * Counter for stepping into merges - * @private - * @property _mergeCounter - * @type Number - */ + * Counter for stepping into merges + * @private + * @property _mergeCounter + * @type Number + */ _mergeCounter: null, /** - * Merge superclass data into a child class - * @method mergeExtends - * @param {Object} info The item to extend - * @param {Array} classItems The list of items to merge in - * @param {Boolean} first Set for the first call - */ - mergeExtends: function(info, classItems, first) { + * Merge superclass data into a child class + * @method mergeExtends + * @param {Object} info The item to extend + * @param {Array} classItems The list of items to merge in + * @param {Boolean} first Set for the first call + */ + mergeExtends: function (info, classItems, first) { var self = this; self._mergeCounter = (first) ? 0 : (self._mergeCounter + 1); if (self._mergeCounter === 100) { - throw('YUIDoc detected a loop extending class ' + info.name); + throw ('YUIDoc detected a loop extending class ' + info.name); } if (info.extends || info.uses) { var hasItems = {}; hasItems[info.extends] = 1; if (info.uses) { - info.uses.forEach(function(v) { + info.uses.forEach(function (v) { hasItems[v] = 1; }); } - self.data.classitems.forEach(function(v) { + self.data.classitems.forEach(function (v) { //console.error(v.class, '==', info.extends); if (hasItems[v.class]) { if (!v.static) { - var override = self.hasProperty(classItems, v); + var q, + override = self.hasProperty(classItems, v); if (override === false) { //This method was extended from the parent class but not over written //console.error('Merging extends from', v.class, 'onto', info.name); - var q = Y.merge({}, v); + q = Y.merge({}, v); q.extended_from = v.class; classItems.push(q); } else { //This method was extended from the parent and overwritten in this class - var q = Y.merge({}, v); + q = Y.merge({}, v); q = self.augmentData(q); classItems[override].overwritten_from = q; } @@ -1168,17 +1203,17 @@

    File: lib/builder.js

    return classItems; }, /** - * Render the class file - * @method renderClass - * @param {Function} cb The callback fired when complete - * @param {String} cb.html The HTML to render this view - * @param {Object} cv.view The View Data - */ - renderClass: function(cb, data, layout) { + * Render the class file + * @method renderClass + * @param {Function} cb The callback fired when complete + * @param {String} cb.html The HTML to render this view + * @param {Object} cv.view The View Data + */ + renderClass: function (cb, data, layout) { var self = this; var stack = new Y.Parallel(); - Y.prepare([DEFAULT_THEME, themeDir], self.getProjectMeta(), function(err, opts) { + Y.prepare([DEFAULT_THEME, themeDir], self.getProjectMeta(), function (err, opts) { //console.log(opts); if (err) { console.log(err); @@ -1217,7 +1252,7 @@

    File: lib/builder.js

    } var classItems = []; - self.data.classitems.forEach(function(i) { + self.data.classitems.forEach(function (i) { if (i.class === data.name) { classItems.push(i); } @@ -1230,10 +1265,10 @@

    File: lib/builder.js

    i = self.augmentData(i); i.paramsList = []; if (i.params) { - i.params.forEach(function(p, v) { + i.params.forEach(function (p) { var name = p.name; if (p.optional) { - name = '[' + name + ((p.optdefault) ? '=' + p.optdefault : '') + ']' + name = '[' + name + ((p.optdefault) ? '=' + p.optdefault : '') + ']'; } i.paramsList.push(name); }); @@ -1247,16 +1282,16 @@

    File: lib/builder.js

    i.paramsList = ' '; } i.returnType = ' '; - if (i.return) { + if (i["return"]) { i.hasReturn = true; - i.returnType = i.return.type; + i.returnType = i["return"].type; } //console.error(i); opts.meta.is_constructor = [i]; if (i.example && i.example.length) { if (i.example.forEach) { var e = ''; - i.example.forEach(function(v) { + i.example.forEach(function (v) { e += self._parseCode(self.markdown(v)); }); i.example = e; @@ -1266,157 +1301,158 @@

    File: lib/builder.js

    } } - classItems.forEach(function(i) { + classItems.forEach(function (i) { + var e; switch (i.itemtype) { - case 'method': - i = self.augmentData(i); - i.paramsList = []; - if (i.params && i.params.forEach) { - i.params.forEach(function(p, v) { - var name = p.name; - if (p.optional) { - name = '[' + name + ((p.optdefault) ? '=' + p.optdefault : '') + ']' - } - i.paramsList.push(name); - }); - } - //i.methodDescription = self._parseCode(markdown(i.description || '')); - i.methodDescription = self._parseCode(i.description); - if (i.example && i.example.length) { - if (i.example.forEach) { - var e = ''; - i.example.forEach(function(v) { - e += self._parseCode(self.markdown(v)); - }); - i.example = e; - } else { - i.example = self._parseCode(self.markdown(i.example)); + case 'method': + i = self.augmentData(i); + i.paramsList = []; + if (i.params && i.params.forEach) { + i.params.forEach(function (p) { + var name = p.name; + if (p.optional) { + name = '[' + name + ((p.optdefault) ? '=' + p.optdefault : '') + ']'; } - } - i.hasAccessType = i.access; - i.hasParams = i.paramsList.length; - if (i.paramsList.length) { - i.paramsList = i.paramsList.join(', '); + i.paramsList.push(name); + }); + } + //i.methodDescription = self._parseCode(markdown(i.description || '')); + i.methodDescription = self._parseCode(i.description); + if (i.example && i.example.length) { + if (i.example.forEach) { + e = ''; + i.example.forEach(function (v) { + e += self._parseCode(self.markdown(v)); + }); + i.example = e; } else { - i.paramsList = ' '; - } - i.returnType = ' '; - if (i.return) { - i.hasReturn = true; - i.returnType = i.return.type; + i.example = self._parseCode(self.markdown(i.example)); } + } + i.hasAccessType = i.access; + i.hasParams = i.paramsList.length; + if (i.paramsList.length) { + i.paramsList = i.paramsList.join(', '); + } else { + i.paramsList = ' '; + } + i.returnType = ' '; + if (i["return"]) { + i.hasReturn = true; + i.returnType = i["return"].type; + } - // If this item is provided by a module other - // than the module that provided the original - // class, add the original module name to the - // item's `providedBy` property so we can - // indicate the relationship. - if ((i.submodule || i.module) !== (data.submodule || data.module)) { - i.providedBy = (i.submodule || i.module); - } + // If this item is provided by a module other + // than the module that provided the original + // class, add the original module name to the + // item's `providedBy` property so we can + // indicate the relationship. + if ((i.submodule || i.module) !== (data.submodule || data.module)) { + i.providedBy = (i.submodule || i.module); + } - opts.meta.methods.push(i); - break; - case 'property': - i = self.augmentData(i); - //i.propertyDescription = self._parseCode(markdown(i.description || '')); - i.propertyDescription = self._parseCode(i.description); - if (!i.type) { - i.type = 'unknown'; - } - if (i.final === '') { - i.final = true; - } - if (i.example && i.example.length) { - if (i.example.forEach) { - var e = ''; - i.example.forEach(function(v) { - e += self._parseCode(self.markdown(v)); - }); - i.example = e; - } else { - i.example = self._parseCode(self.markdown(i.example)); - } + opts.meta.methods.push(i); + break; + case 'property': + i = self.augmentData(i); + //i.propertyDescription = self._parseCode(markdown(i.description || '')); + i.propertyDescription = self._parseCode(i.description); + if (!i.type) { + i.type = 'unknown'; + } + if (i.final === '') { + i.final = true; + } + if (i.example && i.example.length) { + if (i.example.forEach) { + e = ''; + i.example.forEach(function (v) { + e += self._parseCode(self.markdown(v)); + }); + i.example = e; + } else { + i.example = self._parseCode(self.markdown(i.example)); } + } - // If this item is provided by a module other - // than the module that provided the original - // class, add the original module name to the - // item's `providedBy` property so we can - // indicate the relationship. - if ((i.submodule || i.module) !== (data.submodule || data.module)) { - i.providedBy = (i.submodule || i.module); - } + // If this item is provided by a module other + // than the module that provided the original + // class, add the original module name to the + // item's `providedBy` property so we can + // indicate the relationship. + if ((i.submodule || i.module) !== (data.submodule || data.module)) { + i.providedBy = (i.submodule || i.module); + } - opts.meta.properties.push(i); - break; + opts.meta.properties.push(i); + break; - case 'attribute': // fallthru - case 'config': - i = self.augmentData(i); - //i.attrDescription = self._parseCode(markdown(i.description || '')); - i.attrDescription = self._parseCode(i.description); + case 'attribute': // fallthru + case 'config': + i = self.augmentData(i); + //i.attrDescription = self._parseCode(markdown(i.description || '')); + i.attrDescription = self._parseCode(i.description); - if (i.itemtype === 'config') { - i.config = true; - } else { - i.emit = self.options.attributesEmit; - } - if (i.readonly === '') { - i.readonly = true; - } + if (i.itemtype === 'config') { + i.config = true; + } else { + i.emit = self.options.attributesEmit; + } + if (i.readonly === '') { + i.readonly = true; + } - if (i.example && i.example.length) { - if (i.example.forEach) { - var e = ''; - i.example.forEach(function(v) { - e += self._parseCode(self.markdown(v)); - }); - i.example = e; - } else { - i.example = self._parseCode(self.markdown(i.example)); - } + if (i.example && i.example.length) { + if (i.example.forEach) { + e = ''; + i.example.forEach(function (v) { + e += self._parseCode(self.markdown(v)); + }); + i.example = e; + } else { + i.example = self._parseCode(self.markdown(i.example)); } + } - // If this item is provided by a module other - // than the module that provided the original - // class, add the original module name to the - // item's `providedBy` property so we can - // indicate the relationship. - if ((i.submodule || i.module) !== (data.submodule || data.module)) { - i.providedBy = (i.submodule || i.module); - } + // If this item is provided by a module other + // than the module that provided the original + // class, add the original module name to the + // item's `providedBy` property so we can + // indicate the relationship. + if ((i.submodule || i.module) !== (data.submodule || data.module)) { + i.providedBy = (i.submodule || i.module); + } - opts.meta.attrs.push(i); - break; - case 'event': - i = self.augmentData(i); - //i.eventDescription = self._parseCode(markdown(i.description || '')); - i.eventDescription = self._parseCode(i.description); - - if (i.example && i.example.length) { - if (i.example.forEach) { - var e = ''; - i.example.forEach(function(v) { - e += self._parseCode(self.markdown(v)); - }); - i.example = e; - } else { - i.example = self._parseCode(self.markdown(i.example)); - } + opts.meta.attrs.push(i); + break; + case 'event': + i = self.augmentData(i); + //i.eventDescription = self._parseCode(markdown(i.description || '')); + i.eventDescription = self._parseCode(i.description); + + if (i.example && i.example.length) { + if (i.example.forEach) { + e = ''; + i.example.forEach(function (v) { + e += self._parseCode(self.markdown(v)); + }); + i.example = e; + } else { + i.example = self._parseCode(self.markdown(i.example)); } + } - // If this item is provided by a module other - // than the module that provided the original - // class, add the original module name to the - // item's `providedBy` property so we can - // indicate the relationship. - if ((i.submodule || i.module) !== (data.submodule || data.module)) { - i.providedBy = (i.submodule || i.module); - } + // If this item is provided by a module other + // than the module that provided the original + // class, add the original module name to the + // item's `providedBy` property so we can + // indicate the relationship. + if ((i.submodule || i.module) !== (data.submodule || data.module)) { + i.providedBy = (i.submodule || i.module); + } - opts.meta.events.push(i); - break; + opts.meta.events.push(i); + break; } }); @@ -1438,9 +1474,9 @@

    File: lib/builder.js

    delete opts.meta.events; } - var view = new Y.DocView(opts.meta); + var view = new Y.DocView(opts.meta); var mainLayout = opts.layouts[layout]; - self.render('{{>classes}}', view, mainLayout, opts.partials, stack.add(function(err, html) { + self.render('{{>classes}}', view, mainLayout, opts.partials, stack.add(function (err, html) { self.files++; stack.html = html; stack.view = view; @@ -1448,16 +1484,16 @@

    File: lib/builder.js

    })); }); - stack.done(function() { + stack.done(function () { cb(stack.html, stack.view, stack.opts); }); }, /** - * Generates the class files under "out"/classes/ - * @method writeClasses - * @param {Callback} cb The callback to execute after it's completed - */ - writeClasses: function(cb, layout) { + * Generates the class files under "out"/classes/ + * @method writeClasses + * @param {Callback} cb The callback to execute after it's completed + */ + writeClasses: function (cb, layout) { layout = layout || 'main'; var self = this, stack = new Y.Parallel(); @@ -1465,36 +1501,42 @@

    File: lib/builder.js

    stack.view = []; var counter = 0; - Object.keys(self.data.classes).forEach(function(k) { - if (!self.data.classes[k].external) { - counter++; - } - }); + Object.keys(self.data.classes).forEach(function (k) { + if (!self.data.classes[k].external) { + counter++; + } + }); Y.log('Rendering and writing ' + counter + ' class pages.', 'info', 'builder'); - Y.each(self.data.classes, function(v) { - if (v.external) { return } - self.renderClass(stack.add(function(html, view) { + Y.each(self.data.classes, function (v) { + if (v.external) { + return; + } + self.renderClass(stack.add(function (html, view) { stack.html.push(html); stack.view.push(view); if (self.options.dumpview) { - Y.Files.writeFile(path.join(self.options.outdir, 'json', 'classes_' + v.name + '.json'), JSON.stringify(view), stack.add(noop)); + Y.Files.writeFile( + path.join(self.options.outdir, 'json', 'classes_' + v.name + '.json'), + JSON.stringify(view), + stack.add(noop) + ); } Y.Files.writeFile(path.join(self.options.outdir, 'classes', v.name + '.html'), html, stack.add(noop)); }), v, layout); }); - stack.done(function() { + stack.done(function () { Y.log('Finished writing class files', 'info', 'builder'); cb(stack.html, stack.view); }); }, /** - * Sort method of array of objects with a property called __name__ - * @method nameSort - * @param {Object} a First object to compare - * @param {Object} b Second object to compare - * @return {Number} 1, -1 or 0 for sorting. - */ - nameSort: function(a, b) { + * Sort method of array of objects with a property called __name__ + * @method nameSort + * @param {Object} a First object to compare + * @param {Object} b Second object to compare + * @return {Number} 1, -1 or 0 for sorting. + */ + nameSort: function (a, b) { if (!a.name || !b.name) { return 0; } @@ -1506,16 +1548,16 @@

    File: lib/builder.js

    ret = -1; } if (an > bn) { - ret = 1 + ret = 1; } return ret; }, /** - * Generates the syntax files under `"out"/files/` - * @method writeFiles - * @param {Callback} cb The callback to execute after it's completed - */ - writeFiles: function(cb, layout) { + * Generates the syntax files under `"out"/files/` + * @method writeFiles + * @param {Callback} cb The callback to execute after it's completed + */ + writeFiles: function (cb, layout) { layout = layout || 'main'; var self = this, stack = new Y.Parallel(); @@ -1523,42 +1565,52 @@

    File: lib/builder.js

    stack.view = []; var counter = 0; - Object.keys(self.data.files).forEach(function(k) { - if (!self.data.files[k].external) { - counter++; - } - }); + Object.keys(self.data.files).forEach(function (k) { + if (!self.data.files[k].external) { + counter++; + } + }); Y.log('Rendering and writing ' + counter + ' source files.', 'info', 'builder'); - Y.each(self.data.files, function(v) { - if (v.external) { return } - self.renderFile(stack.add(function(html, view, data) { + Y.each(self.data.files, function (v) { + if (v.external) { + return; + } + self.renderFile(stack.add(function (html, view, data) { if (!view || !data) { return; } stack.html.push(html); stack.view.push(view); if (self.options.dumpview) { - Y.Files.writeFile(path.join(self.options.outdir, 'json', 'files_' + self.filterFileName(data.name) + '.json'), JSON.stringify(view), stack.add(noop)); + Y.Files.writeFile( + path.join(self.options.outdir, 'json', 'files_' + self.filterFileName(data.name) + '.json'), + JSON.stringify(view), + stack.add(noop) + ); } - Y.Files.writeFile(path.join(self.options.outdir, 'files', self.filterFileName(data.name) + '.html'), html, stack.add(noop)); + Y.Files.writeFile( + path.join(self.options.outdir, 'files', self.filterFileName(data.name) + '.html'), + html, + stack.add(noop) + ); }), v, layout); }); - stack.done(function() { + stack.done(function () { Y.log('Finished writing source files', 'info', 'builder'); cb(stack.html, stack.view); }); }, /** - * Render the source file - * @method renderFile - * @param {Function} cb The callback fired when complete - * @param {String} cb.html The HTML to render this view - * @param {Object} cv.view The View Data - */ - renderFile: function(cb, data, layout) { + * Render the source file + * @method renderFile + * @param {Function} cb The callback fired when complete + * @param {String} cb.html The HTML to render this view + * @param {Object} cv.view The View Data + */ + renderFile: function (cb, data, layout) { var self = this; - - Y.prepare([DEFAULT_THEME, themeDir], self.getProjectMeta(), function(err, opts) { + + Y.prepare([DEFAULT_THEME, themeDir], self.getProjectMeta(), function (err, opts) { if (err) { console.log(err); } @@ -1579,7 +1631,7 @@

    File: lib/builder.js

    opts = self.populateFiles(opts); opts.meta.fileName = data.name; - fs.readFile(opts.meta.fileName, Y.charset, Y.rbind(function(err, str, opts, data) { + fs.readFile(opts.meta.fileName, Y.charset, Y.rbind(function (err, str, opts, data) { if (err) { Y.log(err, 'error', 'builder'); cb(err); @@ -1589,11 +1641,11 @@

    File: lib/builder.js

    if (typeof self.options.tabspace === 'string') { str = str.replace(/\t/g, self.options.tabspace); } - + opts.meta.fileData = str; var view = new Y.DocView(opts.meta, 'index'); var mainLayout = opts.layouts[layout]; - self.render('{{>files}}', view, mainLayout, opts.partials, function(err, html) { + self.render('{{>files}}', view, mainLayout, opts.partials, function (err, html) { self.files++; cb(html, view, data); }); @@ -1603,42 +1655,44 @@

    File: lib/builder.js

    }, /** - * Write the API meta data used for the AutoComplete widget - * @method writeAPIMeta - * @param {Callback} cb The callback to execute when complete - * @async - */ - writeAPIMeta: function(cb) { + * Write the API meta data used for the AutoComplete widget + * @method writeAPIMeta + * @param {Callback} cb The callback to execute when complete + * @async + */ + writeAPIMeta: function (cb) { Y.log('Writing API Meta Data', 'info', 'builder'); var self = this; - this.renderAPIMeta(function(js) { + this.renderAPIMeta(function (js) { fs.writeFile(path.join(self.options.outdir, 'api.js'), js, Y.charset, cb); }); }, /** - * Render the API meta and return the Javascript - * @method renderAPIMeta - * @param {Callback} cb The callback - * @async - */ - renderAPIMeta: function(cb) { - - var opts = { meta: {} }, self = this; + * Render the API meta and return the Javascript + * @method renderAPIMeta + * @param {Callback} cb The callback + * @async + */ + renderAPIMeta: function (cb) { + + var opts = { + meta: {} + }; opts = this.populateClasses(opts); opts = this.populateModules(opts); - ['classes', 'modules'].forEach(function(id) { - opts.meta[id].forEach(function(v, k) { + ['classes', 'modules'].forEach(function (id) { + opts.meta[id].forEach(function (v, k) { opts.meta[id][k] = v.name; if (v.submodules) { - v.submodules.forEach(function(s) { + v.submodules.forEach(function (s) { opts.meta[id].push(s.displayName); }); } }); opts.meta[id].sort(); }); - + var apijs = 'YUI.add("yuidoc-meta", function(Y) {\n' + ' Y.YUIDoc = { meta: ' + JSON.stringify(opts.meta, null, 4) + ' };\n' + '});'; @@ -1646,65 +1700,73 @@

    File: lib/builder.js

    cb(apijs); }, /** - * Normalizes a file path to a writable filename: - * - * var path = 'lib/file.js'; - * returns 'lib_file.js'; - * - * @method filterFileName - * @param {String} f The filename to normalize - * @return {String} The filtered file path - */ - filterFileName: function(f) { + * Normalizes a file path to a writable filename: + * + * var path = 'lib/file.js'; + * returns 'lib_file.js'; + * + * @method filterFileName + * @param {String} f The filename to normalize + * @return {String} The filtered file path + */ + filterFileName: function (f) { return f.replace(/[\/\\]/g, '_'); }, /** - * Compiles the templates from the meta-data provided by DocParser - * @method compile - * @param {Callback} cb The callback to execute after it's completed - */ - compile: function(cb) { + * Compiles the templates from the meta-data provided by DocParser + * @method compile + * @param {Callback} cb The callback to execute after it's completed + */ + compile: function (cb) { var self = this; var starttime = (new Date()).getTime(); Y.log('Compiling Templates', 'info', 'builder'); - this.mixExternal(function() { - self.makeDirs(function() { + this.mixExternal(function () { + self.makeDirs(function () { Y.log('Copying Assets', 'info', 'builder'); if (!Y.Files.isDirectory(path.join(self.options.outdir, 'assets'))) { fs.mkdirSync(path.join(self.options.outdir, 'assets'), 0777); } - Y.Files.copyAssets([path.join(DEFAULT_THEME, 'assets'), path.join(themeDir, 'assets')], path.join(self.options.outdir, 'assets'), false, function() { - var cstack = new Y.Parallel(); - - self.writeModules(cstack.add(function() { - self.writeClasses(cstack.add(function() { - if (!self.options.nocode) { - self.writeFiles(cstack.add(noop)); - } + Y.Files.copyAssets([ + path.join(DEFAULT_THEME, 'assets'), + path.join(themeDir, 'assets') + ], + path.join(self.options.outdir, 'assets'), + false, + function () { + var cstack = new Y.Parallel(); + + self.writeModules(cstack.add(function () { + self.writeClasses(cstack.add(function () { + if (!self.options.nocode) { + self.writeFiles(cstack.add(noop)); + } + })); })); - })); - /* + /* self.writeModules(cstack.add(noop)); self.writeClasses(cstack.add(noop)); if (!self.options.nocode) { self.writeFiles(cstack.add(noop)); } */ - self.writeIndex(cstack.add(noop)); - self.writeAPIMeta(cstack.add(noop)); - - cstack.done(function() { - var endtime = (new Date()).getTime(); - var timer = ((endtime - starttime) / 1000) + ' seconds'; - Y.log('Finished writing ' + self.files + ' files in ' + timer, 'info', 'builder'); - if (cb) { cb(); } + self.writeIndex(cstack.add(noop)); + self.writeAPIMeta(cstack.add(noop)); + + cstack.done(function () { + var endtime = (new Date()).getTime(); + var timer = ((endtime - starttime) / 1000) + ' seconds'; + Y.log('Finished writing ' + self.files + ' files in ' + timer, 'info', 'builder'); + if (cb) { + cb(); + } + }); }); - }); }); }); } - } + }; }); diff --git a/output/api/files/lib_cli.js.html b/output/api/files/lib_cli.js.html index b63d374c..184ccac8 100644 --- a/output/api/files/lib_cli.js.html +++ b/output/api/files/lib_cli.js.html @@ -19,7 +19,7 @@

    - API Docs for: 0.3.47 + API Docs for: 0.3.49
    @@ -109,6 +109,7 @@

    File: lib/cli.js

     #!/usr/bin/env node
    +
     /*
     Copyright (c) 2011, Yahoo! Inc. All rights reserved.
     Code licensed under the BSD License:
    @@ -116,19 +117,19 @@ 

    File: lib/cli.js

    */ /** -* Parses the arguments, creates the options and passes them to `Y.YUIDoc` and then `Y.DocBuilder`. -* @class CLI -* @module yuidoc -*/ + * Parses the arguments, creates the options and passes them to `Y.YUIDoc` and then `Y.DocBuilder`. + * @class CLI + * @module yuidoc + */ -var Y = require('./index'), - path = require('path'); +/*global Y:true */ +var Y = require('./index'); var options = Y.Options(Y.Array(process.argv, 2)); Y.log('Starting YUIDoc@' + Y.packageInfo.version + ' using YUI@' + Y.version + ' with NodeJS@' + process.versions.node, 'info', 'yuidoc'); -var starttime = (new Date).getTime(); +var starttime = (new Date()).getTime(); options = Y.Project.init(options); @@ -142,7 +143,6 @@

    File: lib/cli.js

    if (options.server) { Y.Server.start(options); } else { - var json = (new Y.YUIDoc(options)).run(); if (json === null) { return; @@ -151,9 +151,9 @@

    File: lib/cli.js

    if (!options.parseOnly) { var builder = new Y.DocBuilder(options, json); - builder.compile(function() { - var endtime = (new Date).getTime(); - Y.log('Completed in ' + ((endtime - starttime) / 1000) + ' seconds' , 'info', 'yuidoc'); + builder.compile(function () { + var endtime = (new Date()).getTime(); + Y.log('Completed in ' + ((endtime - starttime) / 1000) + ' seconds', 'info', 'yuidoc'); }); } } diff --git a/output/api/files/lib_docparser.js.html b/output/api/files/lib_docparser.js.html index f5ba5680..34eec4fe 100644 --- a/output/api/files/lib_docparser.js.html +++ b/output/api/files/lib_docparser.js.html @@ -19,7 +19,7 @@

    - API Docs for: 0.3.47 + API Docs for: 0.3.49
    @@ -113,737 +113,742 @@

    File: lib/docparser.js

    Code licensed under the BSD License: http://yuilibrary.com/license/ */ -YUI.add('docparser', function(Y) { +YUI.add('docparser', function (Y) { var Lang = Y.Lang, - trim = Lang.trim, - stringify = Y.JSON.stringify, - fixType = Y.Lang.fixType, - /** - * Parses the JSON data and formats it into a nice log string for filename and line number: - `/file/name.js:123` - * @method stringlog - * @private - * @param {Object} data The data block from the parser - * @return {String} The formatted string. - * @for DocParser - */ - stringlog = function(data) { - var line, file; - - if (data.file && data.line) { - file = data.file; - line = data.line; - } else { - data.forEach(function(d) { - if (d.tag === 'file') { - file = d.value; - } - if (d.tag === 'line') { - line = d.value; - } - }); - } - return ' ' + file + ':' + line; - }, - /* - * Flatted a string, remove all line breaks and replace them with a token - * @method implodeString - * @private - * @param {String} str The string to operate on - * @return {String} The modified string - */ - implodeString = function(str) { - return str.replace(REGEX_GLOBAL_LINES, '!~YUIDOC_LINE~!'); - }, - /* - * Un-flatted a string, replace tokens injected with `implodeString` - * @method implodeString - * @private - * @param {String} str The string to operate on - * @return {String} The modified string - */ - explodeString = function(str) { - return str.replace(/!~YUIDOC_LINE~!/g, '\n'); - }, - CURRENT_NAMESPACE = 'currentnamespace', - CURRENT_MODULE = 'currentmodule', - MAIN_MODULE = 'mainmodule', - CURRENT_SUBMODULE = 'currentsubmodule', - CURRENT_FILE = 'currentfile', - CURRENT_CLASS = 'currentclass', - - REGEX_TYPE = /(.*?)\{(.*?)\}(.*)/, - REGEX_FIRSTWORD = /^\s*?([^\s]+)(.*)/, - REGEX_OPTIONAL = /\[(.*?)\]/, - REGEX_START_COMMENT = { - js: /^\s*\/\*\*/, - coffee: /^\s*###\*/ - }, - REGEX_END_COMMENT = { - js: /\*\/\s*$/, - coffee: /###\s*$/ - }, - REGEX_LINE_HEAD_CHAR = { - js: /^\s*\*/, - coffee: /^\s*#/ - }, - REGEX_LINES = /\r\n|\n/, - REGEX_GLOBAL_LINES = /\r\n|\n/g, - - SHORT_TAGS = { - 'async': 1, - 'beta': 1, - 'chainable': 1, - 'extends': 1, - 'final': 1, - 'static': 1, - 'optional': 1, - 'required': 1 - }, - - /** - * A list of known tags. This populates a member variable - * during initialization, and will be updated if additional - * digesters are added. - * @property TAGLIST - * @type Array - * @final - * @for DocParser - */ - TAGLIST = [ - "async", // bool, custom events can fire the listeners in a setTimeout - "author", // author best for projects and modules, but can be used anywhere // multi - "attribute", // YUI attributes -- get/set with change notification, etc - "beta", // module maturity identifier - "broadcast", // bool, events - "bubbles", // custom events that bubble - "category", // modules can be in multiple categories - "chainable", // methods that return the host object - "class", // pseudo class - "conditional", // conditional module - "config", // a config param (not an attribute, so no change events) - "const", // not standardized yet, converts to final property - "constructs", // factory methods (not yet used) - "constructor", // this is a constructor - "contributor", // like author - "default", // property/attribute default value - "deprecated", // please specify what to use instead - "description", // can also be free text at the beginning of a comment is - "emitfacade", // bool, YUI custom event can have a dom-like event facade - "event", // YUI custom event - "evil", // uses eval - "extension", // this is an extension for [entity] - "extensionfor", // this is an extension for [entity] - "extension_for", // this is an extension for [entity] - "example", // 0..n code snippets. snippets can also be embedded in the desc - "experimental", // module maturity identifier - "extends", // pseudo inheritance - "file", // file name (used by the parser) - "final", // not meant to be changed - "fireonce", // bool, YUI custom event config allows - "for", // used to change class context - "global", // declare your globals - "icon", // project icon(s) - "in", // indicates module this lives in (obsolete now) - "initonly", // attribute writeonce value - "injects", // injects {HTML|script|CSS} - "knownissue", // 0..n known issues for your consumption - "line", // line number for the comment block (used by the parser) - "method", // a method - "module", // YUI module name - "main", // Description for the module - "namespace", // Y.namespace, used to fully qualify class names - "optional", // For optional attributes - "required", // For required attributes - "param", // member param - "plugin", // this is a plugin for [entityl] - "preventable", // YUI custom events can be preventable ala DOM events - "private", // > access - "project", // project definition, one per source tree allowed - "property", // a regular-ole property - "protected", // > access - "public", // > access - "queuable", // bool, events - "readonly", // YUI attribute config - "requires", // YUI module requirements - "return", // {type} return desc -- returns is converted to this - "see", // 0..n things to look at - "since", // when it was introduced - "static", // static - "submodule", // YUI submodule - "throws", // {execption type} description - "title", // this should be something for the project description - "todo", // 0..n things to revisit eventually (hopefully) - "type", // the var type - "url", // project url(s) - "uses", // 0..n compents mixed (usually, via augment) into the prototype - "value", // the value of a constant - "writeonce" // YUI attribute config - ], - - /** - * Common errors will get scrubbed instead of being ignored. - * @property CORRECTIONS - * @type Object - * @final - * @for DocParser - */ - CORRECTIONS = { - 'augments': 'uses', // YUI convention for prototype mixins - 'depreciated': 'deprecated', // subtle difference - 'desciption': 'description', // shouldn't need the @description tag at all - 'extend': 'extends', // typo - 'function': 'method', // we may want standalone inner functions at some point - 'member': 'method', // probably meant method - 'parm': 'param', // typo - 'params': 'param', // typo - 'pamra': 'param', // typo - 'parma': 'param', // typo - 'propery': 'property', // typo - 'prop': 'property', // probably meant property - 'returns': 'return' // need to standardize on one or the other - }, - - /** - * A map of the default tag processors, keyed by the - * tag name. Multiple tags can use the same digester - * by supplying the string name that points to the - * implementation rather than a function. - * @property DIGESTERS - * @type Object - * @final - * @for DocParser - */ - DIGESTERS = { - - // "params": [ - // { - // "name": "optionalandmultiple", - // "description": "my desc", - // "type": "string", - // "optional": true, // [surroundedbybrackets] - // "optdefault": "if specified, this is always string to avoid syntax errors @TODO", - // "multiple": true // endswith* - // } - // ], - // @param {type} name description -or- - // @param name {type} description - // #2173362 optional w/ or w/o default - // @param {type} [optvar=default] description - // #12 document config objects - // @param {object|config} config description - // @param {type} config.prop1 description - // @param {type} config.prop2 description - // #11 document callback argument signature - // @param {callback|function} callback description - // @param {type} callback.arg1 description - // @param {type} callback.arg2 description - // #2173362 document event facade decorations for custom events - // @param {event} event description - // @param {type} event.child description - // @param {type} event.index description - // @param name* {type} 1..n description - // @param [name]* {type} 0..n description - 'param': function(tagname, value, target, block) { - // Y.log('param digester' + value); - target.params = target.params || []; - - if (!value) { - this.warnings.push({ - message: 'param name/type/descript missing', - line: stringlog(block) + trim = Lang.trim, + fixType = Y.Lang.fixType, + /** + * Parses the JSON data and formats it into a nice log string for + * filename and line number: `/file/name.js:123` + * @method stringlog + * @private + * @param {Object} data The data block from the parser + * @return {String} The formatted string. + * @for DocParser + */ + stringlog = function (data) { + var line, file; + + if (data.file && data.line) { + file = data.file; + line = data.line; + } else { + data.forEach(function (d) { + if (d.tag === 'file') { + file = d.value; + } + if (d.tag === 'line') { + line = d.value; + } }); - Y.log('param name/type/descript missing: ' + stringlog(block), 'warn', 'docparser'); - return; } + return ' ' + file + ':' + line; + }, + /** + * Flatten a string, remove all line breaks and replace them with a token + * @method implodeString + * @private + * @param {String} str The string to operate on + * @return {String} The modified string + */ + implodeString = function (str) { + return str.replace(REGEX_GLOBAL_LINES, '!~YUIDOC_LINE~!'); + }, + /** + * Un-flatten a string, replace tokens injected with `implodeString` + * @method implodeString + * @private + * @param {String} str The string to operate on + * @return {String} The modified string + */ + explodeString = function (str) { + return str.replace(/!~YUIDOC_LINE~!/g, '\n'); + }, + CURRENT_NAMESPACE = 'currentnamespace', + CURRENT_MODULE = 'currentmodule', + MAIN_MODULE = 'mainmodule', + CURRENT_SUBMODULE = 'currentsubmodule', + CURRENT_FILE = 'currentfile', + CURRENT_CLASS = 'currentclass', + + REGEX_TYPE = /(.*?)\{(.*?)\}(.*)/, + REGEX_FIRSTWORD = /^\s*?([^\s]+)(.*)/, + REGEX_OPTIONAL = /\[(.*?)\]/, + REGEX_START_COMMENT = { + js: /^\s*\/\*\*/, + coffee: /^\s*###\*/ + }, + REGEX_END_COMMENT = { + js: /\*\/\s*$/, + coffee: /###\s*$/ + }, + REGEX_LINE_HEAD_CHAR = { + js: /^\s*\*/, + coffee: /^\s*#/ + }, + REGEX_LINES = /\r\n|\n/, + REGEX_GLOBAL_LINES = /\r\n|\n/g, + + SHORT_TAGS = { + 'async': 1, + 'beta': 1, + 'chainable': 1, + 'extends': 1, + 'final': 1, + 'static': 1, + 'optional': 1, + 'required': 1 + }, - var type, name, optional, optdefault, parent, multiple, len, - desc = implodeString(trim(value)), - match = REGEX_TYPE.exec(desc), - host = target.params; - - // Extract {type} - if (match) { - type = fixType(trim(match[2])); - desc = trim(match[1] + match[3]); - } + /** + * A list of known tags. This populates a member variable + * during initialization, and will be updated if additional + * digesters are added. + * @property TAGLIST + * @type Array + * @final + * @for DocParser + */ + TAGLIST = [ + "async", // bool, custom events can fire the listeners in a setTimeout + "author", // author best for projects and modules, but can be used anywhere // multi + "attribute", // YUI attributes -- get/set with change notification, etc + "beta", // module maturity identifier + "broadcast", // bool, events + "bubbles", // custom events that bubble + "category", // modules can be in multiple categories + "chainable", // methods that return the host object + "class", // pseudo class + "conditional", // conditional module + "config", // a config param (not an attribute, so no change events) + "const", // not standardized yet, converts to final property + "constructs", // factory methods (not yet used) + "constructor", // this is a constructor + "contributor", // like author + "default", // property/attribute default value + "deprecated", // please specify what to use instead + "description", // can also be free text at the beginning of a comment is + "emitfacade", // bool, YUI custom event can have a dom-like event facade + "event", // YUI custom event + "evil", // uses eval + "extension", // this is an extension for [entity] + "extensionfor", // this is an extension for [entity] + "extension_for",// this is an extension for [entity] + "example", // 0..n code snippets. snippets can also be embedded in the desc + "experimental", // module maturity identifier + "extends", // pseudo inheritance + "file", // file name (used by the parser) + "final", // not meant to be changed + "fireonce", // bool, YUI custom event config allows + "for", // used to change class context + "global", // declare your globals + "icon", // project icon(s) + "in", // indicates module this lives in (obsolete now) + "initonly", // attribute writeonce value + "injects", // injects {HTML|script|CSS} + "knownissue", // 0..n known issues for your consumption + "line", // line number for the comment block (used by the parser) + "method", // a method + "module", // YUI module name + "main", // Description for the module + "namespace", // Y.namespace, used to fully qualify class names + "optional", // For optional attributes + "required", // For required attributes + "param", // member param + "plugin", // this is a plugin for [entityl] + "preventable", // YUI custom events can be preventable ala DOM events + "private", // > access + "project", // project definition, one per source tree allowed + "property", // a regular-ole property + "protected", // > access + "public", // > access + "queuable", // bool, events + "readonly", // YUI attribute config + "requires", // YUI module requirements + "return", // {type} return desc -- returns is converted to this + "see", // 0..n things to look at + "since", // when it was introduced + "static", // static + "submodule", // YUI submodule + "throws", // {execption type} description + "title", // this should be something for the project description + "todo", // 0..n things to revisit eventually (hopefully) + "type", // the var type + "url", // project url(s) + "uses", // 0..n compents mixed (usually, via augment) into the prototype + "value", // the value of a constant + "writeonce" // YUI attribute config + ], - // extract the first word, this is the param name - match = REGEX_FIRSTWORD.exec(desc); - if (match) { - name = trim(match[1]); - desc = trim(match[2]); - } + /** + * Common errors will get scrubbed instead of being ignored. + * @property CORRECTIONS + * @type Object + * @final + * @for DocParser + */ + CORRECTIONS = { + 'augments': 'uses', // YUI convention for prototype mixins + 'depreciated': 'deprecated', // subtle difference + 'desciption': 'description', // shouldn't need the @description tag at all + 'extend': 'extends', // typo + 'function': 'method', // we may want standalone inner functions at some point + 'member': 'method', // probably meant method + 'parm': 'param', // typo + 'params': 'param', // typo + 'pamra': 'param', // typo + 'parma': 'param', // typo + 'propery': 'property', // typo + 'prop': 'property', // probably meant property + 'returns': 'return' // need to standardize on one or the other + }, - if (!name) { - if (value && value.match(/callback/i)) { - this.warnings.push({ - message: 'Fixing missing name for callback', - line: stringlog(block) - }); - Y.log('Fixing missing name for callback:' + stringlog(block), 'warn', 'docparser'); - name = 'callback'; - type = 'Callback'; - } else { + /** + * A map of the default tag processors, keyed by the + * tag name. Multiple tags can use the same digester + * by supplying the string name that points to the + * implementation rather than a function. + * @property DIGESTERS + * @type Object + * @final + * @for DocParser + */ + DIGESTERS = { + // "params": [ + // { + // "name": "optionalandmultiple", + // "description": "my desc", + // "type": "string", + // "optional": true, // [surroundedbybrackets] + // "optdefault": "if specified, this is always string to avoid syntax errors @TODO", + // "multiple": true // endswith* + // } + // ], + // @param {type} name description -or- + // @param name {type} description + // #2173362 optional w/ or w/o default + // @param {type} [optvar=default] description + // #12 document config objects + // @param {object|config} config description + // @param {type} config.prop1 description + // @param {type} config.prop2 description + // #11 document callback argument signature + // @param {callback|function} callback description + // @param {type} callback.arg1 description + // @param {type} callback.arg2 description + // #2173362 document event facade decorations for custom events + // @param {event} event description + // @param {type} event.child description + // @param {type} event.index description + // @param name* {type} 1..n description + // @param [name]* {type} 0..n description + 'param': function (tagname, value, target, block) { + // Y.log('param digester' + value); + target.params = target.params || []; + + if (!value) { this.warnings.push({ - message: 'param name missing: ' + value, + message: 'param name/type/descript missing', line: stringlog(block) }); - Y.log('param name missing: ' + value + ':' + stringlog(block), 'warn', 'docparser'); - name = 'UNKNOWN'; + Y.log('param name/type/descript missing: ' + stringlog(block), 'warn', 'docparser'); + return; } - } - len = name.length - 1; + var type, name, parts, optional, optdefault, parent, multiple, len, result, + desc = implodeString(trim(value)), + match = REGEX_TYPE.exec(desc), + host = target.params; - if (name.charAt(len) == '*') { - multiple = true; - name = name.substr(0, len); - } + // Extract {type} + if (match) { + type = fixType(trim(match[2])); + desc = trim(match[1] + match[3]); + } - // extract [name], optional param - if (name.indexOf('[') > -1) { - match = REGEX_OPTIONAL.exec(name); + // extract the first word, this is the param name + match = REGEX_FIRSTWORD.exec(desc); if (match) { - optional = true; name = trim(match[1]); - // extract optional=defaultvalue - parts = name.split('='); - if (parts.length > 1) { - name = parts[0]; - optdefault = parts[1]; - //Add some shortcuts for object/array defaults - if (optdefault.toLowerCase() == 'object') { - optdefault = '{}'; - } - if (optdefault.toLowerCase() == 'array') { - optdefault = '[]'; - } - } + desc = trim(match[2]); } - } - // parse object.prop, indicating a child property for object - if (name.indexOf('.') > -1) { - match = name.split('.'); - parent = trim(match[0]); - Y.each(target.params, function(param) { - if (param.name == parent) { - param.props = param.props || []; - host = param.props; - match.shift(); - name = trim(match.join('.')); - if (match.length > 1) { - var pname = name.split('.')[0], - par; - Y.each(param.props, function(o) { - if (o.name === pname) { - par = o; - } - }); - if (par) { - match = name.split('.'); - match.shift(); - name = match.join('.'); - par.props = par.props || []; - host = par.props; - } - } + if (!name) { + if (value && value.match(/callback/i)) { + this.warnings.push({ + message: 'Fixing missing name for callback', + line: stringlog(block) + }); + Y.log('Fixing missing name for callback:' + stringlog(block), 'warn', 'docparser'); + name = 'callback'; + type = 'Callback'; + } else { + this.warnings.push({ + message: 'param name missing: ' + value, + line: stringlog(block) + }); + Y.log('param name missing: ' + value + ':' + stringlog(block), 'warn', 'docparser'); + name = 'UNKNOWN'; } - }); - - } - - result = { - name: name, - description: explodeString(desc) - }; + } - if (type) { - result.type = type; - } + len = name.length - 1; - if (optional) { - result.optional = true; - if (optdefault) { - result.optdefault = optdefault; + if (name.charAt(len) === '*') { + multiple = true; + name = name.substr(0, len); } - } - if (multiple) { - result.multiple = true; - } - host.push(result); + // extract [name], optional param + if (name.indexOf('[') > -1) { + match = REGEX_OPTIONAL.exec(name); + if (match) { + optional = true; + name = trim(match[1]); + // extract optional=defaultvalue + parts = name.split('='); + if (parts.length > 1) { + name = parts[0]; + optdefault = parts[1]; + //Add some shortcuts for object/array defaults + if (optdefault.toLowerCase() === 'object') { + optdefault = '{}'; + } + if (optdefault.toLowerCase() === 'array') { + optdefault = '[]'; + } + } + } + } + // parse object.prop, indicating a child property for object + if (name.indexOf('.') > -1) { + match = name.split('.'); + parent = trim(match[0]); + Y.each(target.params, function (param) { + if (param.name === parent) { + param.props = param.props || []; + host = param.props; + match.shift(); + name = trim(match.join('.')); + if (match.length > 1) { + var pname = name.split('.')[0], + par; + Y.each(param.props, function (o) { + if (o.name === pname) { + par = o; + } + }); + if (par) { + match = name.split('.'); + match.shift(); + name = match.join('.'); + par.props = par.props || []; + host = par.props; + } + } + } + }); - }, + } - // @return {type} description // methods - // @returns {type} description // methods - // @throws {type} an error #2173342 - // @injects {HTML|CSS|script} description - // can be used by anthing that has an optional {type} and a description - 'return': function(tagname, value, target, block) { - - var desc = implodeString(trim(value)), type, - match = REGEX_TYPE.exec(desc), - result = {}; - if (match) { - type = fixType(trim(match[2])); - desc = trim(match[1] + match[3]); - } + result = { + name: name, + description: explodeString(desc) + }; - result = { - description: explodeString(desc) - }; + if (type) { + result.type = type; + } - if (type) { - result.type = type; - } + if (optional) { + result.optional = true; + if (optdefault) { + result.optdefault = optdefault; + } + } - target[tagname] = result; + if (multiple) { + result.multiple = true; + } - }, - 'throws': 'return', - 'injects': 'return', + host.push(result); + }, - // trying to overwrite the constructor value is a bad idea - 'constructor': function(tagname, value, target, block) { - target.is_constructor = 1; - }, + // @return {type} description // methods + // @returns {type} description // methods + // @throws {type} an error #2173342 + // @injects {HTML|CSS|script} description + // can be used by anthing that has an optional {type} and a description + 'return': function (tagname, value, target, block) { - // @author {twitter: @arthurdent | github: ArthurDent} - // Arthur Dent adent@h2g2.earth #23, multiple // modules/class/method - // 'author': function(tagname, value, target, block) { - // // Y.log('author digester'); - // }, - - // A key bock type for declaring modules and submodules - // subsequent class and member blocks will be assigned - // to this module. - 'module': function(tagname, value, target, block) { - this.set(CURRENT_MODULE, value); - var go = true; - Y.some(block, function(o) { - if (trim(o.tag) == 'submodule') { - go = false; - return true; - } - }); - if (go) { - if (!this.get(MAIN_MODULE)) { - var o = { - tag: tagname, - name: value, - file: target.file, - line: target.line, - description: target.description - }; - this.set(MAIN_MODULE, o); + var desc = implodeString(trim(value)), + type, + match = REGEX_TYPE.exec(desc), + result = {}; + if (match) { + type = fixType(trim(match[2])); + desc = trim(match[1] + match[3]); } - host = this.modules[value]; - return host; - } - return null; - }, - //Setting the description for the module.. - 'main': function(tagname, value, target, block) { - var o = target; - o.mainName = value; - o.tag = tagname; - o.itemtype = 'main'; - o._main = true; - this.set(MAIN_MODULE, o); - }, + result = { + description: explodeString(desc) + }; - // accepts a single project definition for the source tree - 'project': function(tagname, value, target, block) { - return this.project; - }, + if (type) { + result.type = type; + } - // A key bock type for declaring submodules. subsequent class and - // member blocks will be assigned to this submodule. - 'submodule': function(tagname, value, target, block) { - //console.log('Setting current submodule: ', value, 'on class'); - this.set(CURRENT_SUBMODULE, value); - var host = this.modules[value], - clazz = this.get(CURRENT_CLASS), - parent = this.get(CURRENT_MODULE); + target[tagname] = result; + + }, + 'throws': 'return', + 'injects': 'return', + + // trying to overwrite the constructor value is a bad idea + 'constructor': function (tagname, value, target, block) { + target.is_constructor = 1; + }, + + // @author {twitter: @arthurdent | github: ArthurDent} + // Arthur Dent adent@h2g2.earth #23, multiple // modules/class/method + // 'author': function(tagname, value, target, block) { + // // Y.log('author digester'); + // }, + + // A key bock type for declaring modules and submodules + // subsequent class and member blocks will be assigned + // to this module. + 'module': function (tagname, value, target, block) { + this.set(CURRENT_MODULE, value); + var go = true; + Y.some(block, function (o) { + if (trim(o.tag) === 'submodule') { + go = false; + return true; + } + }); + if (go) { + if (!this.get(MAIN_MODULE)) { + this.set(MAIN_MODULE, { + tag: tagname, + name: value, + file: target.file, + line: target.line, + description: target.description + }); + } + return this.modules[value]; + } + return null; + }, + + //Setting the description for the module.. + 'main': function (tagname, value, target, block) { + var o = target; + o.mainName = value; + o.tag = tagname; + o.itemtype = 'main'; + o._main = true; + this.set(MAIN_MODULE, o); + }, + + // accepts a single project definition for the source tree + 'project': function (tagname, value, target, block) { + return this.project; + }, + + // A key bock type for declaring submodules. subsequent class and + // member blocks will be assigned to this submodule. + 'submodule': function (tagname, value, target, block) { + //console.log('Setting current submodule: ', value, 'on class'); + this.set(CURRENT_SUBMODULE, value); + var host = this.modules[value], + clazz = this.get(CURRENT_CLASS), + parent = this.get(CURRENT_MODULE); if (parent) { host.module = parent; } if (clazz && this.classes[clazz]) { //console.log('Adding submodule', value , 'to class', clazz, ' it has submodule', this.classes[clazz].submodule); //if (!this.classes[clazz].submodule) { - //console.log('REALLY Adding submodule', value , 'to class', clazz); - this.classes[clazz].submodule = value; + //console.log('REALLY Adding submodule', value , 'to class', clazz); + this.classes[clazz].submodule = value; //} } - return host; - }, - - // A key bock type for declaring classes, subsequent - // member blocks will be assigned to this class - 'class': function(tagname, value, target, block) { - var _namespace, _value = value; - - block.forEach(function(def) { - if (def.tag === 'namespace') { - //We have a namespace, augment the name - var name = trim(def.value) + '.' + value; - if (value.indexOf(trim(def.value) + '.') === -1) { - value = name; - _namespace = trim(def.value); + return host; + }, + + // A key bock type for declaring classes, subsequent + // member blocks will be assigned to this class + 'class': function (tagname, value, target, block) { + var namespace, fullname, host, parent; + + block.forEach(function (def) { + if (def.tag === 'namespace') { + //We have a namespace, augment the name + var name = trim(def.value) + '.' + value; + if (value.indexOf(trim(def.value) + '.') === -1) { + value = name; + namespace = trim(def.value); + } } + }); + + if (namespace) { + this.set(CURRENT_NAMESPACE, namespace); } - }); + this.set(CURRENT_CLASS, value); - if (_namespace) { - this.set(CURRENT_NAMESPACE, _namespace); - } - this.set(CURRENT_CLASS, value); - var fullname = this.get(CURRENT_CLASS); - var host = this.classes[fullname], + fullname = this.get(CURRENT_CLASS); + host = this.classes[fullname]; parent = this.get(CURRENT_MODULE); - if (_namespace) { - host.namespace = _namespace; - } - if (parent) { - host.module = parent; - } - - //Merge host and target in case the class was defined in a "for" tag - //before it was defined in a "class" tag - host = Y.merge(host, target); - this.classes[fullname] = host; - parent = this.get(CURRENT_SUBMODULE); - if (parent) { - //this.set(CURRENT_SUBMODULE, parent); - host.submodule = parent; - } - return host; - }, - - // change 'const' to final property - 'const': function(tagname, value, target, block) { - target.itemtype = 'property'; - target.name = value; - target['final'] = ''; - }, - - // supported classitems - 'property': function(tagname, value, target, block) { - var match, name, desc; + if (namespace) { + host.namespace = namespace; + } + if (parent) { + host.module = parent; + } - target.itemtype = tagname; - target.name = value; - if (!target.type) { - desc = implodeString(trim(value)), - match = REGEX_TYPE.exec(desc); - - // Extract {type} - if (match) { - type = fixType(trim(match[2])); - name = trim(match[1] + match[3]); - target.type = type; - target.name = name; + //Merge host and target in case the class was defined in a "for" tag + //before it was defined in a "class" tag + host = Y.merge(host, target); + this.classes[fullname] = host; + parent = this.get(CURRENT_SUBMODULE); + if (parent) { + //this.set(CURRENT_SUBMODULE, parent); + host.submodule = parent; } - - } - if (target.type && target.type.toLowerCase() === 'object') { - block.forEach(function(i, k) { - if (i.tag === 'property') { - i.value = trim(i.value); - i.tag = 'param'; - block[k] = i; + return host; + }, + + // change 'const' to final property + 'const': function (tagname, value, target, block) { + target.itemtype = 'property'; + target.name = value; + /*jshint sub:true */ + target['final'] = ''; + }, + + // supported classitems + 'property': function (tagname, value, target, block) { + var match, name, desc, type; + + target.itemtype = tagname; + target.name = value; + if (!target.type) { + desc = implodeString(trim(value)); + match = REGEX_TYPE.exec(desc); + + // Extract {type} + if (match) { + type = fixType(trim(match[2])); + name = trim(match[1] + match[3]); + target.type = type; + target.name = name; } - }); - } - }, - 'method': 'property', - 'attribute': 'property', - 'config': 'property', - 'event': 'property', - - // access fields - 'public': function(tagname, value, target, block) { - target.access = tagname; - target.tagname = value; - }, - 'private': 'public', - 'protected': 'public', - 'inner': 'public', - - // tags that can have multiple occurances in a single block - 'todo': function(tagname, value, target, block) { - if (!Lang.isArray(target[tagname])) { - target[tagname] = []; - } - //If the item is @tag one,two - if (value.indexOf(',') > -1) { - value = value.split(','); - } else { - value = [value]; - } - - value.forEach(function(v) { - v = trim(v); - target[tagname].push(v); - }); - }, - 'extension_for': 'extensionfor', - 'extensionfor': function(tagname, value, target, block) { - if (this.classes[this.get(CURRENT_CLASS)]) { - this.classes[this.get(CURRENT_CLASS)].extension_for.push(value); - } - }, - 'example': function(tagname, value, target, block) { - if (!Lang.isArray(target[tagname])) { - target[tagname] = []; - } - var e = value; - block.forEach(function(v) { - if (v.tag == 'example') { - if (v.value.indexOf(value) > -1) { - e = v.value; - } } - }); - - target[tagname].push(e); - }, - 'url': 'todo', - 'icon': 'todo', - 'see': 'todo', - 'throws': 'todo', - 'requires': 'todo', - 'knownissue': 'todo', - 'uses': 'todo', - 'category': 'todo', - 'unimplemented': 'todo', - - genericValueTag: function (tagname, value, target, block) { - target[tagname] = value; - }, - - 'author' : 'genericValueTag', - 'contributor': 'genericValueTag', - 'since' : 'genericValueTag', + if (target.type && target.type.toLowerCase() === 'object') { + block.forEach(function (i, k) { + if (i.tag === 'property') { + i.value = trim(i.value); + i.tag = 'param'; + block[k] = i; + } + }); + } + }, + 'method': 'property', + 'attribute': 'property', + 'config': 'property', + 'event': 'property', + + // access fields + 'public': function (tagname, value, target, block) { + target.access = tagname; + target.tagname = value; + }, + 'private': 'public', + 'protected': 'public', + 'inner': 'public', + + // tags that can have multiple occurances in a single block + 'todo': function (tagname, value, target, block) { + if (!Lang.isArray(target[tagname])) { + target[tagname] = []; + } + //If the item is @tag one,two + if (value.indexOf(',') > -1) { + value = value.split(','); + } else { + value = [value]; + } - 'deprecated': function (tagname, value, target, block) { - target.deprecated = true; + value.forEach(function (v) { + v = trim(v); + target[tagname].push(v); + }); + }, + 'extension_for': 'extensionfor', + 'extensionfor': function (tagname, value, target, block) { + if (this.classes[this.get(CURRENT_CLASS)]) { + this.classes[this.get(CURRENT_CLASS)].extension_for.push(value); + } + }, + 'example': function (tagname, value, target, block) { + if (!Lang.isArray(target[tagname])) { + target[tagname] = []; + } - if (typeof value === 'string' && value.length) { - target.deprecationMessage = value; - } - }, + var e = value; + block.forEach(function (v) { + if (v.tag === 'example') { + if (v.value.indexOf(value) > -1) { + e = v.value; + } + } + }); - // updates the current namespace - 'namespace': function(tagname, value, target, block) { - this.set(CURRENT_NAMESPACE, value); - if (value === '') { - //Shortcut this if namespace is an empty string. - return; - } - var file = this.get(CURRENT_FILE); - if (file) { - this.files[file].namespaces[value] = 1; - } - var mod = this.get(CURRENT_MODULE); - if (mod) { - this.modules[mod].namespaces[value] = 1; - } + target[tagname].push(e); + }, + 'url': 'todo', + 'icon': 'todo', + 'see': 'todo', + 'requires': 'todo', + 'knownissue': 'todo', + 'uses': 'todo', + 'category': 'todo', + 'unimplemented': 'todo', + + genericValueTag: function (tagname, value, target, block) { + target[tagname] = value; + }, + + 'author': 'genericValueTag', + 'contributor': 'genericValueTag', + 'since': 'genericValueTag', + + 'deprecated': function (tagname, value, target, block) { + target.deprecated = true; + + if (typeof value === 'string' && value.length) { + target.deprecationMessage = value; + } + }, - var mod = this.get(CURRENT_SUBMODULE); - if (mod) { - this.modules[mod].namespaces[value] = 1; - } + // updates the current namespace + 'namespace': function (tagname, value, target, block) { + this.set(CURRENT_NAMESPACE, value); + if (value === '') { + //Shortcut this if namespace is an empty string. + return; + } + var m, + mod, + name, + lastNS, + file = this.get(CURRENT_FILE); + if (file) { + this.files[file].namespaces[value] = 1; + } + mod = this.get(CURRENT_MODULE); + if (mod) { + this.modules[mod].namespaces[value] = 1; + } - var mod = this.get(CURRENT_CLASS); - if (mod) { - var lastNS = this.get('lastnamespace'); - if (lastNS && lastNS !== value && (value.indexOf(lastNS + '.') !== 0)) { - if (this.classes[mod]) { - var m = this.classes[mod]; - delete this.classes[mod]; - mod = value + '.' + mod.replace(lastNS + '.', ''); - m.name = mod; - m.namespace = value; - this.classes[mod] = m; - this.set(CURRENT_CLASS, m.name); - } + mod = this.get(CURRENT_SUBMODULE); + if (mod) { + this.modules[mod].namespaces[value] = 1; } - if (this.classes[mod]) { - this.classes[mod].namespace = value; - if (mod === value) { - return; - } - if (mod.indexOf(value + '.') === -1) { - if (mod.indexOf('.') === -1) { - var m = this.classes[mod]; + + mod = this.get(CURRENT_CLASS); + if (mod) { + lastNS = this.get('lastnamespace'); + if (lastNS && lastNS !== value && (value.indexOf(lastNS + '.') !== 0)) { + if (this.classes[mod]) { + m = this.classes[mod]; delete this.classes[mod]; - var name = m.namespace + '.' + m.name; - m.name = name; - this.classes[name] = m; - this.set(CURRENT_CLASS, name); - } else { - if (mod.indexOf(this.classes[mod].namespace + '.') === -1) { - var m = this.classes[mod]; + mod = value + '.' + mod.replace(lastNS + '.', ''); + m.name = mod; + m.namespace = value; + this.classes[mod] = m; + this.set(CURRENT_CLASS, m.name); + } + } + if (this.classes[mod]) { + this.classes[mod].namespace = value; + if (mod === value) { + return; + } + if (mod.indexOf(value + '.') === -1) { + if (mod.indexOf('.') === -1) { + m = this.classes[mod]; delete this.classes[mod]; - var name = m.namespace + '.' + m.shortname; + name = m.namespace + '.' + m.name; m.name = name; this.classes[name] = m; this.set(CURRENT_CLASS, name); + } else { + if (mod.indexOf(this.classes[mod].namespace + '.') === -1) { + m = this.classes[mod]; + delete this.classes[mod]; + name = m.namespace + '.' + m.shortname; + m.name = name; + this.classes[name] = m; + this.set(CURRENT_CLASS, name); + } } } } } - } - }, + }, - // updates the current class only (doesn't create - // a new class definition) - 'for': function(tagname, value, target, block) { - value = this._resolveFor(value); - this.set(CURRENT_CLASS, value); - var ns = ((this.classes[value]) ? this.classes[value].namespace : ''); - this.set(CURRENT_NAMESPACE, ns); - var file = this.get(CURRENT_FILE); - if (file) { - this.files[file].fors[value] = 1; - } - var mod = this.get(CURRENT_MODULE); - if (mod) { - this.modules[mod].fors[value] = 1; - } + // updates the current class only (doesn't create + // a new class definition) + 'for': function (tagname, value, target, block) { + var ns, file, mod; - var mod = this.get(CURRENT_SUBMODULE); - if (mod) { - this.modules[mod].fors[value]; + value = this._resolveFor(value); + this.set(CURRENT_CLASS, value); + + ns = ((this.classes[value]) ? this.classes[value].namespace : ''); + this.set(CURRENT_NAMESPACE, ns); + + file = this.get(CURRENT_FILE); + if (file) { + this.files[file].fors[value] = 1; + } + + mod = this.get(CURRENT_MODULE); + if (mod) { + this.modules[mod].fors[value] = 1; + } + + mod = this.get(CURRENT_SUBMODULE); + if (mod) { + this.modules[mod].fors[value] = 1; + } } - } + }, - }, - - /** - * The doc parser accepts a **map** of files to file content. - * Once `parse()` is called, various properties will be populated - * with the parsers data (aggregated in the `'data'` property). - * @class DocParser - * @extends Base - * @constructor - * @param {Object} o the config object - * @module yuidoc - */ - DocParser = function(o) { - this.digesters = Y.merge(DocParser.DIGESTERS); - this.knowntags = Y.Array.hash(DocParser.TAGLIST); - DocParser.superclass.constructor.apply(this, arguments); - }; + /** + * The doc parser accepts a **map** of files to file content. + * Once `parse()` is called, various properties will be populated + * with the parsers data (aggregated in the `'data'` property). + * @class DocParser + * @extends Base + * @constructor + * @param {Object} o the config object + * @module yuidoc + */ + DocParser = function (o) { + this.digesters = Y.merge(DocParser.DIGESTERS); + this.knowntags = Y.Array.hash(DocParser.TAGLIST); + DocParser.superclass.constructor.apply(this, arguments); + }; DocParser.NAME = 'DocParser'; @@ -852,7 +857,7 @@

    File: lib/docparser.js

    DocParser.CORRECTIONS = CORRECTIONS; DocParser.ATTRS = { - + lint: { value: false }, @@ -872,7 +877,7 @@

    File: lib/docparser.js

    * @attribute digesters */ digesters: { - setter: function(val) { + setter: function (val) { Y.mix(this.digesters, val, true); Y.mix(this.knowntags, val, true); return val; @@ -885,13 +890,13 @@

    File: lib/docparser.js

    * @attribute emitters */ emitters: { - setter: function(val) { + setter: function (val) { Y.mix(this.emitters, val, true); } }, /** - * Comment syntax type. + * Comment syntax type. * @attribute syntaxtype * @type String */ @@ -904,7 +909,7 @@

    File: lib/docparser.js

    * @attribute filemap */ filemap: { - writeOnce : true + writeOnce: true }, /** @@ -914,7 +919,7 @@

    File: lib/docparser.js

    * @attribute dirmap */ dirmap: { - writeOnce : true + writeOnce: true }, /** @@ -923,7 +928,7 @@

    File: lib/docparser.js

    * @type String */ currentfile: { - setter: function(val) { + setter: function (val) { val = trim(val); // this.set(CURRENT_NAMESPACE, ''); if (!(val in this.files)) { @@ -939,19 +944,19 @@

    File: lib/docparser.js

    } }, /** - * The main documentation block for the module itself. - * @attribute mainmodule + * The main documentation block for the module itself. + * @attribute mainmodule * @type String - */ + */ mainmodule: { - setter: function(o) { + setter: function (o) { if (!o) { return; } - //console.log('Main Module Setter: ', o); + //console.log('Main Module Setter: ', o); var write = true, name = o.mainName || o.name; - if (this.get(CURRENT_MODULE) === name) { + if (this.get(CURRENT_MODULE) === name) { if (name in this.modules) { //console.log('In Global Modules', this.modules[name]); @@ -962,12 +967,12 @@

    File: lib/docparser.js

    } } if (write) { - //console.log('Writing'); + //console.log('Writing'); this.modules[name] = Y.merge(this.modules[name], o); } } else { if (o._main) { - //console.log('Writing'); + //console.log('Writing'); this.modules[name] = o; } } @@ -980,18 +985,23 @@

    File: lib/docparser.js

    * @type String */ currentmodule: { - setter: function(val) { + setter: function (val) { if (!val) { return val; } val = trim(val); + + var modMain, clazz; + this.set(CURRENT_SUBMODULE, ''); this.set(CURRENT_NAMESPACE, ''); - var m = this.get(MAIN_MODULE); - if (m && m.name !== val) { - this.set(MAIN_MODULE, ''); - } - var clazz = this.classes[this.get(CURRENT_CLASS)]; + + modMain = this.get(MAIN_MODULE); + if (modMain && modMain.name !== val) { + this.set(MAIN_MODULE, ''); + } + + clazz = this.classes[this.get(CURRENT_CLASS)]; if (clazz) { //Handles case where @module comes after @class in a new directory of files if (clazz.module !== val) { @@ -1013,6 +1023,7 @@

    File: lib/docparser.js

    } } } + if (!(val in this.modules)) { this.modules[val] = { name: val, @@ -1022,6 +1033,7 @@

    File: lib/docparser.js

    namespaces: {} }; } + return val; } }, @@ -1032,7 +1044,7 @@

    File: lib/docparser.js

    * @type String */ currentsubmodule: { - setter: function(val) { + setter: function (val) { if (!val) { return val; } @@ -1055,7 +1067,7 @@

    File: lib/docparser.js

    } }, currentnamespace: { - setter: function(val) { + setter: function (val) { this.set('lastnamespace', this.get(CURRENT_NAMESPACE)); return val; } @@ -1072,24 +1084,28 @@

    File: lib/docparser.js

    * @type String */ currentclass: { - setter: function(val) { + setter: function (val) { if (!val) { return val; } this.set('lastclass', this.get(CURRENT_CLASS)); val = trim(val); + var name = val, + ns, clazz; if (!(val in this.classes)) { - var ns = this.get(CURRENT_NAMESPACE), - name = (ns && ns !== '' && (val.indexOf(ns + '.') !== 0)) ? ns + '.' + val : val, - clazz = this.classes[name] = { - name: name, - shortname: val, - classitems: [], - plugins: [], - extensions: [], - plugin_for: [], - extension_for: [] - }; + ns = this.get(CURRENT_NAMESPACE); + if (ns && ns !== '' && (val.indexOf(ns + '.') !== 0)) { + name = ns + '.' + val; + } + clazz = this.classes[name] = { + name: name, + shortname: val, + classitems: [], + plugins: [], + extensions: [], + plugin_for: [], + extension_for: [] + }; clazz.module = this.get(CURRENT_MODULE); if (this.get(CURRENT_SUBMODULE)) { clazz.submodule = this.get(CURRENT_SUBMODULE); @@ -1103,15 +1119,15 @@

    File: lib/docparser.js

    Y.extend(DocParser, Y.Base, { /** - * Takes a non-namespaced classname and resolves it to a namespace (to support `@for`) - * @private - * @method _resolveFor - * @param {String} value The classname to resolve - * @return {String} The resolved namespace + classname - */ - _resolveFor: function(value) { + * Takes a non-namespaced classname and resolves it to a namespace (to support `@for`) + * @private + * @method _resolveFor + * @param {String} value The classname to resolve + * @return {String} The resolved namespace + classname + */ + _resolveFor: function (value) { if (value.indexOf('.') === -1) { - Y.each(this.classes, function(i) { + Y.each(this.classes, function (i) { if (i.shortname === value) { if (i.namespace) { value = i.namespace + '.' + i.shortname; @@ -1122,37 +1138,38 @@

    File: lib/docparser.js

    return value; }, - initializer: function() { - + initializer: function () { this.warnings = []; var self = this; - self.after('currentfileChange', function(e) { + self.after('currentfileChange', function (e) { /* - * File changed, so we reset class and submodule. - * You should use @for if you want to reference another class - * in different file. - */ + * File changed, so we reset class and submodule. + * You should use @for if you want to reference another class + * in different file. + */ self.set(CURRENT_SUBMODULE, ''); self.set(CURRENT_CLASS, ''); }); - self.after('currentmoduleChange', function(e) { - var mod = e.newVal, classes = self.classes; - Y.each(classes, function(clazz) { + self.after('currentmoduleChange', function (e) { + var mod = e.newVal, + classes = self.classes; + Y.each(classes, function (clazz) { if (!(clazz.module)) { clazz.module = mod; } }); }); - self.after('currentsubmoduleChange', function(e) { - var mod = e.newVal, classes = self.classes, + self.after('currentsubmoduleChange', function (e) { + var mod = e.newVal, + classes = self.classes, parent; if (mod) { parent = self.modules[mod].module; - Y.each(classes, function(clazz) { + Y.each(classes, function (clazz) { if (!(clazz.submodule)) { //if ((!clazz.module) || clazz.module == parent) { if (!clazz.module) { @@ -1164,17 +1181,17 @@

    File: lib/docparser.js

    } }); - self.after('currentclassChange', function(e) { + self.after('currentclassChange', function (e) { var clazz = e.newVal; - Y.each(self.classitems, function(item) { + Y.each(self.classitems, function (item) { if (!(item["class"])) { item["class"] = clazz; } }); // Y.log(self.classitems); }); - }, + /** Normalizes the initial indentation of the given _content_ so that the first line is unindented, and all other lines are unindented to the same degree as the @@ -1186,8 +1203,7 @@

    File: lib/docparser.js

    @return {String} Unindented text. @private **/ - - unindent: function(content) { + unindent: function (content) { var indent = content.match(/^(\s+)/); if (indent) { @@ -1198,36 +1214,41 @@

    File: lib/docparser.js

    }, /** - Transforms a JavaDoc style comment block (less the start - and end of it) into a list - of tag/text pairs. The leading space and '*' are removed, - but the remaining whitespace is preserved so that the - output should be friendly for both markdown and html - parsers. - - @method handlecomment - @param {String} comment The comment to parse - @param {String} file The file it was parsed from - @param {String} line The line number it was found on - */ - handlecomment: function(comment, file, line) { + Transforms a JavaDoc style comment block (less the start and end of it) + into a list of tag/text pairs. The leading space and '*' are removed, + but the remaining whitespace is preserved so that the output should be + friendly for both markdown and html parsers. + + @method handlecomment + @param {String} comment The comment to parse + @param {String} file The file it was parsed from + @param {String} line The line number it was found on + **/ + handlecomment: function (comment, file, line) { var lines = comment.split(REGEX_LINES), - len = lines.length, i, + len = lines.length, + i, parts, part, peek, skip, - results = [{tag: 'file', value: file}, - {tag: 'line', value: line}], + tag, value, + results = [{ + tag: 'file', + value: file + }, { + tag: 'line', + value: line + }], syntaxtype = this.get('syntaxtype'), lineHeadCharRegex = REGEX_LINE_HEAD_CHAR[syntaxtype], - hasLineHeadChar = lines[0] && lineHeadCharRegex.test(lines[0]); + hasLineHeadChar = lines[0] && lineHeadCharRegex.test(lines[0]); -// trim leading line head char(star or harp) if there are any + // trim leading line head char(star or harp) if there are any if (hasLineHeadChar) { for (i = 0; i < len; i++) { lines[i] = lines[i].replace(lineHeadCharRegex, ''); } } -// reconsitute and tokenize the comment block + // reconsitute and tokenize the comment block comment = this.unindent(lines.join('\n')); parts = comment.split(/(?:^|\n)\s*(@\w*)/); len = parts.length; @@ -1239,7 +1260,7 @@

    File: lib/docparser.js

    } skip = false; -// the first token may be the description, otherwise it should be a tag + // the first token may be the description, otherwise it should be a tag if (i === 0 && part.substr(0, 1) !== '@') { if (part) { tag = '@description'; @@ -1281,20 +1302,21 @@

    File: lib/docparser.js

    * @return {Object} A map of filenames to an array of extracted * comment text. */ - extract: function(filemap, dirmap) { + extract: function (filemap, dirmap) { filemap = filemap || this.get('filemap'); dirmap = dirmap || this.get('dirmap'); - var syntaxtype = this.get('syntaxtype'); - var commentmap = {}; - Y.each(filemap, function(code, filename) { + var syntaxtype = this.get('syntaxtype'), + commentmap = {}; + Y.each(filemap, function (code, filename) { - var commentlines, comment, + var commentlines, comment, line, lines = code.split(REGEX_LINES), - len = lines.length, i, linenum; + len = lines.length, + i, linenum; for (i = 0; i < len; i++) { line = lines[i]; - if(REGEX_START_COMMENT[syntaxtype].test(line)) { + if (REGEX_START_COMMENT[syntaxtype].test(line)) { commentlines = []; linenum = i + 1; @@ -1313,7 +1335,7 @@

    File: lib/docparser.js

    comment = commentlines.join('\n'); commentmap[filename] = commentmap[filename] || []; commentmap[filename] - .push(this.handlecomment(comment, filename, linenum)); + .push(this.handlecomment(comment, filename, linenum)); } } }, this); @@ -1327,19 +1349,17 @@

    File: lib/docparser.js

    * @method processblock * @param {Array} an array of the tag/text pairs */ - processblock: function(block) { + processblock: function (block) { var target = {}, - clazz, - module, - submodule, digestname, digester, host; + // Y.log(block); - Y.each(block, function(tag) { + Y.each(block, function (tag) { var name = trim(tag.tag), value = trim(tag.value), - parent, ret; + ret; //Convert empty values to a 1 for JSON data parsing later if (SHORT_TAGS[name] && value === '') { @@ -1347,7 +1367,6 @@

    File: lib/docparser.js

    } if (tag && tag.tag) { - if (!(name in this.knowntags)) { if (name in CORRECTIONS) { this.warnings.push({ @@ -1364,6 +1383,7 @@

    File: lib/docparser.js

    Y.log('unknown tag: ' + name + ',' + stringlog(block), 'warn', 'docparser'); } } + digestname = name; if (digestname in this.digesters) { digester = this.digesters[digestname]; @@ -1376,7 +1396,6 @@

    File: lib/docparser.js

    target[name] = value; } } - }, this); if (host) { @@ -1385,10 +1404,12 @@

    File: lib/docparser.js

    this.classitems.push(target); target['class'] = this.get(CURRENT_CLASS); target.module = this.get(CURRENT_MODULE); + host = this.get(CURRENT_SUBMODULE); if (host) { target.submodule = host; } + host = this.get(CURRENT_NAMESPACE); if (host) { target.namespace = host; @@ -1404,34 +1425,35 @@

    File: lib/docparser.js

    * @param {object} commentmap The hash of files and parsed comment blocks * @return {object} The transformed data for the project */ - transform: function(commentmap) { + transform: function (commentmap) { var self = this, project = self.project = {}, files = self.files = {}, modules = self.modules = {}, classes = self.classes = {}, - classitems = self.classitems = [], - data = self.data = { - project: project, - files: files, - modules: modules, - classes: classes, - classitems: classitems - }; + classitems = self.classitems = []; + + self.data = { + project: project, + files: files, + modules: modules, + classes: classes, + classitems: classitems + }; commentmap = commentmap || self.commentmap; // process - Y.each(commentmap, function(blocks, file) { + Y.each(commentmap, function (blocks, file) { //Y.log('transform: ' + file, 'info', 'docparser'); self.set(CURRENT_FILE, file); - Y.each(blocks, function(block) { + Y.each(blocks, function (block) { self.processblock(block); }); }); // cross reference - Y.each(modules, function(module, name) { + Y.each(modules, function (module, name) { if (module.file) { files[module.file].modules[name] = 1; } @@ -1443,7 +1465,7 @@

    File: lib/docparser.js

    delete module._main; }); - Y.each(classes, function(clazz, name) { + Y.each(classes, function (clazz, name) { if (clazz.module) { modules[clazz.module].classes[name] = 1; } @@ -1470,7 +1492,7 @@

    File: lib/docparser.js

    } } if (clazz.uses && clazz.uses.length) { - clazz.uses.forEach(function(u) { + clazz.uses.forEach(function (u) { var c = classes[u]; if (c) { c.extension_for.push(clazz.name); @@ -1479,11 +1501,11 @@

    File: lib/docparser.js

    } }); - Y.each(classitems, function(v) { + Y.each(classitems, function (v) { if (!v.itemtype) { self.warnings.push({ message: 'Missing item type' + (v.description ? '\n' + v.description : ''), - line: stringlog(v) + line: stringlog(v) }); Y.log('Missing item type: ' + stringlog(v), 'warn', 'DocParser'); if (v.description) { @@ -1492,7 +1514,7 @@

    File: lib/docparser.js

    } if (v.itemtype === 'property' && v.params) { v.subprops = v.params; - v.subprops.forEach(function(i) { + v.subprops.forEach(function (i) { //Remove top level prop name from sub props (should have been done in the @param parser i.name = i.name.replace(v.name + '.', ''); }); @@ -1500,7 +1522,7 @@

    File: lib/docparser.js

    } }); - Y.each(modules, function(mod) { + Y.each(modules, function (mod) { if (!mod.file || !mod.line || !mod.name) { console.log('Failed to find lines for', mod); } @@ -1517,18 +1539,18 @@

    File: lib/docparser.js

    * @return {DocParser} this parser instance. The total results * are available in parser.data. */ - parse: function(filemap, dirmap) { + parse: function (filemap, dirmap) { filemap = filemap || this.get('filemap'); dirmap = dirmap || this.get('dirmap'); return this.transform(this.extract(filemap, dirmap)); } - }); Y.DocParser = DocParser; -}, '0.1.0', { requires: ['base-base', 'json-stringify'] }); - +}, '0.1.0', { + requires: ['base-base'] +});
    diff --git a/output/api/files/lib_docview.js.html b/output/api/files/lib_docview.js.html index 11e3d633..1a46b975 100644 --- a/output/api/files/lib_docview.js.html +++ b/output/api/files/lib_docview.js.html @@ -19,7 +19,7 @@

    - API Docs for: 0.3.47 + API Docs for: 0.3.49
    @@ -113,14 +113,13 @@

    File: lib/docview.js

    Code licensed under the BSD License: http://yuilibrary.com/license/ */ -YUI.add('docview', function(Y) { +YUI.add('docview', function (Y) { - -/* -Selleck -Copyright (c) 2011 Yahoo! Inc. -Licensed under the BSD License. -*/ + /* + Selleck + Copyright (c) 2011 Yahoo! Inc. + Licensed under the BSD License. + */ /** View class borrowed from [Selleck](https://github.com/rgrove/selleck) @@ -129,7 +128,7 @@

    File: lib/docview.js

    @constructor @param {Object} data Meta data to use in this template @param {String} templateName The name of the template file to render. - */ + **/ function DocView(data, templateName) { this.templateName = templateName; Y.mix(this, data); @@ -137,11 +136,11 @@

    File: lib/docview.js

    DocView.prototype = { /** - * **Mustache** `lambda` method for setting the HTML title - * @method htmlTitle - */ + * **Mustache** `lambda` method for setting the HTML title + * @method htmlTitle + */ htmlTitle: function () { - var name = this.displayName || this.name, + var name = this.displayName || this.name, title = name; if (title) { @@ -156,11 +155,11 @@

    File: lib/docview.js

    }, /** - * **Mustache** `lambda` method for setting the title - * @method title - */ + * **Mustache** `lambda` method for setting the title + * @method title + */ title: function () { - var name = this.displayName || this.name, + var name = this.displayName || this.name, title = this.projectName; if (name) { diff --git a/output/api/files/lib_files.js.html b/output/api/files/lib_files.js.html index 795bd6dc..dbf07c1d 100644 --- a/output/api/files/lib_files.js.html +++ b/output/api/files/lib_files.js.html @@ -19,7 +19,7 @@

    - API Docs for: 0.3.47 + API Docs for: 0.3.49
    @@ -108,455 +108,484 @@

    File: lib/files.js

    -YUI.add('files', function(Y) {
    +YUI.add('files', function (Y) {
     
    -/**
    -* Ported fileutils methods from [Selleck](http://github.com/rgrove/selleck)
    -* @class Files
    -* @module yuidoc
    -*/
    +    /**
    +     * Ported fileutils methods from [Selleck](http://github.com/rgrove/selleck)
    +     * @class Files
    +     * @module yuidoc
    +     */
     
    -Y.Files = {};
    +    Y.Files = {};
     
    +    /*
    +    Selleck
    +    Copyright (c) 2011 Yahoo! Inc.
    +    Licensed under the BSD License.
    +    */
     
    -/*
    -Selleck
    -Copyright (c) 2011 Yahoo! Inc.
    -Licensed under the BSD License.
    -*/
    +    var fs = require('graceful-fs'),
    +        fsPath = require('path'),
    +        useFS = (fs.exists) ? fs : fsPath;
     
    -var fs = require('graceful-fs');
    -    fsPath   = require('path'),
    -    useFS = (fs.exists) ? fs : fsPath;
     
    -
    -
    -
    -var exists = function(file, cb) {
    -    if (cb) {
    -        useFS.exists(file, cb);
    -    } else {
    -        return useFS.existsSync(file);
    -    }
    -};
    -
    -Y.Files.exists = exists;
    -
    -
    -/**
    -* Copy a directory from one location to another
    -* @method copyDirectory
    -* @param {Path} source The source directory
    -* @param {Path} dest The destination directory
    -* @param {Boolean} [overwrite=false] Whether or not to overwrite destination files
    -  if they already exist.
    -* @param {Function} callback The callback to be executed when complete.
    -**/
    -function copyDirectory(source, dest, overwrite, callback) {
    -    // Allow callback as third arg.
    -    if (typeof overwrite === 'function') {
    -        callback = overwrite;
    -        overwrite = null;
    +    function exists(file, cb) {
    +        if (cb) {
    +            useFS.exists(file, cb);
    +        } else {
    +            return useFS.existsSync(file);
    +        }
         }
    +    Y.Files.exists = exists;
    +
    +
    +    /**
    +    Copy a directory from one location to another
    +    @method copyDirectory
    +    @param {Path} source The source directory
    +    @param {Path} dest The destination directory
    +    @param {Boolean} [overwrite=false] Whether or not to overwrite destination files
    +        if they already exist.
    +    @param {Function} callback The callback to be executed when complete.
    +    **/
    +    function copyDirectory(source, dest, overwrite, callback) {
    +        // Allow callback as third arg.
    +        if (typeof overwrite === 'function') {
    +            callback = overwrite;
    +            overwrite = null;
    +        }
     
    -    fs.stat(source, afterSourceStat);
    +        fs.stat(source, afterSourceStat);
     
    -    function afterSourceStat(err, stats) {
    -        if (err) { return callback(err); }
    +        function afterSourceStat(err, stats) {
    +            if (err) {
    +                return callback(err);
    +            }
     
    -        if (!stats.isDirectory()) {
    -            return callback(new Error("Source is not a directory: " + source));
    +            if (!stats.isDirectory()) {
    +                return callback(new Error("Source is not a directory: " + source));
    +            }
    +
    +            fs.lstat(dest, afterDestStat);
             }
     
    -        fs.lstat(dest, afterDestStat);
    -    }
    +        function afterDestStat(err, stats) {
    +            if (err && err.code !== 'ENOENT') {
    +                return callback(err);
    +            }
     
    -    function afterDestStat(err, stats) {
    -        if (err && err.code !== 'ENOENT') { return callback(err); }
    -
    -        if (stats) {
    -            // If the destination is a file or a link, either delete it or 
    -            // bubble an error if overwrite isn't true.
    -            if (stats.isFile() || stats.isSymbolicLink()) {
    -                if (overwrite) {
    -                    deletePath(dest); // TODO: make this async
    -                } else {
    -                    callback(new Error("Destination already exists: " + dest));
    -                    return;
    +            if (stats) {
    +                // If the destination is a file or a link, either delete it or 
    +                // bubble an error if overwrite isn't true.
    +                if (stats.isFile() || stats.isSymbolicLink()) {
    +                    if (overwrite) {
    +                        deletePath(dest); // TODO: make this async
    +                    } else {
    +                        callback(new Error("Destination already exists: " + dest));
    +                        return;
    +                    }
                     }
    -            }
     
    -            afterMkDir();
    -        } else {
    -            fs.mkdir(dest, 0755, afterMkDir);
    +                afterMkDir();
    +            } else {
    +                fs.mkdir(dest, 0755, afterMkDir);
    +            }
             }
    -    }
     
    -    function afterMkDir(err) {
    -        if (err && err.code !== 'EEXIST') { return callback(err); }
    -        fs.readdir(source, afterReadDir);
    -    }
    +        function afterMkDir(err) {
    +            if (err && err.code !== 'EEXIST') {
    +                return callback(err);
    +            }
    +            fs.readdir(source, afterReadDir);
    +        }
     
    -    function afterReadDir(err, files) {
    -        if (err) { return callback(err); }
    +        function afterReadDir(err, files) {
    +            if (err) {
    +                return callback(err);
    +            }
     
    -        var pending = files.length,
    -            filename;
    +            var pending = files.length,
    +                filename;
     
    -        if (!pending) { return callback(); }
    +            if (!pending) {
    +                return callback();
    +            }
     
    -        while ((filename = files.shift())) {
    -            copyPath(fsPath.join(source, filename), fsPath.join(dest, filename), overwrite, function (err) {
    -                if (err) { return callback(err); }
    +            while ((filename = files.shift())) {
    +                /*jshint loopfunc:true */
    +                copyPath(fsPath.join(source, filename), fsPath.join(dest, filename), overwrite, function (err) {
    +                    if (err) {
    +                        return callback(err);
    +                    }
     
    -                pending -= 1;
    +                    pending -= 1;
     
    -                if (!pending) {
    -                    callback();
    -                }
    -            });
    +                    if (!pending) {
    +                        callback();
    +                    }
    +                });
    +            }
             }
         }
    -}
    -Y.Files.copyDirectory = copyDirectory;
    -
    -/**
    -* Copy a file from one location to another
    -* @method copyFile
    -* @param {Path} source The source file
    -* @param {Path} dest The destination file
    -* @param {Boolean} [overwrite=false] Whether or not to overwrite destination files
    -  if they already exist.
    -* @param {Callback} callback The callback to be executed when complete.
    -* @param {Error} callback.err The Error returned from Node
    -**/
    -function copyFile(source, dest, overwrite, callback) {
    -    // Allow callback as third arg.
    -    if (typeof overwrite === 'function') {
    -        callback = overwrite;
    -        overwrite = null;
    -    }
    +    Y.Files.copyDirectory = copyDirectory;
    +
    +    /**
    +    Copy a file from one location to another
    +    @method copyFile
    +    @param {Path} source The source file
    +    @param {Path} dest The destination file
    +    @param {Boolean} [overwrite=false] Whether or not to overwrite destination files
    +        if they already exist.
    +    @param {Callback} callback The callback to be executed when complete.
    +    @param {Error} callback.err The Error returned from Node
    +    **/
    +    function copyFile(source, dest, overwrite, callback) {
    +        // Allow callback as third arg.
    +        if (typeof overwrite === 'function') {
    +            callback = overwrite;
    +            overwrite = null;
    +        }
     
    -    fs.lstat(source, function (err, sourceStats) {
    -        if (err) { return callback(err); }
    +        fs.lstat(source, function (err, sourceStats) {
    +            if (err) {
    +                return callback(err);
    +            }
     
    -        if (!sourceStats.isFile()) {
    -            return callback(new Error("Source is not a file: " + source));
    -        }
    +            if (!sourceStats.isFile()) {
    +                return callback(new Error("Source is not a file: " + source));
    +            }
     
    -        fs.lstat(dest, function (err, destStats) {
    -            var rs;
    +            fs.lstat(dest, function (err, destStats) {
    +                var rs;
     
    -            if (err && err.code !== 'ENOENT') { return callback(err); }
    +                if (err && err.code !== 'ENOENT') {
    +                    return callback(err);
    +                }
     
    -            if (destStats) {
    -                if (overwrite) {
    -                    deletePath(dest); // TODO: make this async
    -                } else {
    -                    callback(new Error("Destination already exists: " + dest));
    -                    return;
    +                if (destStats) {
    +                    if (overwrite) {
    +                        deletePath(dest); // TODO: make this async
    +                    } else {
    +                        callback(new Error("Destination already exists: " + dest));
    +                        return;
    +                    }
                     }
    -            }
     
    -            rs = fs.createReadStream(source);
    -            rs.pipe(fs.createWriteStream(dest, {mode: 0655}));
    -            rs.on('end', callback);
    +                rs = fs.createReadStream(source);
    +                rs.pipe(fs.createWriteStream(dest, {
    +                    mode: 0655
    +                }));
    +                rs.on('end', callback);
    +            });
             });
    -    });
    -}
    -Y.Files.copyFile = copyFile;
    -
    -/**
    -If _source_ is a file, copies it to _dest_. If it's a directory, recursively
    -copies it and all files and directories it contains to _dest_.
    -
    -Note that when attempting to copy a file into a directory, you should specify
    -the full path to the new file (including the new filename). Otherwise, it will
    -be interpreted as an attempt to copy the _source_ file *over* the _dest_
    -directory instead of *into* it.
    -
    -Known issues:
    -- Doesn't preserve ownership or permissions on copied files/directories.
    -
    -@method copyPath
    -@param {String} source Source path.
    -@param {String} dest Destination path.
    -@param {Boolean} [overwrite=false] Whether or not to overwrite destination files
    -if they already exist.
    -@param {Callback} callback The callback to execute when completed.
    -@param {Error} callback.err
    -**/
    -function copyPath(source, dest, overwrite, callback) {
    -    var destStats   = statSync(dest),
    -        sourceStats = statSync(source);
    -
    -    // Allow callback as third arg.
    -    if (typeof overwrite === 'function') {
    -        callback = overwrite;
    -        overwrite = null;
         }
    +    Y.Files.copyFile = copyFile;
    +
    +
    +    /**
    +    If _source_ is a file, copies it to _dest_. If it's a directory, recursively
    +    copies it and all files and directories it contains to _dest_.
    +
    +    Note that when attempting to copy a file into a directory, you should specify
    +    the full path to the new file (including the new filename). Otherwise, it will
    +    be interpreted as an attempt to copy the _source_ file *over* the _dest_
    +    directory instead of *into* it.
    +
    +    Known issues:
    +    - Doesn't preserve ownership or permissions on copied files/directories.
    +
    +    @method copyPath
    +    @param {String} source Source path.
    +    @param {String} dest Destination path.
    +    @param {Boolean} [overwrite=false] Whether or not to overwrite destination files
    +    if they already exist.
    +    @param {Callback} callback The callback to execute when completed.
    +    @param {Error} callback.err
    +    **/
    +    function copyPath(source, dest, overwrite, callback) {
    +        var sourceStats = statSync(source);
    +
    +        // Allow callback as third arg.
    +        if (typeof overwrite === 'function') {
    +            callback = overwrite;
    +            overwrite = null;
    +        }
     
    -    if (!sourceStats) {
    -        callback(new Error("Source not found: " + source));
    -        return;
    -    }
    +        if (!sourceStats) {
    +            callback(new Error("Source not found: " + source));
    +            return;
    +        }
     
    -    if (sourceStats.isFile()) {
    -        copyFile(source, dest, overwrite, callback);
    -    } else if (sourceStats.isDirectory()) {
    -        copyDirectory(source, dest, overwrite, callback);
    -    } else {
    -        callback(new Error("Source is neither a file nor a directory: " + source));
    +        if (sourceStats.isFile()) {
    +            copyFile(source, dest, overwrite, callback);
    +        } else if (sourceStats.isDirectory()) {
    +            copyDirectory(source, dest, overwrite, callback);
    +        } else {
    +            callback(new Error("Source is neither a file nor a directory: " + source));
    +        }
         }
    -}
    -Y.Files.copyPath = copyPath;
    +    Y.Files.copyPath = copyPath;
     
    -// TODO: copySymbolicLink()?
    +    // TODO: copySymbolicLink()?
     
    -/**
    -If _path_ is a file, deletes it. If _path_ is a directory, recursively deletes
    -it and all files and directories it contains.
    +    /**
    +    If _path_ is a file, deletes it. If _path_ is a directory, recursively deletes
    +    it and all files and directories it contains.
     
    -This method is synchronous.
    +    This method is synchronous.
     
    -@method deletePath
    -@param {String} path File or directory to delete.
    -**/
    -function deletePath(path) {
    -    var stats = fs.lstatSync(path);
    +    @method deletePath
    +    @param {String} path File or directory to delete.
    +    **/
    +    function deletePath(path) {
    +        var stats = fs.lstatSync(path);
     
    -    if (stats.isFile() || stats.isSymbolicLink()) {
    -        fs.unlinkSync(path);
    -    } else if (stats.isDirectory()) {
    -        fs.readdirSync(path).forEach(function (filename) {
    -            deletePath(fsPath.join(path, filename));
    -        });
    +        if (stats.isFile() || stats.isSymbolicLink()) {
    +            fs.unlinkSync(path);
    +        } else if (stats.isDirectory()) {
    +            fs.readdirSync(path).forEach(function (filename) {
    +                deletePath(fsPath.join(path, filename));
    +            });
     
    -        fs.rmdirSync(path);
    -    }
    -}
    -Y.Files.deletePath = deletePath;
    -
    -/**
    -Check to see if this is a directory
    -@method isDirectory
    -@param {Path} path The path to check
    -@param {Boolean} [link=false] Also validate a symlink
    -@return {Boolean} True if it is a directory
    -**/
    -function isDirectory(path, link) {
    -    var i = false;
    -    link = (link === false) ? false : true;
    -    try {
    -        var stat = fs.lstatSync(path);
    -        
    -        if (stat) {
    -            if (stat.isSymbolicLink() && link) {
    -                stat = fs.statSync(path);
    -            }
    -            i = stat.isDirectory();
    +            fs.rmdirSync(path);
             }
    -    } catch (e) {
    -        i = false;
         }
    +    Y.Files.deletePath = deletePath;
    +
    +
    +    /**
    +    Check to see if this is a directory
    +
    +    @method isDirectory
    +    @param {Path} path The path to check
    +    @param {Boolean} [link=false] Also validate a symlink
    +    @return {Boolean} True if it is a directory
    +    **/
    +    function isDirectory(path, link) {
    +        var stat,
    +            result = false;
     
    -    return i;
    -};
    -
    -Y.Files.isDirectory = isDirectory;
    -
    -/**
    -Check to see if this is a File
    -@method isFile
    -@param {Path} path The path to check
    -@param {Boolean} [link=false] Also validate a symlink
    -@return {Boolean} True if it is a file
    -**/
    -function isFile(path, link) {
    -    var i = false;
    -    try {
    -        var stat = fs.lstatSync(path);
    -        
    -        if (stat) {
    -            if (stat.isSymbolicLink() && link) {
    -                stat = fs.statSync(path);
    +        link = (link === false) ? false : true;
    +
    +        try {
    +            stat = fs.lstatSync(path);
    +            if (stat) {
    +                if (stat.isSymbolicLink() && link) {
    +                    stat = fs.statSync(path);
    +                }
    +                result = stat.isDirectory();
                 }
    -            i = stat.isFile();
    +        } catch (e) {
    +            result = false;
             }
    -    } catch (e) {
    -        i = false;
    -    }
     
    -    return i;
    -}
    -Y.Files.isFile = isFile;
    -
    -/**
    -Check to see if this is a SymLink
    -@method isSymbolicLink
    -@param {Path} path The path to check
    -@return {Boolean} True if it is a link
    -**/
    -function isSymbolicLink(path) {
    -    var stats = lstatSync(path);
    -    return stats ? stats.isSymbolicLink() : false;
    -}
    -Y.Files.isSymbolicLink = isSymbolicLink;
    -
    -/**
    -Like `fs.lstatSync()`, but returns `null` instead of throwing when _path_
    -doesn't exist. Will still throw on other types of errors.
    -
    -@method lstatSync
    -@param {String} path Path to stat.
    -@return {fs.Stats|null} `fs.Stats` object, or `null` if _path_ doesn't exist.
    -**/
    -function lstatSync(path) {
    -    try {
    -        return fs.lstatSync(path);
    -    } catch (ex) {
    -        if (ex.code === 'ENOENT') {
    -            return null;
    +        return result;
    +    }
    +    Y.Files.isDirectory = isDirectory;
    +
    +
    +    /**
    +    Check to see if this is a File
    +
    +    @method isFile
    +    @param {Path} path The path to check
    +    @param {Boolean} [link=false] Also validate a symlink
    +    @return {Boolean} True if it is a file
    +    **/
    +    function isFile(path, link) {
    +        var stat,
    +            result = false;
    +
    +        try {
    +            stat = fs.lstatSync(path);
    +            if (stat) {
    +                if (stat.isSymbolicLink() && link) {
    +                    stat = fs.statSync(path);
    +                }
    +                result = stat.isFile();
    +            }
    +        } catch (e) {
    +            result = false;
             }
     
    -        throw ex;
    +        return result;
         }
    -}
    -Y.Files.lstatSync = lstatSync;
    -
    -/**
    -Like `fs.statSync()`, but returns `null` instead of throwing when _path_
    -doesn't exist. Will still throw on other types of errors.
    -
    -@method statSync
    -@param {String} path Path to stat.
    -@return {fs.Stats|null} `fs.Stats` object, or `null` if _path_ doesn't exist.
    -**/
    -function statSync(path) {
    -    try {
    -        return fs.statSync(path);
    -    } catch (ex) {
    -        if (ex.code === 'ENOENT') {
    -            return null;
    -        }
    +    Y.Files.isFile = isFile;
    +
     
    -        throw ex;
    +    /**
    +    Check to see if this is a SymLink
    +
    +    @method isSymbolicLink
    +    @param {Path} path The path to check
    +    @return {Boolean} True if it is a link
    +    **/
    +    function isSymbolicLink(path) {
    +        var stats = lstatSync(path);
    +        return stats ? stats.isSymbolicLink() : false;
         }
    -}
    -Y.Files.statSync = statSync;
    -
    -/**
    -Copy the theme assets directory
    -@method copyAssets
    -@param {Path} from The source directory
    -@param {Path} dest The destination directory
    -@param {Boolean} deleteFirst Should the directory be deleted if it exists
    -@param {Function} callback The callback to be executed
    -*/
    -function copyAssets() {
    -    var args        = Array.prototype.slice.call(arguments),
    -        callback    = args.pop(),
    -        from        = args.shift(),
    -        to          = args.shift(),
    -        deleteFirst = args.shift();
    -    
    -    if (from[0] === from[1]) {
    -        if (isDirectory(from[0])) {
    -            if (deleteFirst && isDirectory(to)) {
    -                deletePath(to);
    +    Y.Files.isSymbolicLink = isSymbolicLink;
    +
    +
    +    /**
    +    Like `fs.lstatSync()`, but returns `null` instead of throwing when _path_
    +    doesn't exist. Will still throw on other types of errors.
    +
    +    @method lstatSync
    +    @param {String} path Path to stat.
    +    @return {fs.Stats|null} `fs.Stats` object, or `null` if _path_ doesn't exist.
    +    **/
    +    function lstatSync(path) {
    +        try {
    +            return fs.lstatSync(path);
    +        } catch (ex) {
    +            if (ex.code === 'ENOENT') {
    +                return null;
                 }
     
    -            copyPath(from[0], to, true, callback);
    -        } else {
    -            callback();
    +            throw ex;
             }
    -    } else {
    -        if (isDirectory(from[0])) {
    -            if (deleteFirst && isDirectory(to)) {
    -                deletePath(to);
    +    }
    +    Y.Files.lstatSync = lstatSync;
    +
    +
    +    /**
    +    Like `fs.statSync()`, but returns `null` instead of throwing when _path_
    +    doesn't exist. Will still throw on other types of errors.
    +
    +    @method statSync
    +    @param {String} path Path to stat.
    +    @return {fs.Stats|null} `fs.Stats` object, or `null` if _path_ doesn't exist.
    +    **/
    +    function statSync(path) {
    +        try {
    +            return fs.statSync(path);
    +        } catch (ex) {
    +            if (ex.code === 'ENOENT') {
    +                return null;
                 }
     
    -            copyPath(from[0], to, true, function() {
    -                if (isDirectory(from[1])) {
    -                    copyPath(from[1], to, true, callback)
    -                } else {
    -                    callback();
    +            throw ex;
    +        }
    +    }
    +    Y.Files.statSync = statSync;
    +
    +    /**
    +    Copy the theme assets directory
    +
    +    @method copyAssets
    +    @param {Path} from The source directory
    +    @param {Path} dest The destination directory
    +    @param {Boolean} deleteFirst Should the directory be deleted if it exists
    +    @param {Function} callback The callback to be executed
    +    */
    +    function copyAssets() {
    +        var args = Array.prototype.slice.call(arguments),
    +            callback = args.pop(),
    +            from = args.shift(),
    +            to = args.shift(),
    +            deleteFirst = args.shift();
    +
    +        if (from[0] === from[1]) {
    +            if (isDirectory(from[0])) {
    +                if (deleteFirst && isDirectory(to)) {
    +                    deletePath(to);
                     }
    -            });
    +
    +                copyPath(from[0], to, true, callback);
    +            } else {
    +                callback();
    +            }
             } else {
    -            callback();
    +            if (isDirectory(from[0])) {
    +                if (deleteFirst && isDirectory(to)) {
    +                    deletePath(to);
    +                }
    +
    +                copyPath(from[0], to, true, function () {
    +                    if (isDirectory(from[1])) {
    +                        copyPath(from[1], to, true, callback);
    +                    } else {
    +                        callback();
    +                    }
    +                });
    +            } else {
    +                callback();
    +            }
    +
             }
    -        
         }
    -}
    +    Y.Files.copyAssets = copyAssets;
     
    -Y.Files.copyAssets = copyAssets;
     
    +    /**
    +    Helper method for getting JSON data from a local file
     
    -/**
    -* Helper method for getting JSON data from a local file
    -* @method getJSON
    -* @param {Path} filename The filename to parse JSON from
    -* @return {Object} The JSON data 
    -*/
    -Y.Files.getJSON = function(filename) {
    -    var data = {};
    -    if (exists(filename)) {
    -        data = JSON.parse(fs.readFileSync(filename, 'utf8'));
    +    @method getJSON
    +    @param {Path} filename The filename to parse JSON from
    +    @return {Object} The JSON data
    +    **/
    +    Y.Files.getJSON = function (filename) {
    +        var data = {};
    +        if (exists(filename)) {
    +            data = JSON.parse(fs.readFileSync(filename, 'utf8'));
    +        }
    +        return data;
         };
    -    return data;
    -};
    -
    -/**
    -* Helper method for writing files to disk. It wraps the NodeJS file API
    -* @method writeFile
    -* @param {Path} file The filename to write to
    -* @param {String} data The data to write
    -* @param {Callback} callback*
    -*/
    -
    -var writeFileTimer = 100,
    -    readFileTimer = 100;
    -
    -var writeFile = function(file, data, cb) {
    -    var flags = {
    -        flags: "w", encoding: Y.charset, mode: 0644
    +
    +    /**
    +    Helper method for writing files to disk. It wraps the NodeJS file API
    +
    +    @method writeFile
    +    @param {Path} file The filename to write to
    +    @param {String} data The data to write
    +    @param {Callback} callback*
    +    **/
    +    function writeFile(file, data, cb) {
    +        var out,
    +            args = arguments,
    +            flags = {
    +                flags: "w",
    +                encoding: Y.charset,
    +                mode: 0644
    +            };
    +
    +        if (cb) {
    +            fs.writeFile(file, data, flags, function (err) {
    +                if (err && err.message.match(/^EMFILE, Too many open files/)) {
    +                    Y.log('Writefile failed, too many open files (' + args[0] + '). Trying again.', 'warn', 'files');
    +                    writeFile.timer++;
    +                    Y.later(writeFile.timer, Y, writeFile, args);
    +                    return;
    +                }
    +                cb();
    +            });
    +        } else {
    +            out = fs.createWriteStream(file, flags);
    +            out.write(data);
    +            out.end();
    +        }
         }
    -    var args = arguments;
    -    if (cb) {
    -        fs.writeFile(file, data, flags, function(err) {
    +    writeFile.timer = 100;
    +
    +    Y.Files.writeFile = writeFile;
    +
    +
    +    function readFile(file, enc, cb) {
    +        var args = arguments;
    +        fs.readFile(file, enc, function (err, data) {
                 if (err && err.message.match(/^EMFILE, Too many open files/)) {
    -                Y.log('Writefile failed, too many open files (' + args[0] + '). Trying again.', 'warn', 'files');
    -                writeFileTimer++;
    -                Y.later(writeFileTimer, Y, writeFile, args);
    +                Y.log('Readfile failed, too many open files (' + args[0] + '). Trying again.', 'warn', 'files');
    +                readFile.timer++;
    +                Y.later(readFile.timer, Y, readFile, args);
                     return;
                 }
    -            cb();
    +            cb(err, data);
             });
    -    } else {
    -        var out = fs.createWriteStream(file, flags);
    -        out.write(data);
    -        out.end();
         }
    -};
    -
    -Y.Files.writeFile = writeFile;
    -
    -
    -var readFile = function(file, enc, cb) {
    -    var args = arguments;
    -    fs.readFile(file, enc, function(err, data) {
    -        if (err && err.message.match(/^EMFILE, Too many open files/)) {
    -            Y.log('Readfile failed, too many open files (' + args[0] + '). Trying again.', 'warn', 'files');
    -            readFileTimer++;
    -            Y.later(readFileTimer, Y, readFile, args);
    -            return;
    -        }
    -        cb(err, data);
    -    });
    -};
    +    readFile.timer = 100;
     
    -Y.Files.readFile = readFile;
    +    Y.Files.readFile = readFile;
     
     });
     
    diff --git a/output/api/files/lib_help.js.html b/output/api/files/lib_help.js.html
    index 25b6b42a..646c3cd7 100644
    --- a/output/api/files/lib_help.js.html
    +++ b/output/api/files/lib_help.js.html
    @@ -19,7 +19,7 @@ 

    - API Docs for: 0.3.47 + API Docs for: 0.3.49
    @@ -113,20 +113,20 @@

    File: lib/help.js

    Code licensed under the BSD License: http://yuilibrary.com/license/ */ -YUI.add('help', function(Y) { - +YUI.add('help', function (Y) { + /** - * Shows the help text - * @module yuidoc - * @class Help - */ + * Shows the help text + * @module yuidoc + * @class Help + */ /** - * The help text to display - * @private - * @property help - * @type Array - */ + * The help text to display + * @private + * @property help + * @type Array + */ var help = [ "", "YUI Doc generates API documentation from a modified JavaDoc syntax.", @@ -166,25 +166,25 @@

    File: lib/help.js

    " <input path> Supply a list of paths (shell globbing is handy here)", "", ].join('\n'); - + /** - * Render the help message as a string - * @method renderHelp - * @return {String} The help screen to display - */ - Y.renderHelp = function() { + * Render the help message as a string + * @method renderHelp + * @return {String} The help screen to display + */ + Y.renderHelp = function () { return Y.Lang.sub(help, { VERSION: Y.packageInfo.version }); }; /** - * Display the help message, write it to the screen and exit - * @method showHelp - */ - Y.showHelp = function() { + * Display the help message, write it to the screen and exit + * @method showHelp + */ + Y.showHelp = function () { console.error(Y.renderHelp()); process.exit(0); //Shouldn't exit one on help - } + }; }); diff --git a/output/api/files/lib_index.js.html b/output/api/files/lib_index.js.html index d9f4b5bd..58c6a217 100644 --- a/output/api/files/lib_index.js.html +++ b/output/api/files/lib_index.js.html @@ -19,7 +19,7 @@

    - API Docs for: 0.3.47 + API Docs for: 0.3.49
    @@ -113,6 +113,7 @@

    File: lib/index.js

    Code licensed under the BSD License: http://yuilibrary.com/license/ */ +/*global YUI:true, Y:true */ /** Module creates the YUI instance with the required modules, uses them and exports the **Y** to be used by the _CLI class_ or by extenders: `require('yuidocjs');` @@ -134,7 +135,7 @@

    File: lib/index.js

    var args = process.argv.slice(2); var debug = false; -args.forEach(function(item) { +args.forEach(function (item) { if (item.toLowerCase() === '--debug') { debug = true; } @@ -146,7 +147,7 @@

    File: lib/index.js

    metaPath = path.join(__dirname, '../', 'package.json'); -process.on('uncaughtException', function(msg) { +process.on('uncaughtException', function (msg) { var meta = JSON.parse(fs.readFileSync(metaPath)), inst = YUI(), useColor = (Y ? Y.config.useColor : false); @@ -154,7 +155,7 @@

    File: lib/index.js

    inst.applyConfig({ debug: true, useColor: useColor - }); + }); inst.log('--------------------------------------------------------------------------', 'error'); inst.log('An uncaught YUIDoc error has occurred, stack trace given below', 'error'); diff --git a/output/api/files/lib_options.js.html b/output/api/files/lib_options.js.html index de679dec..23854819 100644 --- a/output/api/files/lib_options.js.html +++ b/output/api/files/lib_options.js.html @@ -19,7 +19,7 @@

    - API Docs for: 0.3.47 + API Docs for: 0.3.49
    @@ -108,24 +108,25 @@

    File: lib/options.js

    -YUI.add('options', function(Y) {
    -    
    +YUI.add('options', function (Y) {
    +
         var path = require('path');
     
         /**
    -    * Handles argument parsing
    -    * @module yuidoc
    -    * @class Options
    -    */
    +     * Handles argument parsing
    +     * @module yuidoc
    +     * @class Options
    +     */
     
         /**
    -    * Parses arguments and returns an Object of config options
    -    * @method Options
    -    * @param {Array} args Arguments to parse
    -    * @return {Object} The config object
    -    */
    -    Y.Options = function(args) {
    -    
    +     * Parses arguments and returns an Object of config options
    +     * @method Options
    +     * @param {Array} args Arguments to parse
    +     * @return {Object} The config object
    +     */
    +    Y.Options = function (args) {
    +        /*jshint onevar:false */
    +
             var options = {
                 port: 3000,
                 nocode: false
    @@ -135,141 +136,145 @@ 

    File: lib/options.js

    var v = args.shift(); // options.* defined in ./builder.js switch (v) { - case '--lint': - options.lint = true; - options.parseOnly = true; - options.writeJSON = false; - options.quiet = true; - break; - case "--debug": - Y.applyConfig({ debug: true, filter: 'debug' }); - break; - case "--charset": - Y.charset = args.shift() || 'utf8'; - Y.log('Setting default charset to ' + Y.charset, 'yuidoc', 'warn'); - break; - case "-c": - case "--config": - case "--configfile": - options.configfile = args.shift(); - break; - case "-e": - case "--extension": - options.extension = args.shift(); - break; - case "-x": - case "--exclude": - options.exclude = args.shift(); - break; - case "-v": - case "--version": - console.error(Y.packageInfo.version); - process.exit(1); - break; - case "--project-version": - options.version = args.shift(); - break; - case "-N": - case "--no-color": - Y.config.useColor = false; - options.nocolor = true; - break; - case "-D": - case "--no-delete-out": - options.nodeleteout = true; - break; - case "-C": - case "--no-code": - options.nocode = true; - break; - case "-n": - case "--norecurse": - options.norecurse = true; - break; - case "-S": - case "--selleck": - options.selleck = true; - break; - case "-V": - case "--view": - options.dumpview = true; - break; - case "-p": - case "--parse-only": - options.parseOnly = true; - break; - case "-o": - case "--outdir": - options.outdir = args.shift(); - break; - case "-t": - case "--themedir": - options.themedir = args.shift(); - break; - case "--server": - options.server = true; - var a = args.shift(); - var p = parseInt(a, 10); - if (isNaN(p) || !p) { - if (a) { - args.unshift(a); - } - Y.log('Failed to extract port, setting to the default :3000', 'warn', 'yuidoc'); - } else { - options.port = p; - } - break; - case "-h": - case "--help": - Y.showHelp(); - break; - case "-H": - case "--helpers": - var list = args.shift(); - if (list) { - options.helpers = list.split(','); - } else { - throw('Failed to pass a helper file.'); - } - break; - case "-T": - case "--theme": - var theme = args.shift(); - options.themedir = path.join(__dirname, '../', 'themes', theme); - break; - case "-q": - case "--quiet": - options.quiet = true; - break; - case "--syntaxtype": - options.syntaxtype = args.shift(); - break; - case "--tab-to-space": - options.tabtospace = parseInt(args.shift(), 10); - if (typeof options.tabtospace === 'number') { - options.tabspace = ''; - for (var s = 0; s < options.tabtospace; s++) { - options.tabspace += ' '; - } + case '--lint': + options.lint = true; + options.parseOnly = true; + options.writeJSON = false; + options.quiet = true; + break; + case "--debug": + Y.applyConfig({ + debug: true, + filter: 'debug' + }); + break; + case "--charset": + Y.charset = args.shift() || 'utf8'; + Y.log('Setting default charset to ' + Y.charset, 'yuidoc', 'warn'); + break; + case "-c": + case "--config": + case "--configfile": + options.configfile = args.shift(); + break; + case "-e": + case "--extension": + options.extension = args.shift(); + break; + case "-x": + case "--exclude": + options.exclude = args.shift(); + break; + case "-v": + case "--version": + console.error(Y.packageInfo.version); + process.exit(1); + break; + case "--project-version": + options.version = args.shift(); + break; + case "-N": + case "--no-color": + Y.config.useColor = false; + options.nocolor = true; + break; + case "-D": + case "--no-delete-out": + options.nodeleteout = true; + break; + case "-C": + case "--no-code": + options.nocode = true; + break; + case "-n": + case "--norecurse": + options.norecurse = true; + break; + case "-S": + case "--selleck": + options.selleck = true; + break; + case "-V": + case "--view": + options.dumpview = true; + break; + case "-p": + case "--parse-only": + options.parseOnly = true; + break; + case "-o": + case "--outdir": + options.outdir = args.shift(); + break; + case "-t": + case "--themedir": + options.themedir = args.shift(); + break; + case "--server": + options.server = true; + var a = args.shift(); + var p = parseInt(a, 10); + if (isNaN(p) || !p) { + if (a) { + args.unshift(a); } - break; - default: - if (!options.paths) { - options.paths = []; + Y.log('Failed to extract port, setting to the default :3000', 'warn', 'yuidoc'); + } else { + options.port = p; + } + break; + case "-h": + case "--help": + Y.showHelp(); + break; + case "-H": + case "--helpers": + var list = args.shift(); + if (list) { + options.helpers = list.split(','); + } else { + throw ('Failed to pass a helper file.'); + } + break; + case "-T": + case "--theme": + var theme = args.shift(); + options.themedir = path.join(__dirname, '../', 'themes', theme); + break; + case "-q": + case "--quiet": + options.quiet = true; + break; + case "--syntaxtype": + options.syntaxtype = args.shift(); + break; + case "--tab-to-space": + options.tabtospace = parseInt(args.shift(), 10); + if (typeof options.tabtospace === 'number') { + options.tabspace = ''; + for (var s = 0; s < options.tabtospace; s++) { + options.tabspace += ' '; } - if (v && v.indexOf('-') === 0) { - throw('Unknown option: ' + v); - } - options.paths.push(v); + } + break; + default: + if (!options.paths) { + options.paths = []; + } + if (v && v.indexOf('-') === 0) { + throw ('Unknown option: ' + v); + } + options.paths.push(v); } } if (options.quiet) { - Y.applyConfig({ debug: false }); + Y.applyConfig({ + debug: false + }); } - - return options; + return options; }; }); diff --git a/output/api/files/lib_server.js.html b/output/api/files/lib_server.js.html index 58d63997..ee31adbd 100644 --- a/output/api/files/lib_server.js.html +++ b/output/api/files/lib_server.js.html @@ -19,7 +19,7 @@

    - API Docs for: 0.3.47 + API Docs for: 0.3.49
    @@ -108,231 +108,233 @@

    File: lib/server.js

    -YUI.add('server', function(Y) {
    -    
    -    var path = require('path');
    -    /**
    -    * Provides the `--server` server option for YUIDoc
    -    * @class Server
    -    * @module yuidoc
    -    */
    -    var Server = {
    -        /**
    -        * Cache for external mixed in data.
    -        * @property _externalData
    -        * @private
    -        * @type Object
    -        */
    -        _externalData: null,
    -        /**
    -        * Middleware to parse the API docs per request
    -        * @method parse
    -        * @param {Request} req Express request object
    -        * @param {Response} res Express response object
    -        * @param {Function} next Express next callback
    -        */
    -        parse: function(req, res, next) {
    -            var json = (new Y.YUIDoc(Server.options)).run();
    -            Server.options = Y.Project.mix(json, Server.options);
    -            Server.builder = new Y.DocBuilder(Server.options, json);
    -            if (Server._externalData) {
    -                Server.options.externalData = Server._externalData;
    -                Server.builder._mixExternal();
    -            }
    +YUI.add('server', function (Y) {
     
    -            next();
    -        },
    +    var path = require('path'),
             /**
    -        * Create the routes used to serve YUIDoc files dynamically
    -        * @method routes
    -        */
    -        routes: function() {
    -            var app = Server.app;
    -
    -            app.get('/', Server.parse, function(req, res) {
    -                Server.home(req, res);
    -            });
    -            app.get('/api.js', function(req, res) {
    -                Server.builder.renderAPIMeta(function(js) {
    -                    res.contentType('.js');
    -                    res.send(js);
    +         * Provides the `--server` server option for YUIDoc
    +         * @class Server
    +         * @module yuidoc
    +         */
    +        Server = {
    +            /**
    +             * Cache for external mixed in data.
    +             * @property _externalData
    +             * @private
    +             * @type Object
    +             */
    +            _externalData: null,
    +            /**
    +             * Middleware to parse the API docs per request
    +             * @method parse
    +             * @param {Request} req Express request object
    +             * @param {Response} res Express response object
    +             * @param {Function} next Express next callback
    +             */
    +            parse: function (req, res, next) {
    +                var json = (new Y.YUIDoc(Server.options)).run();
    +                Server.options = Y.Project.mix(json, Server.options);
    +                Server.builder = new Y.DocBuilder(Server.options, json);
    +                if (Server._externalData) {
    +                    Server.options.externalData = Server._externalData;
    +                    Server.builder._mixExternal();
    +                }
    +
    +                next();
    +            },
    +            /**
    +             * Create the routes used to serve YUIDoc files dynamically
    +             * @method routes
    +             */
    +            routes: function () {
    +                var app = Server.app;
    +
    +                app.get('/', Server.parse, function (req, res) {
    +                    Server.home(req, res);
    +                });
    +                app.get('/api.js', function (req, res) {
    +                    Server.builder.renderAPIMeta(function (js) {
    +                        res.contentType('.js');
    +                        res.send(js);
    +                    });
                     });
    -            });
     
     
    -            app.get('/classes/:class.html', Server.parse, function(req, res, next) {
    -                Server.clazz(req, res, next);
    -            });
    +                app.get('/classes/:class.html', Server.parse, function (req, res, next) {
    +                    Server.clazz(req, res, next);
    +                });
     
    -            app.get('/modules/:module.html', Server.parse, function(req, res, next) {
    -                Server.module(req, res, next);
    -            });
    +                app.get('/modules/:module.html', Server.parse, function (req, res, next) {
    +                    Server.module(req, res, next);
    +                });
     
    -            app.get('/files/:file.html', Server.parse, function(req, res, next) {
    -                Server.files(req, res, next);
    -            });
    -            
    -            //These routes are special catch routes..
    -
    -            app.get('//api.js', function(req, res) {
    -                res.redirect('/api.js');
    -            });
    -            app.get('//classes/:class.html', Server.parse, function(req, res, next) {
    -                Server.clazz(req, res, next);
    -            });
    -
    -            app.get('//modules/:module.html', Server.parse, function(req, res, next) {
    -                Server.module(req, res, next);
    -            });
    -
    -            app.get('//files/:file.html', Server.parse, function(req, res, next) {
    -                Server.files(req, res, next);
    -            });
    -
    -            app.get('*', function(req, res) {
    -                var type = req.url.split('/')[1],
    -                    oType = type;
    -                var html = ['<h1>Item Not Found in internal meta-data</h1>'];
    -
    -                if (type === 'class') {
    -                    type = 'classes';
    -                }
    -                if (Server.builder && Server.builder.data && Server.builder.data[type]) {
    -                    if (Object.keys(Server.builder.data[type]).length) {
    -                        html.push('<p>But I know about these? Misname your module?</p>');
    -                        html.push('<ul>');
    -                        Object.keys(Server.builder.data[type]).forEach(function(item) {
    -                            html.push('<li><a href="../' + path.dirname(req.url) + '/' + item + '.html">' + item + '</a></li>');
    -                        });
    -                        html.push('</ul>');
    -                    }
    -                }
    +                app.get('/files/:file.html', Server.parse, function (req, res, next) {
    +                    Server.files(req, res, next);
    +                });
     
    +                //These routes are special catch routes..
     
    -                res.send(html.join('\n'), 404);
    -            });
    +                app.get('//api.js', function (req, res) {
    +                    res.redirect('/api.js');
    +                });
    +                app.get('//classes/:class.html', Server.parse, function (req, res, next) {
    +                    Server.clazz(req, res, next);
    +                });
     
    -        },
    -        /**
    -        * `/files` endpoint
    -        * @method files
    -        * @param {Request} req Express request object
    -        * @param {Response} res Express response object
    -        */
    -        files: function(req, res, next) {
    -            var fileName = req.params.file;
    -            var data;
    -            Object.keys(Server.builder.data.files).forEach(function(file) {
    -                if (fileName === Server.builder.filterFileName(file)) {
    -                    data = Server.builder.data.files[file];
    -                }
    -            });
    -            
    -            if (!data) {
    -                return next();
    -            }
    +                app.get('//modules/:module.html', Server.parse, function (req, res, next) {
    +                    Server.module(req, res, next);
    +                });
    +
    +                app.get('//files/:file.html', Server.parse, function (req, res, next) {
    +                    Server.files(req, res, next);
    +                });
     
    -            Y.log('Serving /files/' + data.name, 'info', 'server');
    +                app.get('*', function (req, res) {
    +                    var type = req.url.split('/')[1],
    +                        html = ['<h1>Item Not Found in internal meta-data</h1>'];
     
    +                    if (type === 'class') {
    +                        type = 'classes';
    +                    }
    +                    if (Server.builder && Server.builder.data && Server.builder.data[type]) {
    +                        if (Object.keys(Server.builder.data[type]).length) {
    +                            html.push('<p>But I know about these? Misname your module?</p>');
    +                            html.push('<ul>');
    +                            Object.keys(Server.builder.data[type]).forEach(function (item) {
    +                                html.push('<li><a href="../' + path.dirname(req.url) + '/' + item + '.html">' + item + '</a></li>');
    +                            });
    +                            html.push('</ul>');
    +                        }
    +                    }
     
    -            Server.builder.renderFile(function(html) {
    -                res.send(html);
    -            }, data, (req.xhr ? 'xhr' : 'main'));
    -        },
    -        /**
    -        * `/classes` endpoint
    -        * @method clazz
    -        * @param {Request} req Express request object
    -        * @param {Response} res Express response object
    -        */
    -        clazz: function(req, res, next) {
    -            var className = req.params['class'];
    -            Y.log('Serving /classes/' + className + '.html', 'info', 'server');
    -            if (!Server.builder.data.classes[className]) {
    -                return next();
    -            }
    -            Server.builder.renderClass(function(html) {
    -                res.send(html);
    -            }, Server.builder.data.classes[className], (req.xhr ? 'xhr' : 'main'));
    -        },
    -        /**
    -        * `/modules` endpoint
    -        * @method modules
    -        * @param {Request} req Express request object
    -        * @param {Response} res Express response object
    -        */
    -        module: function(req, res, next) {
    -            var modName = req.params.module;
    -            Y.log('Serving /modules/' + modName + '.html', 'info', 'server');
    -            if (!Server.builder.data.modules[modName]) {
    -                return next();
    -            }
    -            Server.builder.renderModule(function(html) {
    -                res.send(html);
    -            }, Server.builder.data.modules[modName], (req.xhr ? 'xhr' : 'main'));
    -        },
    -        /**
    -        * `/` endpoint
    -        * @method home
    -        * @param {Request} req Express request object
    -        * @param {Response} res Express response object
    -        */
    -        home: function(req, res, next) {
    -            Y.log('Serving index.html', 'info', 'server');
    -            Server.builder.renderIndex(function(html) {
    -                res.send(html);
    -            });
    -        },
    -        /**
    -        * Creates the Express server and prep's YUI for serving
    -        * @method init
    -        */
    -        init: function() {
    -            var express = require('express'),
    -                path = require('path');
    -
    -
    -            Server.app = express();
    -            //console.log(Server.options);
    -            var stat = Server.options.themedir || path.join(__dirname, '../', 'themes', 'default');
    -            Server.app.use(express.static(stat));
    -            Server.routes();
    -            Server.app.listen(Server.options.port);
    -
    -            Y.log('Starting server: http:/'+'/127.0.0.1:' + Server.options.port, 'info', 'server');
    -        },
    -        /**
    -        * Start the server with the supplied options.
    -        * @method start
    -        * @param {Object} options Server options
    -        */
    -        start: function(options) {
    -            options = Y.Project.init(options);
    -            Server.options = options;
    -            
    -            Server.options.cacheTemplates = false; //Don't cache the Handlebars templates
    -            Server.options.writeJSON = false; //Don't write the JSON file out
     
    -            Y.config.logExclude.yuidoc = true;
    -            Y.config.logExclude.docparser = true;
    -            Y.config.logExclude.builder = true;
    +                    res.send(html.join('\n'), 404);
    +                });
     
    -            if (Server.options.external) {
    -                Y.log('Fetching external data, this may take a minute', 'warn', 'server');
    -                var json = (new Y.YUIDoc(Server.options)).run();
    -                Server.options = Y.Project.mix(json, Server.options);
    -                var builder = new Y.DocBuilder(Server.options, json);
    -                builder.mixExternal(function() {
    -                    Y.log('External data fetched, launching server..', 'info', 'server');
    -                    Server._externalData = builder.options.externalData;
    -                    Server.init();
    +            },
    +            /**
    +             * `/files` endpoint
    +             * @method files
    +             * @param {Request} req Express request object
    +             * @param {Response} res Express response object
    +             */
    +            files: function (req, res, next) {
    +                var fileName = req.params.file,
    +                    data;
    +                Object.keys(Server.builder.data.files).forEach(function (file) {
    +                    if (fileName === Server.builder.filterFileName(file)) {
    +                        data = Server.builder.data.files[file];
    +                    }
                     });
     
    -            } else {
    -                Server.init();
    +                if (!data) {
    +                    return next();
    +                }
    +
    +                Y.log('Serving /files/' + data.name, 'info', 'server');
    +
    +
    +                Server.builder.renderFile(function (html) {
    +                    res.send(html);
    +                }, data, (req.xhr ? 'xhr' : 'main'));
    +            },
    +            /**
    +             * `/classes` endpoint
    +             * @method clazz
    +             * @param {Request} req Express request object
    +             * @param {Response} res Express response object
    +             */
    +            clazz: function (req, res, next) {
    +                var className = req.params['class'];
    +                Y.log('Serving /classes/' + className + '.html', 'info', 'server');
    +                if (!Server.builder.data.classes[className]) {
    +                    return next();
    +                }
    +                Server.builder.renderClass(function (html) {
    +                    res.send(html);
    +                }, Server.builder.data.classes[className], (req.xhr ? 'xhr' : 'main'));
    +            },
    +            /**
    +             * `/modules` endpoint
    +             * @method modules
    +             * @param {Request} req Express request object
    +             * @param {Response} res Express response object
    +             */
    +            module: function (req, res, next) {
    +                var modName = req.params.module;
    +                Y.log('Serving /modules/' + modName + '.html', 'info', 'server');
    +                if (!Server.builder.data.modules[modName]) {
    +                    return next();
    +                }
    +                Server.builder.renderModule(function (html) {
    +                    res.send(html);
    +                }, Server.builder.data.modules[modName], (req.xhr ? 'xhr' : 'main'));
    +            },
    +            /**
    +             * `/` endpoint
    +             * @method home
    +             * @param {Request} req Express request object
    +             * @param {Response} res Express response object
    +             */
    +            home: function (req, res, next) {
    +                Y.log('Serving index.html', 'info', 'server');
    +                Server.builder.renderIndex(function (html) {
    +                    res.send(html);
    +                });
    +            },
    +            /**
    +             * Creates the Express server and prep's YUI for serving
    +             * @method init
    +             */
    +            init: function () {
    +                var express = require('express'),
    +                    path = require('path'),
    +                    stat;
    +
    +                Server.app = express();
    +                //console.log(Server.options);
    +                stat = Server.options.themedir || path.join(__dirname, '../', 'themes', 'default');
    +                Server.app.use(express.static(stat));
    +                Server.routes();
    +                Server.app.listen(Server.options.port);
    +
    +                Y.log('Starting server: http:/' + '/127.0.0.1:' + Server.options.port, 'info', 'server');
    +            },
    +            /**
    +             * Start the server with the supplied options.
    +             * @method start
    +             * @param {Object} options Server options
    +             */
    +            start: function (options) {
    +                options = Y.Project.init(options);
    +                Server.options = options;
    +
    +                Server.options.cacheTemplates = false; //Don't cache the Handlebars templates
    +                Server.options.writeJSON = false; //Don't write the JSON file out
    +
    +                Y.config.logExclude.yuidoc = true;
    +                Y.config.logExclude.docparser = true;
    +                Y.config.logExclude.builder = true;
    +
    +                if (Server.options.external) {
    +                    Y.log('Fetching external data, this may take a minute', 'warn', 'server');
    +                    var json, builder;
    +
    +                    json = (new Y.YUIDoc(Server.options)).run();
    +                    Server.options = Y.Project.mix(json, Server.options);
    +
    +                    builder = new Y.DocBuilder(Server.options, json);
    +                    builder.mixExternal(function () {
    +                        Y.log('External data fetched, launching server..', 'info', 'server');
    +                        Server._externalData = builder.options.externalData;
    +                        Server.init();
    +                    });
    +
    +                } else {
    +                    Server.init();
    +                }
                 }
    -        }
    -    };
    +        };
     
         Y.Server = Server;
     });
    diff --git a/output/api/files/lib_utils.js.html b/output/api/files/lib_utils.js.html
    index 62f07a59..0f4c1534 100644
    --- a/output/api/files/lib_utils.js.html
    +++ b/output/api/files/lib_utils.js.html
    @@ -19,7 +19,7 @@ 

    - API Docs for: 0.3.47 + API Docs for: 0.3.49
    @@ -113,30 +113,30 @@

    File: lib/utils.js

    Code licensed under the BSD License: http://yuilibrary.com/license/ */ +/*jshint onevar:false */ var path = require('path'), - util = require('util'), minimatch = require('minimatch'), fs = require('graceful-fs'); /** -* Utilities Class -* @class Utils -* @module yuidoc -*/ + * Utilities Class + * @class Utils + * @module yuidoc + */ + +YUI.add('utils', function (Y) { -YUI.add('utils', function(Y) { - Y.charset = 'utf8'; -var HTML_CHARS = { - '&': '&amp;', - '<': '&lt;', - '>': '&gt;', - '"': '&quot;', - "'": '&#x27;', - '/': '&#x2F;', - '`': '&#x60;' -}; + var HTML_CHARS = { + '&': '&amp;', + '<': '&lt;', + '>': '&gt;', + '"': '&quot;', + "'": '&#x27;', + '/': '&#x2F;', + '`': '&#x60;' + }; /** Escapes HTML characters in _html_. @@ -145,7 +145,7 @@

    File: lib/utils.js

    @param {String} html String to escape. @return {String} Escaped string. **/ - Y.escapeHTML = function(html) { + Y.escapeHTML = function (html) { return html.replace(/[&<>"'\/`]/g, function (match) { return HTML_CHARS[match]; }); @@ -162,7 +162,7 @@

    File: lib/utils.js

    @return {String} Unindented text. @private **/ - Y.unindent = function(content) { + Y.unindent = function (content) { var indent = content.match(/^(\s+)/); if (indent) { @@ -171,413 +171,436 @@

    File: lib/utils.js

    return content; }; - -/** -Like `getPages()`, but returns only the files under the `layout/` subdirectory -of the specified _dir_. - -@method getLayouts -@param {String} dir Directory path. -@return {Object} Mapping of layout names to layout content. -**/ -function getLayouts(dir) { - return getPages(path.join(dir, 'layouts')); -} -Y.getLayouts = getLayouts; -/** -Loads and returns the content of the specified page file. - -@method getPage -@param {String} pagePath Path to a single `.handlebars` page. -@return {String|null} Page content, or `null` if not found. -**/ -function getPage(pagePath) { - if (!Y.Files.isFile(pagePath)) { return null; } - return fs.readFileSync(pagePath, Y.charset); -} -Y.getPage = getPage; + /** + Like `getPages()`, but returns only the files under the `layout/` subdirectory + of the specified _dir_. -/** -Loads pages (files with a `.handlebars` extension) in the specified directory and -returns an object containing a mapping of page names (the part of the filename) -preceding the `.handlebars` extension) to page content. - -@method getPages -@param {String} dir Directory path. -@return {Object} Mapping of page names to page content. -**/ -var cache = {}; -function getPages(dir) { - if (cache[dir]) { - return cache[dir]; + @method getLayouts + @param {String} dir Directory path. + @return {Object} Mapping of layout names to layout content. + **/ + function getLayouts(dir) { + return getPages(path.join(dir, 'layouts')); } - var pages = {}; + Y.getLayouts = getLayouts; - if (!Y.Files.isDirectory(dir)) { return pages; } - - fs.readdirSync(dir).forEach(function (filename) { - var filePath = path.join(dir, filename); + /** + Loads and returns the content of the specified page file. - if (path.extname(filename) === '.handlebars' && Y.Files.isFile(filePath)) { - pages[path.basename(filename, '.handlebars')] = fs.readFileSync(filePath, Y.charset); + @method getPage + @param {String} pagePath Path to a single `.handlebars` page. + @return {String|null} Page content, or `null` if not found. + **/ + function getPage(pagePath) { + if (!Y.Files.isFile(pagePath)) { + return null; } - }); - cache[dir] = pages; + return fs.readFileSync(pagePath, Y.charset); + } + Y.getPage = getPage; - return pages; -} -Y.getPages = getPages; + /** + Loads pages (files with a `.handlebars` extension) in the specified directory and + returns an object containing a mapping of page names (the part of the filename) + preceding the `.handlebars` extension) to page content. -/** -Like `getPages()`, but returns only the files under the `partial/` subdirectory -of the specified _dir_. + @method getPages + @param {String} dir Directory path. + @return {Object} Mapping of page names to page content. + **/ + var cache = {}; + function getPages(dir) { + if (cache[dir]) { + return cache[dir]; + } + var pages = {}; -@method getPartials -@param {String} dir Directory path. -@return {Object} Mapping of partial names to partial content. -**/ -function getPartials(dir) { - return getPages(path.join(dir, 'partials')); -} -Y.getPartials = getPartials; + if (!Y.Files.isDirectory(dir)) { + return pages; + } + fs.readdirSync(dir).forEach(function (filename) { + var filePath = path.join(dir, filename); -/** -Mix/merge/munge data into the template. -@method prepare -@param {String} inDir The starting directory -@param {Object} options The `options` for the meta data. -@param {callback} callback The callback to excecute when complete -@param {Error} callback.err -@param {Object} callback.options Merged options. -**/ -function prepare(inDirs, options, callback) { - var compiled = {}, - meta = {}, - type = 'project'; - - if (options && options.skipLoad) { - // Skip loading layouts, metadata, pages, and partials and assume that - // the caller has provided them if they want them. - options = Y.merge({ - layouts : {}, - meta : {}, - pages : {}, - partials : {}, - viewClass: Y.DocView - }, options); - } else { - - // Gather layouts, metadata, pages, and partials from the specified - // input directory, then merge them into the provided options (if any). - // - // Gathered data will override provided data if there are conflicts, in - // order to support a use case where global data are provided by the - // caller and overridden by more specific component-level data gathered - // from the input directory. - // - // The metadata inheritance chain looks like this: - // - // - override metadata specified via CLI (highest precedence) - // - component metadata (if this is a component) - // - project-level component default metadata (if specified and this is a component) - // - theme-level component default metadata (if specified and this is a component) - // - project metadata - // - theme metadata (lowest precedence) - - try { - if (inDirs[0] === inDirs[1]) { - layouts = getLayouts(inDirs[0]); - partials = getPartials(inDirs[0]); - } else { - layouts = Y.merge(getLayouts(inDirs[0]), getLayouts(inDirs[1])); - partials = Y.merge(getPartials(inDirs[0]), getPartials(inDirs[1])); + if (path.extname(filename) === '.handlebars' && Y.Files.isFile(filePath)) { + pages[path.basename(filename, '.handlebars')] = fs.readFileSync(filePath, Y.charset); } - options = Y.merge( - {viewClass: Y.DocView}, - options || {}, - { - layouts : layouts, - meta : options.meta, - partials: partials - } - ); - } catch (ex) { - return callback(ex); - } + }); + cache[dir] = pages; + + return pages; } + Y.getPages = getPages; - // Mix in the override metadata, if any. It takes precedence over everything - // else. - Y.mix(options.meta, options.overrideMeta); + /** + Like `getPages()`, but returns only the files under the `partial/` subdirectory + of the specified _dir_. - // Set a default asset path if one isn't specified in the metadata. - if (!options.meta.projectAssets) { - options.meta.projectAssets = options.component ? '../assets' : 'assets'; + @method getPartials + @param {String} dir Directory path. + @return {Object} Mapping of partial names to partial content. + **/ + function getPartials(dir) { + return getPages(path.join(dir, 'partials')); } + Y.getPartials = getPartials; - if (!options.meta.componentAssets && options.component) { - options.meta.componentAssets = '../assets/' + options.meta.name; - } - if (typeof options.meta.layout === 'undefined') { - options.meta.layout = options.layouts[type] ? type : 'main'; - } - - callback(null, options); -} + /** + Mix/merge/munge data into the template. + + @method prepare + @param {String} inDir The starting directory + @param {Object} options The `options` for the meta data. + @param {callback} callback The callback to excecute when complete + @param {Error} callback.err + @param {Object} callback.options Merged options. + **/ + function prepare(inDirs, options, callback) { + var layouts, + partials, + type = 'project'; + + if (options && options.skipLoad) { + // Skip loading layouts, metadata, pages, and partials and assume that + // the caller has provided them if they want them. + options = Y.merge({ + layouts: {}, + meta: {}, + pages: {}, + partials: {}, + viewClass: Y.DocView + }, options); + } else { + // Gather layouts, metadata, pages, and partials from the specified + // input directory, then merge them into the provided options (if any). + // + // Gathered data will override provided data if there are conflicts, in + // order to support a use case where global data are provided by the + // caller and overridden by more specific component-level data gathered + // from the input directory. + // + // The metadata inheritance chain looks like this: + // + // - override metadata specified via CLI (highest precedence) + // - component metadata (if this is a component) + // - project-level component default metadata (if specified and this is a component) + // - theme-level component default metadata (if specified and this is a component) + // - project metadata + // - theme metadata (lowest precedence) + try { + if (inDirs[0] === inDirs[1]) { + layouts = getLayouts(inDirs[0]); + partials = getPartials(inDirs[0]); + } else { + layouts = Y.merge(getLayouts(inDirs[0]), getLayouts(inDirs[1])); + partials = Y.merge(getPartials(inDirs[0]), getPartials(inDirs[1])); + } + options = Y.merge({ + viewClass: Y.DocView + }, + options || {}, { + layouts: layouts, + meta: options.meta, + partials: partials + } + ); + } catch (ex) { + return callback(ex); + } + } -Y.prepare = prepare; + // Mix in the override metadata, if any. It takes precedence over everything + // else. + Y.mix(options.meta, options.overrideMeta); -/** -* Walk the directory tree to locate the yuidoc.json file. -* @method getProjectData -* @param {Path} [dir=process.cwd()] The directory to start from -*/ -var getProjectData = function(dir) { - var dirs = [dir || process.cwd()]; - var projectData, packageData; - var dirCount = 0; - // keep looping until - // * data is found - // * there are no more dirs to process - // * we abort due to failsafe - while (dirs.length && !projectData) { - if (dirCount++ > 5000) { - Y.log('Scanned ' + dirCount + ' directories looking for a yuidoc.json file, something is probably wrong here..', 'error', 'yuidoc'); - process.exit(1); + // Set a default asset path if one isn't specified in the metadata. + if (!options.meta.projectAssets) { + options.meta.projectAssets = options.component ? '../assets' : 'assets'; + } + + if (!options.meta.componentAssets && options.component) { + options.meta.componentAssets = '../assets/' + options.meta.name; } - // accumulator for directories at this level - var childDirs = []; - // for each directory at the previous level - dirs.forEach(function(dir) { - // abort iterating if we have project data - if (projectData) { - return; + + if (typeof options.meta.layout === 'undefined') { + options.meta.layout = options.layouts[type] ? type : 'main'; + } + + callback(null, options); + } + + Y.prepare = prepare; + + /** + * Walk the directory tree to locate the yuidoc.json file. + * @method getProjectData + * @param {Path} [dir=process.cwd()] The directory to start from + */ + var getProjectData = function (dir) { + var dirs = [dir || process.cwd()]; + var projectData, packageData; + var dirCount = 0; + // keep looping until + // * data is found + // * there are no more dirs to process + // * we abort due to failsafe + while (dirs.length && !projectData) { + /*jshint loopfunc:true */ + if (dirCount++ > 5000) { + Y.log('Scanned ' + dirCount + ' directories looking for a yuidoc.json file, something is probably wrong here..', 'error', 'yuidoc'); + process.exit(1); } - // squelch (but log) any complaints about this particular directory - try { - // for each item in this directory - var names = fs.readdirSync(dir); - names.forEach(function(name) { - // abort iterating a folder if we have found both data - if (projectData && packageData) { - return; - } - // build a full path - var p = path.join(dir, name); - // acquire project data from this item if possible - if (Y.Files.isFile(p)) { - projectData = getFileData(p, name, 'yuidoc.json'); - // 'package.json' is used for auxilliary configuration - // if it's found. Formerly, it was only found if it - // came _before_'yuidoc.json' in the folder tree - // (never in the same folder). - // This code will find 'package.json' in the same - // folder as 'yuidoc.json'. - // If there is no 'yuidoc.json', former algorithm would - // use the deepest 'package.json' it can find, this one - // will use the first (most shallow) one. - packageData = packageData || getFileData(p, name, 'package.json'); - } - // if we are a folder, but not ., .., or node_modules, - // then add to directory accumulator - if (Y.Files.isDirectory(p)) { - if (name.indexOf('.') === 0) { + // accumulator for directories at this level + var childDirs = []; + // for each directory at the previous level + dirs.forEach(function (dir) { + // abort iterating if we have project data + if (projectData) { + return; + } + // squelch (but log) any complaints about this particular directory + try { + // for each item in this directory + var names = fs.readdirSync(dir); + names.forEach(function (name) { + // abort iterating a folder if we have found both data + if (projectData && packageData) { return; } - if (name === 'node_modules') { - Y.log('Skipping node_modules directory while scanning for yuidoc.json', 'warn', 'yuidoc'); - return; + // build a full path + var p = path.join(dir, name); + // acquire project data from this item if possible + if (Y.Files.isFile(p)) { + projectData = getFileData(p, name, 'yuidoc.json'); + // 'package.json' is used for auxilliary configuration + // if it's found. Formerly, it was only found if it + // came _before_'yuidoc.json' in the folder tree + // (never in the same folder). + // This code will find 'package.json' in the same + // folder as 'yuidoc.json'. + // If there is no 'yuidoc.json', former algorithm would + // use the deepest 'package.json' it can find, this one + // will use the first (most shallow) one. + packageData = packageData || getFileData(p, name, 'package.json'); } - childDirs.push(p); - } - }); - } catch (dirPerm) { - Y.log('Accessing dir (' + dir + ') threw an error', 'warn', 'yuidoc'); + // if we are a folder, but not ., .., or node_modules, + // then add to directory accumulator + if (Y.Files.isDirectory(p)) { + if (name.indexOf('.') === 0) { + return; + } + if (name === 'node_modules') { + Y.log('Skipping node_modules directory while scanning for yuidoc.json', 'warn', 'yuidoc'); + return; + } + childDirs.push(p); + } + }); + } catch (dirPerm) { + Y.log('Accessing dir (' + dir + ') threw an error', 'warn', 'yuidoc'); + } + }); + // iterate over new set of folders + dirs = childDirs; + } + if ((packageData && projectData) || (packageData && packageData.yuidoc)) { + projectData = mergeData(packageData, projectData); + } + return projectData; + }; + + var getFileData = function (p, name, file) { + if (name === file) { + Y.log('Loading ' + name + ' data from: ' + p, 'info', 'yuidoc'); + try { + return Y.Files.getJSON(p); + } catch (e) { + var err = 'Failed to parse ' + name + ' file, please make sure it is valid JSON'; + Y.log(err, 'error', 'yuidoc'); + throw (e + ''); } - }); - // iterate over new set of folders - dirs = childDirs; - } - if ((packageData && projectData) || (packageData && packageData.yuidoc)) { - projectData = mergeData(packageData, projectData); - } - return projectData; -}; - -var getFileData = function(p, name, file) { - if (name === file) { - Y.log('Loading ' + name + ' data from: ' + p, 'info', 'yuidoc'); - try { - return Y.Files.getJSON(p); - } catch (e) { - var err = 'Failed to parse ' + name + ' file, please make sure it is valid JSON'; - Y.log(err, 'error', 'yuidoc'); - throw(e+''); } - } -}; + }; -var mergeData = function(pack, project) { - project = project || {}; + var mergeData = function (pack, project) { + project = project || {}; - if (pack.yuidoc) { - Object.keys(pack.yuidoc).forEach(function(key) { - if (!project[key]) { - project[key] = pack.yuidoc[key]; + if (pack.yuidoc) { + Object.keys(pack.yuidoc).forEach(function (key) { + if (!project[key]) { + project[key] = pack.yuidoc[key]; + } + }); + } + + ['name', 'description', 'version', 'url'].forEach(function (key) { + if (pack[key] && !project[key]) { + project[key] = pack[key]; } }); - } - ['name', 'description', 'version', 'url'].forEach(function(key) { - if (pack[key] && !project[key]) { - project[key] = pack[key]; - } - }); + return project; + }; - return project; -}; + Y.getProjectData = getProjectData; -Y.getProjectData = getProjectData; + /** + * Walks the tree from this dir and returns all the subdirs + * @method getDirs + * @param {String} dir The dir to begin at + * @return {Array} The array of directories.. + */ + var getDirs = function (dir) { + var dirs = fs.readdirSync(dir), + paths = []; + + dirs.forEach(function (d) { + var _dir = path.join(dir, d), + stat = fs.lstatSync(_dir); + + if (stat.isDirectory()) { + if (_dir.indexOf('.') !== 0) { + paths = [].concat(paths, _dir, getDirs(_dir)); + } + } + }); -/** -* Walks the tree from this dir and returns all the subdirs -* @method getDirs -* @param {String} dir The dir to begin at -* @return {Array} The array of directories.. -*/ + return paths; + }; -var getDirs = function(dir) { - var dirs = fs.readdirSync(dir), - paths = []; + Y.getDirs = getDirs; - dirs.forEach(function(d) { - var _dir = path.join(dir, d), - stat = fs.lstatSync(_dir); + /** + * Make sure all the paths passed are directories and that they are not in the ignore list. + * @method validatePaths + * @param {Array} paths The array of paths to validate + * @param {String} [ignore=false] A string to call `.indexOf` on a path to determine if it should be ignored + */ + var validatePaths = function (paths, ignore) { + var newpaths = []; + //Shortcut the *, . & ./ shortcuts that shall globbing fixes for us + if (paths === '*' || paths === '.' || paths === './') { + paths = [process.cwd()]; + } - if (stat.isDirectory()) { - if (_dir.indexOf('.') !== 0) { - paths = [].concat(paths, _dir, getDirs(_dir)); - } + // Ensure that we always have an array of some kind. + paths = paths || []; + if (!Y.Lang.isArray(paths)) { + paths = [paths]; } - }); + paths.forEach(function (path) { + var glob = path || ''; - return paths; -}; + if (process.platform === 'win32') { + glob = path.replace(/\//g, '\\\\'); + } -Y.getDirs = getDirs; + var glob_paths = getDirs('.'), + is_globbed = false; -/** -* Make sure all the paths passed are directories and that they are not in the ignore list. -* @method validatePaths -* @param {Array} paths The array of paths to validate -* @param {String} [ignore=false] A string to call `.indexOf` on a path to determine if it should be ignored -*/ + glob_paths.forEach(function (dir) { + //Don't scan things in node_modules + if (dir.indexOf('node_modules') > -1) { + return; + } + if (minimatch(dir, glob, { + period: true + })) { + newpaths.push(dir); + is_globbed = true; + } + }); -var validatePaths = function(paths, ignore) { - var newpaths = []; - //Shortcut the *, . & ./ shortcuts that shall globbing fixes for us - if (paths === '*' || paths === '.' || paths === './') { - paths = [process.cwd()]; - } + if (!is_globbed && (Y.Files.isDirectory(glob))) { + //If minimatch fails, check to see if it's a relative directory + // if it is, add it directly + newpaths.push(glob); + } + }); - // Ensure that we always have an array of some kind. - paths = paths || []; - if (!Y.Lang.isArray(paths)) { - paths = [ paths ]; - } - paths.forEach(function(path) { - var glob = path || ''; + paths = newpaths; + paths.forEach(function (p) { + try { + if (!Y.Files.isDirectory(p)) { + throw ('Path not a directory: ' + p); + } + } catch (e) {} + }); - if (process.platform === 'win32') { - glob = path.replace(/\//g, '\\\\'); + if (!paths || !paths.forEach) { + throw ('Paths should be an array of paths'); } - var glob_paths = getDirs('.'), is_globbed = false; - glob_paths.forEach(function(dir) { - //Don't scan things in node_modules - if (dir.indexOf('node_modules') > -1) { - return; - } - if (minimatch(dir, glob, { period: true })) { - newpaths.push(dir); - is_globbed = true; + if (ignore) { + if (!(ignore instanceof Array)) { + ignore = [ignore]; } - }); - if (!is_globbed && (Y.Files.isDirectory(glob))) { - //If minimatch fails, check to see if it's a relative directory - // if it is, add it directly - newpaths.push(glob); - } - }); - - paths = newpaths; - paths.forEach(function(p) { - try { - if (!Y.Files.isDirectory(p)) { - throw('Path not a directory: ' + p); - } - } catch (e) {} - }); - if (!paths || !paths.forEach) { - throw('Paths should be an array of paths'); - } - if (ignore) { - if (!(ignore instanceof Array)) { - ignore = [ignore]; - } - var p = [], - shouldIgnore = false; - - paths.forEach(function(v) { - shouldIgnore = false; - ignore.forEach(function(i) { - if (!shouldIgnore && v.indexOf(i) !== -1) { - shouldIgnore = true; + var p = [], + shouldIgnore = false; + + paths.forEach(function (v) { + shouldIgnore = false; + ignore.forEach(function (i) { + if (!shouldIgnore && v.indexOf(i) !== -1) { + shouldIgnore = true; + } + }); + if (!shouldIgnore) { + p.push(v); } }); - if (!shouldIgnore) { - p.push(v); - } - }); - paths = p; - } - paths = paths.sort(); - return paths; -}; - -Y.validatePaths = validatePaths; + paths = p; + } + paths = paths.sort(); + return paths; + }; + Y.validatePaths = validatePaths; -/** -* Takes a type string and converts it to a "First letter upper cased" type. e.g. `(string -> String, object -> Object)` -* @method fixType -* @param {String} t The type string to convert -* @return {String} The fixed string -*/ -var fixType = function(t) { - - if (t && t.indexOf('.') === -1) { - t = t.replace(/{/g, '').replace(/}/g, ''); - var firstChar = t.charAt(0), - upperFirstChar = firstChar.toUpperCase(); - - if (firstChar !== upperFirstChar) { - return upperFirstChar + t.substring(1); + /** + * Takes a type string and converts it to a "First letter upper cased" type. e.g. `(string -> String, object -> Object)` + * @method fixType + * @param {String} t The type string to convert + * @return {String} The fixed string + */ + var fixType = function (t) { + if (t && t.indexOf('.') === -1) { + t = t.replace(/{/g, '').replace(/}/g, ''); + var firstChar = t.charAt(0), + upperFirstChar = firstChar.toUpperCase(); + + if (firstChar !== upperFirstChar) { + return upperFirstChar + t.substring(1); + } } - } - return t; -}; + return t; + }; -Y.Lang.fixType = fixType; + Y.Lang.fixType = fixType; -}); + /** + * Produces a normalized web path by joining all the parts and normalizing the + * filesystem-like path into web compatible url. + * Supports relative and absolute paths. + * Courtesy of [Mojito's utils](https://github.com/yahoo/mojito/) + * + * @method webpath + * @param {Array|String*} url the list of parts to be joined and normalized + * @return {String} The joined and normalized url + **/ + function webpath(url) { + var args = [].concat.apply([], arguments), + parts = path.join.apply(path, args).split(/[\\\/]/); + return parts.join('/'); + } + Y.webpath = webpath; +});
    diff --git a/output/api/files/lib_yuidoc.js.html b/output/api/files/lib_yuidoc.js.html index 09b705b9..4a9294da 100644 --- a/output/api/files/lib_yuidoc.js.html +++ b/output/api/files/lib_yuidoc.js.html @@ -19,7 +19,7 @@

    - API Docs for: 0.3.47 + API Docs for: 0.3.49
    @@ -113,9 +113,9 @@

    File: lib/yuidoc.js

    Code licensed under the BSD License: http://yuilibrary.com/license/ */ -var fs = require("fs"), +var fs = require('graceful-fs'), rimraf = require('rimraf'), - path = require("path"); + path = require('path'); /** This is the __module__ description for the `YUIDoc` module. @@ -133,7 +133,7 @@

    File: lib/yuidoc.js

    */ -YUI.add('yuidoc', function(Y) { +YUI.add('yuidoc', function (Y) { /** @@ -143,17 +143,16 @@

    File: lib/yuidoc.js

    * @final * @for YUIDoc */ - var OPTIONS = { quiet: false, writeJSON: true, - outdir: path.join(process.cwd(), 'out'), + outdir: path.join(process.cwd(), 'out'), extension: '.js', exclude: '.DS_Store,.svn,CVS,.git,build_rollup_tmp,build_tmp,node_modules', norecurse: false, version: '0.1.0', paths: [], - themedir: path.join(__dirname, 'themes', 'default'), + themedir: path.join(__dirname, 'themes', 'default'), syntaxtype: 'js' }; @@ -173,7 +172,7 @@

    File: lib/yuidoc.js

    * @constructor * @param config The config object */ - Y.YUIDoc = function(config) { + Y.YUIDoc = function (config) { /** * Holds the number of files that we are processing. * @property filecount @@ -225,54 +224,61 @@

    File: lib/yuidoc.js

    * @method _setDefaultExcludes * @private */ - _setDefaultExcludes: function() { + _setDefaultExcludes: function () { //These should always be excluded var excludes = '.DS_Store,.svn,CVS,.git,build_rollup_tmp,build_tmp,node_modules'.split(','), self = this; - excludes.forEach(function(item) { + excludes.forEach(function (item) { self.options.excludes[item] = true; }); }, + /** * Does post process on self.options. * @method _processConfig * @private */ - _processConfig: function() { + _processConfig: function () { this.options.extensions = Y.Array.hash(this.options.extension.split(',')); this.options.excludes = Y.Array.hash(this.options.exclude.split(',')); this._setDefaultExcludes(); }, + /** * Walks the paths and parses the directory contents * @method walk * @private */ - walk: function() { - Y.each(this.options.paths, function(dir) { + walk: function () { + Y.each(this.options.paths, function (dir) { this.parsedir(dir); }, this); }, + /** * Walks the passed directory and grabs all the files recursively. * @method parsedir * @param {String} dir The directory to parse the contents of. * @private */ - parsedir: function(dir) { + parsedir: function (dir) { if (!Y.Files.isDirectory(dir)) { - throw('Can not find directory: ' + dir); + throw ('Can not find directory: ' + dir); } - var allfiles = fs.readdirSync(dir), stats, - files = [], fullpath, self = this; - + + var allfiles = fs.readdirSync(dir), + stats, + files = [], + fullpath, self = this; + if (dir in self.options.excludes) { return; } + allfiles = allfiles.sort(); - Y.each(allfiles, function(filename) { + Y.each(allfiles, function (filename) { if (!(filename in self.options.excludes)) { fullpath = path.join(dir, filename); @@ -285,10 +291,12 @@

    File: lib/yuidoc.js

    } } }); + if (!(dir in self.options.excludes)) { this.parsefiles(dir, files); } }, + /** * Gathers all the file data and populates the filemap and dirmap hashes. * @method parsefiles @@ -296,11 +304,14 @@

    File: lib/yuidoc.js

    * @param {Array} files List of files to parse. * @private */ - parsefiles: function(dir, files) { + parsefiles: function (dir, files) { var self = this; - files = files.sort(); - Y.each(files, function(filename) { - var ext = path.extname(filename), text, fullpath; + files = files.sort(); + + Y.each(files, function (filename) { + var ext = path.extname(filename), + text, + fullpath; if (ext) { if (ext in self.options.extensions) { @@ -321,9 +332,12 @@

    File: lib/yuidoc.js

    } }); }, - getSelleck: function(fullpath) { + + getSelleck: function (fullpath) { var self = this, - base, comp, json; + base, + comp, + json; if (self.options.selleck) { base = path.dirname(fullpath); @@ -331,7 +345,7 @@

    File: lib/yuidoc.js

    //Y.log('Checking for Selleck data: ' + comp, 'info', 'yuidoc'); if (Y.Files.exists(comp)) { try { - var json = JSON.parse(fs.readFileSync(comp, 'utf8')); + json = JSON.parse(fs.readFileSync(comp, 'utf8')); delete json.examples; //Remove the selleck example data, we only want the comp info self.selleck[fullpath] = json; } catch (e) { @@ -340,6 +354,7 @@

    File: lib/yuidoc.js

    } } }, + /** * Writes the parser JSON data to disk. * @method writeJSON @@ -347,21 +362,23 @@

    File: lib/yuidoc.js

    * @private * @return {Object} The JSON data returned from the DocParser */ - writeJSON: function(parser) { + writeJSON: function (parser) { var self = this, - data; + data, + file, + out; data = parser.data; data.warnings = parser.warnings; if (self.selleck && self.options.selleck && data.files && data.modules) { - Object.keys(self.selleck).forEach(function(file) { - Object.keys(data.files).forEach(function(f) { + Object.keys(self.selleck).forEach(function (file) { + Object.keys(data.files).forEach(function (f) { if (file === f) { var mods = data.files[f].modules; if (mods) { - Object.keys(mods).forEach(function(mod) { + Object.keys(mods).forEach(function (mod) { if (data.modules[mod]) { if (!data.modules[mod].extra) { data.modules[mod].extra = {}; @@ -381,11 +398,13 @@

    File: lib/yuidoc.js

    if (self.options.writeJSON) { // Y.log(Y.JSON.stringify(parser.data, null, 4)); - var file = path.join(self.options.outdir, 'data.json'), out; + file = path.join(self.options.outdir, 'data.json'); + if (Y.Files.exists(self.options.outdir) && !self.options.nodeleteout) { Y.log('Found out dir, deleting: ' + self.options.outdir, 'warn', 'yuidoc'); rimraf.sync(self.options.outdir); } + if (!Y.Files.exists(self.options.outdir)) { Y.log('Making out dir: ' + self.options.outdir, 'info', 'yuidoc'); try { @@ -394,9 +413,11 @@

    File: lib/yuidoc.js

    Y.log('Outdir creation failed', 'warn', 'yuidoc'); } } - + out = fs.createWriteStream(file, { - flags: "w", encoding: Y.charset, mode: 0644 + flags: "w", + encoding: Y.charset, + mode: 0644 }); out.write(JSON.stringify(data, null, 4)); out.end(); @@ -404,26 +425,28 @@

    File: lib/yuidoc.js

    return data; }, - lint: function(warnings) { + + lint: function (warnings) { var code = 0, count = 0; if (warnings && warnings.length) { code = 1; console.log('YUIDoc found', warnings.length, 'lint errors in your docs'); - warnings.forEach(function(item) { + warnings.forEach(function (item) { count++; console.log('#' + count, item.message, item.line + '\n'); }); process.exit(code); } }, + /** * Process the config, walk the file tree and write out the JSON data. * @method run * @return {Object} The JSON data returned from the DocParser */ - run: function() { + run: function () { /** * Timestamp holder so we know when YUIDoc started the parse process. * @property starttime @@ -432,15 +455,13 @@

    File: lib/yuidoc.js

    Y.log('YUIDoc Starting from: ' + this.options.paths.join(','), 'info', 'yuidoc'); this.starttime = new Date().getTime(); - var self = this; - this._processConfig(); this.walk(); var json = this.writeJSON(new Y.DocParser({ - syntaxtype: self.options.syntaxtype, - filemap: self.filemap, - dirmap: self.dirmap + syntaxtype: this.options.syntaxtype, + filemap: this.filemap, + dirmap: this.dirmap }).parse()); if (this.options.lint) { diff --git a/output/api/index.html b/output/api/index.html index 222fdac4..f2f022ff 100644 --- a/output/api/index.html +++ b/output/api/index.html @@ -19,7 +19,7 @@

    - API Docs for: 0.3.47 + API Docs for: 0.3.49
    diff --git a/output/api/modules/yuidoc.html b/output/api/modules/yuidoc.html index a59d349d..b4712b5b 100644 --- a/output/api/modules/yuidoc.html +++ b/output/api/modules/yuidoc.html @@ -19,7 +19,7 @@

    - API Docs for: 0.3.47 + API Docs for: 0.3.49
    @@ -112,7 +112,7 @@

    yuidoc Module

    - Defined in: lib/yuidoc.js:50 + Defined in: lib/yuidoc.js:49
    diff --git a/output/args/index.html b/output/args/index.html index 9fed455b..5b41d958 100644 --- a/output/args/index.html +++ b/output/args/index.html @@ -45,7 +45,7 @@

    Running YUIDoc on the Command Line

    YUI Doc generates API documentation from a modified JavaDoc syntax.
     
    -Current version (0.3.47)
    +Current version (0.3.49)
     
     Usage: yuidoc <options> <input path>