diff options
| author | Misko Hevery | 2011-01-19 15:42:11 -0800 |
|---|---|---|
| committer | Misko Hevery | 2011-01-24 14:23:51 -0800 |
| commit | c2f2587a79aeb77aad66f081cf924a79348a698e (patch) | |
| tree | 8f5aa4cc6e7189befb834388b2102d1eda88a975 /docs/src | |
| parent | 5d0d34ae72a9ca47f1b2dabda60711ad16ee9313 (diff) | |
| download | angular.js-c2f2587a79aeb77aad66f081cf924a79348a698e.tar.bz2 | |
fixed example rendering, add tests for it.
Diffstat (limited to 'docs/src')
| -rw-r--r-- | docs/src/gen-docs.js | 2 | ||||
| -rw-r--r-- | docs/src/ngdoc.js | 5 | ||||
| -rw-r--r-- | docs/src/reader.js | 2 | ||||
| -rw-r--r-- | docs/src/templates/doc_widgets.css | 2 | ||||
| -rw-r--r-- | docs/src/templates/doc_widgets.js | 16 | ||||
| -rw-r--r-- | docs/src/templates/docs-scenario.html | 2 | ||||
| -rw-r--r-- | docs/src/templates/docs.js | 8 | ||||
| -rw-r--r-- | docs/src/templates/syntaxhighlighter/shBrushJScript.js | 6 | ||||
| -rw-r--r-- | docs/src/templates/syntaxhighlighter/shBrushXml.js | 10 | ||||
| -rw-r--r-- | docs/src/templates/syntaxhighlighter/shCore.css | 2 | ||||
| -rw-r--r-- | docs/src/templates/syntaxhighlighter/shCore.js | 2 | ||||
| -rw-r--r-- | docs/src/templates/syntaxhighlighter/shThemeDefault.css | 2 | ||||
| -rw-r--r-- | docs/src/writer.js | 12 |
13 files changed, 36 insertions, 35 deletions
diff --git a/docs/src/gen-docs.js b/docs/src/gen-docs.js index 0dee586b..1c03a0f1 100644 --- a/docs/src/gen-docs.js +++ b/docs/src/gen-docs.js @@ -38,7 +38,7 @@ var writes = callback.chain(function(){ writer.copy('jquery.min.js', writes.waitFor()); }); writes.onDone(function(){ - console.log('DONE. Generated ' + docs.length + ' pages in ' + + console.log('DONE. Generated ' + docs.length + ' pages in ' + (now()-start) + 'ms.' ); }); work.onDone(writes); diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js index 8481f7dc..daa44fef 100644 --- a/docs/src/ngdoc.js +++ b/docs/src/ngdoc.js @@ -76,6 +76,7 @@ Doc.prototype = { this.description = markdown(this.description); this['this'] = markdown(this['this']); this.exampleDescription = markdown(this.exampleDescription || this.exampleDesc); + return this; function flush(){ if (atName) { @@ -144,13 +145,13 @@ Doc.prototype = { dom.h(method.shortName + '(' + signature.join(', ') + ')', method, function(){ dom.html(method.description); method.html_usage_parameters(dom); - dom.example(method.example, false); + dom.example(method.exampleDescription, method.example, false); }); }); dom.h('Properties', self.properties, function(property){ dom.h(property.name, function(){ dom.text(property.description); - dom.example(property.example, false); + dom.example(property.exampleDescription, property.example, false); }); }); diff --git a/docs/src/reader.js b/docs/src/reader.js index 8f9f22c3..5a653cd6 100644 --- a/docs/src/reader.js +++ b/docs/src/reader.js @@ -88,4 +88,4 @@ function findNgDocInJsFile(file, callback) { -exports.collect = collect;
\ No newline at end of file +exports.collect = collect; diff --git a/docs/src/templates/doc_widgets.css b/docs/src/templates/doc_widgets.css index 8361f105..9f007f0e 100644 --- a/docs/src/templates/doc_widgets.css +++ b/docs/src/templates/doc_widgets.css @@ -32,4 +32,4 @@ li.doc-example-live { div.syntaxhighlighter { padding-bottom: 1px !important; /* fix to remove unnecessary scrollbars http://is.gd/gSMgC */ -}
\ No newline at end of file +} diff --git a/docs/src/templates/doc_widgets.js b/docs/src/templates/doc_widgets.js index 18aeeacb..2d1ab8c6 100644 --- a/docs/src/templates/doc_widgets.js +++ b/docs/src/templates/doc_widgets.js @@ -1,5 +1,5 @@ (function(){ - + var angularJsUrl; var scripts = document.getElementsByTagName("script"); var filename = /(.*\/)angular([^\/]*)/; @@ -10,7 +10,7 @@ } } - + var HTML_TEMPLATE = '<!doctype html>\n' + '<html xmlns:ng="http://angularjs.org">\n' + @@ -32,15 +32,15 @@ var tabs = angular.element( '<ul class="doc-example">' + '<li class="doc-example-heading"><h3>Source</h3></li>' + - '<li class="doc-example-source" ng:non-bindable>' + - '<pre class="brush: js; html-script: true; highlight: [' + + '<li class="doc-example-source" ng:non-bindable>' + + '<pre class="brush: js; html-script: true; highlight: [' + code.hilite + ']; toolbar: false;"></pre></li>' + '<li class="doc-example-heading"><h3>Live Preview</h3></li>' + '<li class="doc-example-live">' + exampleSrc +'</li>' + '<li class="doc-example-heading"><h3>Scenario Test</h3></li>' + '<li class="doc-example-scenario"><pre class="brush: js">' + scenario.text() + '</pre></li>' + '</ul>'); - + tabs.find('li.doc-example-source > pre').text(HTML_TEMPLATE.replace('_HTML_SOURCE_', code.html)); element.html(''); @@ -54,7 +54,7 @@ alert(e); } }); - + function indent(text) { var lines = text.split(/\n/); var lineNo = []; @@ -66,5 +66,5 @@ } return {html: lines.join('\n'), hilite: lineNo.join(',') }; }; - -})();
\ No newline at end of file + +})(); diff --git a/docs/src/templates/docs-scenario.html b/docs/src/templates/docs-scenario.html index c75155c5..bc244d5d 100644 --- a/docs/src/templates/docs-scenario.html +++ b/docs/src/templates/docs-scenario.html @@ -7,4 +7,4 @@ </head> <body> </body> -</html>
\ No newline at end of file +</html> diff --git a/docs/src/templates/docs.js b/docs/src/templates/docs.js index 6bf86ed3..f1cfc3e7 100644 --- a/docs/src/templates/docs.js +++ b/docs/src/templates/docs.js @@ -2,7 +2,7 @@ DocsController.$inject = ['$location', '$browser', '$window']; function DocsController($location, $browser, $window) { this.pages = NG_PAGES; window.$root = this.$root; - + this.getUrl = function(page){ return '#!' + page.name; }; @@ -10,7 +10,7 @@ function DocsController($location, $browser, $window) { this.getCurrentPartial = function(){ return './' + this.getTitle() + '.html'; }; - + this.getTitle = function(){ var hashPath = $location.hashPath || '!angular'; if (hashPath.match(/^!angular/)) { @@ -18,7 +18,7 @@ function DocsController($location, $browser, $window) { } return this.partialTitle; }; - + this.getClass = function(page) { var depth = page.name.split(/\./).length - 1, cssClass = 'level-' + depth + (page.name == this.getTitle() ? ' selected' : ''); @@ -37,7 +37,7 @@ function DocsController($location, $browser, $window) { "subject=" + escape("Feedback on " + $location.href) + "&" + "body=" + escape("Hi there,\n\nI read " + $location.href + " and wanted to ask ...."); }; - + } angular.filter('short', function(name){ diff --git a/docs/src/templates/syntaxhighlighter/shBrushJScript.js b/docs/src/templates/syntaxhighlighter/shBrushJScript.js index ff98daba..d52a77b2 100644 --- a/docs/src/templates/syntaxhighlighter/shBrushJScript.js +++ b/docs/src/templates/syntaxhighlighter/shBrushJScript.js @@ -7,7 +7,7 @@ * * @version * 3.0.83 (July 02 2010) - * + * * @copyright * Copyright (C) 2004-2010 Alex Gorbatchev. * @@ -29,7 +29,7 @@ ; var r = SyntaxHighlighter.regexLib; - + this.regexList = [ { regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings { regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings @@ -38,7 +38,7 @@ { regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords ]; - + this.forHtmlScript(r.scriptScriptTags); }; diff --git a/docs/src/templates/syntaxhighlighter/shBrushXml.js b/docs/src/templates/syntaxhighlighter/shBrushXml.js index 69d9fd0b..ac879949 100644 --- a/docs/src/templates/syntaxhighlighter/shBrushXml.js +++ b/docs/src/templates/syntaxhighlighter/shBrushXml.js @@ -7,7 +7,7 @@ * * @version * 3.0.83 (July 02 2010) - * + * * @copyright * Copyright (C) 2004-2010 Alex Gorbatchev. * @@ -28,8 +28,8 @@ tag = new XRegExp('(<|<)[\\s\\/\\?]*(?<name>[:\\w-\\.]+)', 'xg').exec(code), result = [] ; - - if (match.attributes != null) + + if (match.attributes != null) { var attributes, regex = new XRegExp('(?<name> [\\w:\\-\\.]+)' + @@ -37,7 +37,7 @@ '(?<value> ".*?"|\'.*?\'|\\w+)', 'xg'); - while ((attributes = regex.exec(code)) != null) + while ((attributes = regex.exec(code)) != null) { result.push(new constructor(attributes.name, match.index + attributes.index, 'color1')); result.push(new constructor(attributes.value, match.index + attributes.index + attributes[0].indexOf(attributes.value), 'string')); @@ -51,7 +51,7 @@ return result; } - + this.regexList = [ { regex: new XRegExp('(\\<|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\\>|>)', 'gm'), css: 'color2' }, // <![ ... [ ... ]]> { regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, // <!-- ... --> diff --git a/docs/src/templates/syntaxhighlighter/shCore.css b/docs/src/templates/syntaxhighlighter/shCore.css index 34f6864a..4f0021e2 100644 --- a/docs/src/templates/syntaxhighlighter/shCore.css +++ b/docs/src/templates/syntaxhighlighter/shCore.css @@ -7,7 +7,7 @@ * * @version * 3.0.83 (July 02 2010) - * + * * @copyright * Copyright (C) 2004-2010 Alex Gorbatchev. * diff --git a/docs/src/templates/syntaxhighlighter/shCore.js b/docs/src/templates/syntaxhighlighter/shCore.js index b47b6454..effcf59d 100644 --- a/docs/src/templates/syntaxhighlighter/shCore.js +++ b/docs/src/templates/syntaxhighlighter/shCore.js @@ -7,7 +7,7 @@ * * @version * 3.0.83 (July 02 2010) - * + * * @copyright * Copyright (C) 2004-2010 Alex Gorbatchev. * diff --git a/docs/src/templates/syntaxhighlighter/shThemeDefault.css b/docs/src/templates/syntaxhighlighter/shThemeDefault.css index 13654117..8a870e4e 100644 --- a/docs/src/templates/syntaxhighlighter/shThemeDefault.css +++ b/docs/src/templates/syntaxhighlighter/shThemeDefault.css @@ -7,7 +7,7 @@ * * @version * 3.0.83 (July 02 2010) - * + * * @copyright * Copyright (C) 2004-2010 Alex Gorbatchev. * diff --git a/docs/src/writer.js b/docs/src/writer.js index eb1b190f..c72a54a4 100644 --- a/docs/src/writer.js +++ b/docs/src/writer.js @@ -13,17 +13,17 @@ function output(docs, content, callback){ exports.output = function(file, content, callback){ //console.log('writing', OUTPUT_DIR + file, '...'); fs.writeFile( - OUTPUT_DIR + file, - exports.toString(content), + OUTPUT_DIR + file, + exports.toString(content), callback); }; exports.toString = function toString(obj){ switch (typeof obj) { - case 'string': + case 'string': return obj; - case 'object': + case 'object': if (obj instanceof Array) { obj.forEach(function (value, key){ obj[key] = toString(value); @@ -54,8 +54,8 @@ exports.copy = function(filename, callback){ fs.readFile('docs/src/templates/' + filename, function(err, content){ if (err) return callback.error(err); fs.writeFile( - OUTPUT_DIR + filename, - content, + OUTPUT_DIR + filename, + content, callback); }); }; |
