diff options
| author | Peter Bacon Darwin | 2014-02-12 22:47:42 +0000 |
|---|---|---|
| committer | Peter Bacon Darwin | 2014-02-16 19:03:41 +0000 |
| commit | 389d4879da4aa620ee95d789b19ff9be44eb730a (patch) | |
| tree | 93352ddc8738a975904a1774d51b93d585ca1075 /docs/src | |
| parent | a564160511bf1bbed5a4fe5d2981fae1bb664eca (diff) | |
| download | angular.js-389d4879da4aa620ee95d789b19ff9be44eb730a.tar.bz2 | |
chore(doc-gen): new docs
chore(doc-gen): implement dgeni
Diffstat (limited to 'docs/src')
| -rw-r--r-- | docs/src/SiteMap.js | 33 | ||||
| -rw-r--r-- | docs/src/appCache.js | 76 | ||||
| -rw-r--r-- | docs/src/dom.js | 184 | ||||
| -rw-r--r-- | docs/src/example.js | 160 | ||||
| -rwxr-xr-x | docs/src/gen-docs.js | 150 | ||||
| -rw-r--r-- | docs/src/ignore.words | 701 | ||||
| -rw-r--r-- | docs/src/ngdoc.js | 1435 | ||||
| -rw-r--r-- | docs/src/reader.js | 97 | ||||
| -rw-r--r-- | docs/src/templates/.htaccess | 19 | ||||
| -rw-r--r-- | docs/src/templates/css/animations.css | 62 | ||||
| -rw-r--r-- | docs/src/templates/css/doc_widgets.css | 150 | ||||
| -rw-r--r-- | docs/src/templates/css/docs.css | 575 | ||||
| -rw-r--r-- | docs/src/templates/css/prettify.css | 51 | ||||
| -rw-r--r-- | docs/src/templates/docs-scenario.html | 44 | ||||
| -rw-r--r-- | docs/src/templates/favicon.ico | bin | 1150 -> 0 bytes | |||
| -rw-r--r-- | docs/src/templates/index.html | 388 | ||||
| -rw-r--r-- | docs/src/templates/js/docs.js | 933 | ||||
| -rw-r--r-- | docs/src/templates/offline.html | 4 | ||||
| -rw-r--r-- | docs/src/writer.js | 166 |
19 files changed, 0 insertions, 5228 deletions
diff --git a/docs/src/SiteMap.js b/docs/src/SiteMap.js deleted file mode 100644 index 16b10266..00000000 --- a/docs/src/SiteMap.js +++ /dev/null @@ -1,33 +0,0 @@ -exports.SiteMap = SiteMap; - -/** - * @see http://www.sitemaps.org/protocol.php - * - * @param docs - * @returns {SiteMap} - */ -function SiteMap(docs){ - this.render = function() { - var map = []; - map.push('<?xml version="1.0" encoding="UTF-8"?>'); - map.push('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'); - docs.forEach(function(doc){ - map.push(' <url><loc>http://docs.angularjs.org/' + - encode(doc.section) + '/' + - encode(doc.id) + - '</loc><changefreq>weekly</changefreq></url>'); - }); - map.push('</urlset>'); - map.push(''); - return map.join('\n'); - }; - - function encode(text){ - return text - .replace(/&/mg, '&') - .replace(/</mg, '<') - .replace(/>/mg, '>') - .replace(/'/mg, ''') - .replace(/"/mg, '"'); - } -} diff --git a/docs/src/appCache.js b/docs/src/appCache.js deleted file mode 100644 index 1a816eb8..00000000 --- a/docs/src/appCache.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* Generate appCache Manifest file here -*/ - -exports.appCache = appCache; -var fs = require('q-io/fs'); -var Q = require('qq'); -function identity($) {return $;} - -function appCache(path) { - if(!path) { - return appCacheTemplate(); - } - var blackList = ["build/docs/offline.html", - "build/docs/sitemap.xml", - "build/docs/robots.txt", - "build/docs/docs-scenario.html", - "build/docs/docs-scenario.js", - "build/docs/appcache.manifest", - "build/docs/.htaccess" - ]; - - var result = ["CACHE MANIFEST", - "# " + new Date().toISOString(), - "", - "# cache all of these", - "CACHE:", - "../angular.min.js"]; - - var resultPostfix = ["", - "FALLBACK:", - "/ /build/docs/index.html", - "", - "# allow access to google analytics and twitter when we are online", - "NETWORK:", - "*"]; - - var promise = fs.listTree(path).then(function(files){ - var fileFutures = []; - files.forEach(function(file){ - fileFutures.push(fs.isFile(file).then(function(isFile){ - if (isFile && blackList.indexOf(file) == -1) { - return file.replace('build/docs/',''); - } - })); - }); - return Q.deep(fileFutures); - }).then(function(files){ - return result.concat(files.filter(identity)).concat(resultPostfix).join('\n'); - }); - - return promise; -} - -function appCacheTemplate() { - return ["CACHE MANIFEST", - "# " + new Date().toISOString(), - "", - "# cache all of these", - "CACHE:", - "syntaxhighlighter/syntaxhighlighter-combined.js", - "../angular.min.js", - "docs-combined.js", - "docs-data.js", - "docs-combined.css", - "syntaxhighlighter/syntaxhighlighter-combined.css", - "img/texture_1.png", - "img/yellow_bkgnd.jpg", - "", - "FALLBACK:", - "/ /build/docs/offline.html", - "", - "# allow access to google analytics and twitter when we are online", - "NETWORK:", - "*"].join('\n'); -} diff --git a/docs/src/dom.js b/docs/src/dom.js deleted file mode 100644 index e696faf4..00000000 --- a/docs/src/dom.js +++ /dev/null @@ -1,184 +0,0 @@ -/** - * DOM generation class - */ - -exports.DOM = DOM; -exports.htmlEscape = htmlEscape; -exports.normalizeHeaderToId = normalizeHeaderToId; - -////////////////////////////////////////////////////////// - -function htmlEscape(text){ - return text - .replace(/&/g, '&') - .replace(/</g, '<') - .replace(/>/g, '>') - .replace(/\{\{/g, '<span>{{</span>') - .replace(/\}\}/g, '<span>}}</span>'); -} - -function nonEmpty(header) { - return !!header; -} - -function idFromCurrentHeaders(headers) { - if (headers.length === 1) return headers[0]; - // Do not include the first level title, as that's the title of the page. - return headers.slice(1).filter(nonEmpty).join('_'); -} - -function normalizeHeaderToId(header) { - if (typeof header !== 'string') { - return ''; - } - - return header.toLowerCase() - .replace(/<.*>/g, '') // html tags - .replace(/[\!\?\:\.\']/g, '') // special characters - .replace(/&#\d\d;/g, '') // html entities - .replace(/\(.*\)/mg, '') // stuff in parenthesis - .replace(/\s$/, '') // trailing spaces - .replace(/\s+/g, '-'); // replace whitespaces with dashes -} - - -function DOM() { - this.out = []; - this.headingDepth = 0; - this.currentHeaders = []; - this.anchors = []; -} - -var INLINE_TAGS = { - i: true, - b: true, - a: true -}; - -DOM.prototype = { - toString: function() { - return this.out.join(''); - }, - - text: function(content) { - if (typeof content == "string") { - this.out.push(htmlEscape(content)); - } else if (typeof content == 'function') { - content.call(this, this); - } else if (content instanceof Array) { - this.ul(content); - } - }, - - html: function(html) { - if (!html) return; - - var self = this; - // rewrite header levels, add ids and collect the ids - html = html.replace(/<h(\d)(.*?)>([\s\S]+?)<\/h\1>/gm, function(_, level, attrs, content) { - level = parseInt(level, 10) + self.headingDepth; // change header level based on the context - - self.currentHeaders[level - 1] = normalizeHeaderToId(content); - self.currentHeaders.length = level; - - var id = idFromCurrentHeaders(self.currentHeaders); - self.anchors.push(id); - return '<h' + level + attrs + ' id="' + id + '">' + content + '</h' + level + '>'; - }); - - // collect anchors - html = html.replace(/<a name="(\w*)">/g, function(match, anchor) { - self.anchors.push(anchor); - return match; - }); - - this.out.push(html); - }, - - tag: function(name, attr, text) { - if (!text) { - text = attr; - attr = {}; - if (name == 'code') - attr['ng:non-bindable'] = ''; - } - this.out.push('<' + name); - for(var key in attr) { - this.out.push(" " + key + '="' + attr[key] + '"'); - } - this.out.push('>'); - this.text(text); - this.out.push('</' + name + '>'); - if (!INLINE_TAGS[name]) - this.out.push('\n'); - }, - - code: function(text) { - this.tag('pre', {'class':"prettyprint linenums"}, text); - }, - - div: function(attr, text) { - this.tag('div', attr, text); - }, - - h: function(heading, content, fn){ - if (content==undefined || (content instanceof Array && content.length == 0)) return; - - this.headingDepth++; - this.currentHeaders[this.headingDepth - 1] = normalizeHeaderToId(heading); - this.currentHeaders.length = this.headingDepth; - - var className = null, - anchor = null; - if (typeof heading == 'string') { - var id = idFromCurrentHeaders(this.currentHeaders); - this.anchors.push(id); - anchor = {'id': id}; - var classNameValue = this.currentHeaders[this.headingDepth - 1] - if(classNameValue == 'hide') classNameValue = ''; - className = {'class': classNameValue}; - } - this.tag('h' + this.headingDepth, anchor, heading); - if (content instanceof Array) { - this.ul(content, className, fn); - } else if (fn) { - this.tag('div', className, function() { - fn.call(this, content); - }); - } else { - this.tag('div', className, content); - } - this.headingDepth--; - }, - - h1: function(attr, text) { - this.tag('h1', attr, text); - }, - - h2: function(attr, text) { - this.tag('h2', attr, text); - }, - - h3: function(attr, text) { - this.tag('h3', attr, text); - }, - - p: function(attr, text) { - this.tag('p', attr, text); - }, - - ul: function(list, attr, fn) { - if (typeof attr == 'function') { - fn = attr; - attr = {}; - } - this.tag('ul', attr, function(dom){ - list.forEach(function(item){ - dom.out.push('<li>'); - dom.text(fn ? fn(item) : item); - dom.out.push('</li>\n'); - }); - }); - } - -}; diff --git a/docs/src/example.js b/docs/src/example.js deleted file mode 100644 index 7a32ce04..00000000 --- a/docs/src/example.js +++ /dev/null @@ -1,160 +0,0 @@ -var seqCount = 0; -var usedIds = {}; -var makeUnique = { - 'index.html': true, - 'style.css': true, - 'script.js': true, - 'unit.js': true, - 'spec.js': true, - 'scenario.js': true, - 'protractorTest.js': true -} - -function ids(list) { - return list.map(function(item) { return item.id; }).join(' '); -}; - - -exports.Example = function(scenarios, protractorTests) { - this.module = ''; - this.deps = ['angular.js']; - this.html = []; - this.css = []; - this.js = []; - this.json = []; - this.unit = []; - this.scenario = []; - this.scenarios = scenarios; - this.protractorTest = []; - this.protractorTests = protractorTests; -} - -exports.Example.prototype.setModule = function(module) { - if (module) { - this.module = module; - } -}; - -exports.Example.prototype.addDeps = function(deps) { - deps && deps.split(/[\s\,]/).forEach(function(dep) { - if (dep) { - this.deps.push(dep); - } - }, this); -}; - -exports.Example.prototype.addSource = function(name, content) { - var ext = name == 'scenario.js' ? 'scenario' : name.split('.')[1], - id = name; - - if (name == 'protractorTest.js') { - ext = 'protractorTest'; - } - - if (makeUnique[name] && usedIds[id]) { - id = name + '-' + (seqCount++); - } - usedIds[id] = true; - - this[ext].push({name: name, content: content, id: id}); - if (name.match(/\.js$/) && name !== 'spec.js' && name !== 'unit.js' && name != 'scenario.js') { - this.deps.push(name); - } - if (ext == 'scenario') { - this.scenarios.push(content); - } - if (ext == 'protractorTest') { - this.protractorTests.push(content); - } -}; - -exports.Example.prototype.enableAnimations = function() { - this.animations = true; -}; - -exports.Example.prototype.disableAnimations = function() { - this.animations = false; -}; - -exports.Example.prototype.toHtml = function() { - var html = "<h2>Source</h2>\n"; - html += this.toHtmlEdit(); - html += this.toHtmlTabs(); - if(this.animations) { - html += '<div class="pull-right">'; - html += ' <button class="btn btn-primary" ng-click="animationsOff=true" ng-hide="animationsOff">Animations on</button>'; - html += ' <button class="btn btn-primary disabled" ng-click="animationsOff=false" ng-show="animationsOff">Animations off</button>'; - html += '</div>'; - } - html += "<h2>Demo</h2>\n"; - html += this.toHtmlEmbed(); - return html; -}; - - -exports.Example.prototype.toHtmlEdit = function() { - var out = []; - out.push('<div source-edit="' + this.module + '"'); - out.push(' source-edit-deps="' + this.deps.join(' ') + '"'); - out.push(' source-edit-html="' + ids(this.html) + '"'); - out.push(' source-edit-css="' + ids(this.css) + '"'); - out.push(' source-edit-js="' + ids(this.js) + '"'); - out.push(' source-edit-json="' + ids(this.json) + '"'); - out.push(' source-edit-unit="' + ids(this.unit) + '"'); - out.push(' source-edit-scenario="' + ids(this.scenario) + '"'); - out.push(' source-edit-protractor="' + ids(this.protractorTest) + '"'); - out.push('></div>\n'); - return out.join(''); -}; - -exports.Example.prototype.toHtmlTabs = function() { - var out = [], - self = this; - - out.push('<div class="tabbable">'); - htmlTabs(this.html); - htmlTabs(this.css); - htmlTabs(this.js); - htmlTabs(this.json); - htmlTabs(this.unit); - htmlTabs(this.scenario); - htmlTabs(this.protractorTest); - out.push('</div>'); - return out.join(''); - - function htmlTabs(sources) { - sources.forEach(function(source) { - var wrap = '', - isCss = source.name.match(/\.css$/), - name = source.name; - - if (name === 'index.html') { - wrap = ' ng-html-wrap="' + self.module + ' ' + self.deps.join(' ') + '"'; - } - if (name == 'scenario.js') name = 'ngScenario e2e test'; - if (name == 'protractorTest.js') name = 'Protractor e2e test'; - - out.push( - '<div class="tab-pane" title="' + name + '">\n' + - '<pre class="prettyprint linenums" ng-set-text="' + source.id + '"' + wrap + '></pre>\n' + - (isCss - ? ('<style type="text/css" id="' + source.id + '">' + source.content + '</style>\n') - : ('<script type="text/ng-template" id="' + source.id + '">' + source.content + '</script>\n') ) + - '</div>\n'); - }); - } -}; - -exports.Example.prototype.toHtmlEmbed = function() { - var out = []; - out.push('<div class="well doc-example-live animate-container"'); - if(this.animations) { - out.push(" ng-class=\"{'animations-off':animationsOff == true}\""); - } - out.push(' ng-embed-app="' + this.module + '"'); - out.push(' ng-set-html="' + this.html[0].id + '"'); - out.push(' ng-eval-javascript="' + ids(this.js) + '">'); - out.push('</div>'); - return out.join(''); -}; - diff --git a/docs/src/gen-docs.js b/docs/src/gen-docs.js deleted file mode 100755 index ff8d8311..00000000 --- a/docs/src/gen-docs.js +++ /dev/null @@ -1,150 +0,0 @@ -var reader = require('./reader.js'), - ngdoc = require('./ngdoc.js'), - writer = require('./writer.js'), - SiteMap = require('./SiteMap.js').SiteMap, - appCache = require('./appCache.js').appCache, - Q = require('qq'), - errorsJson = require('../../build/errors.json').errors; - -var start = now(); -var docs; - -writer.makeDir('build/docs/', true).then(function() { - return writer.makeDir('build/docs/partials/'); -}).then(function() { - return writer.makeDir('build/docs/components/'); -}).then(function() { - return writer.makeDir('build/docs/components/bootstrap'); -}).then(function() { - return writer.makeDir('build/docs/components/font-awesome'); -}).then(function() { - return writer.makeDir('build/docs/e2etests'); -}).then(function() { - console.log('Generating AngularJS Reference Documentation...'); - return reader.collect(); -}).then(function generateHtmlDocPartials(docs_) { - docs = docs_; - ngdoc.merge(docs); - var fileFutures = [], namespace; - - var isErrorDocPresent = function (search) { - return docs.some(function (doc) { - return doc.ngdoc === 'error' && doc.name === search; - }); - }; - - // Check that each generated error code has a doc file. - Object.keys(errorsJson).forEach(function (prop) { - if (typeof errorsJson[prop] === 'object') { - namespace = errorsJson[prop]; - Object.keys(namespace).forEach(function (code) { - var search = prop + ':' + code; - if (!isErrorDocPresent(search)) { - throw new Error('Missing ngdoc file for error code: ' + search); - } - }); - } else { - if (!isErrorDocPresent(prop)) { - throw new Error('Missing ngdoc file for error code: ' + prop); - } - } - }); - - docs.forEach(function(doc){ - // this hack is here because on OSX angular.module and angular.Module map to the same file. - var id = doc.id.replace('angular.Module', 'angular.IModule'); - - fileFutures.push(writer.output('partials/' + doc.section + '/' + id + '.html', doc.html())); - // If it has a sample Protractor test, output that as well. - if (doc.protractorTests.length) { - fileFutures.push(writer.output('ptore2e/' + doc.section + '/' + id + '.jquery_test.js', - ngdoc.writeProtractorTest(doc, 'index-jq-nocache.html#!/'))); - fileFutures.push(writer.output('ptore2e/' + doc.section + '/' + id + '.jqlite_test.js', - ngdoc.writeProtractorTest(doc, 'index-nocache.html#!/'))); - } - }); - - ngdoc.checkBrokenLinks(docs); - - writeTheRest(fileFutures); - - return Q.deep(fileFutures); -}).then(function generateManifestFile() { - return appCache('build/docs/').then(function(list) { - writer.output('appcache-offline.manifest', list); - }); -}).then(function printStats() { - console.log('DONE. Generated ' + docs.length + ' pages in ' + (now()-start) + 'ms.' ); -}).done(); - - -function writeTheRest(writesFuture) { - var metadata = ngdoc.metadata(docs); - var versions = ngdoc.ngVersions(); - var currentVersion = ngdoc.ngCurrentVersion(); - - writesFuture.push(writer.symlink('../../docs/content/notes', 'build/docs/notes', 'directory')); - writesFuture.push(writer.symlinkTemplate('css', 'directory')); - writesFuture.push(writer.symlink('../../docs/img', 'build/docs/img', 'directory')); - writesFuture.push(writer.symlinkTemplate('js', 'directory')); - - var manifest = 'manifest="/build/docs/appcache.manifest"'; - - writesFuture.push(writer.copyDir('bower_components/components-font-awesome/css', 'components/font-awesome/css')); - writesFuture.push(writer.copyDir('bower_components/components-font-awesome/font', 'components/font-awesome/font')); - writesFuture.push(writer.copyDir('bower_components/bootstrap', 'components/bootstrap')); - - writesFuture.push(writer.copy('node_modules/marked/lib/marked.js', 'components/marked.js')); - writesFuture.push(writer.copy('bower_components/lunr.js/lunr.js', 'components/lunr.js')); - writesFuture.push(writer.copy('bower_components/lunr.js/lunr.min.js', 'components/lunr.min.js')); - writesFuture.push(writer.copy('bower_components/jquery/jquery.js', 'components/jquery.js')); - writesFuture.push(writer.copy('bower_components/jquery/jquery.min.js', 'components/jquery.min.js')); - writesFuture.push(writer.copy('bower_components/google-code-prettify/src/prettify.js', 'components/google-code-prettify.js')); - writesFuture.push(writer.copy('docs/components/angular-bootstrap/bootstrap.js', 'components/angular-bootstrap.js')); - writesFuture.push(writer.copy('docs/components/angular-bootstrap/bootstrap-prettify.js', 'components/angular-bootstrap-prettify.js')); - - writesFuture.push(writer.copy('docs/src/templates/index.html', 'index.html', - writer.replace, {'doc:manifest': ''})); //manifest //TODO(i): enable - - writesFuture.push(writer.copy('docs/src/templates/index.html', 'index-nocache.html', - writer.replace, {'doc:manifest': ''})); - - - writesFuture.push(writer.copy('docs/src/templates/index.html', 'index-jq.html', - writer.replace, {'doc:manifest': ''})); - - writesFuture.push(writer.copy('docs/src/templates/index.html', 'index-jq-nocache.html', - writer.replace, {'doc:manifest': ''})); - - - writesFuture.push(writer.copy('docs/src/templates/index.html', 'index-debug.html', - writer.replace, {'doc:manifest': ''})); - - writesFuture.push(writer.copy('docs/src/templates/index.html', 'index-jq-debug.html', - writer.replace, {'doc:manifest': ''})); - - writesFuture.push(writer.symlinkTemplate('offline.html')); - - writesFuture.push(writer.copyTemplate('docs-scenario.html')); // will be rewritten, don't symlink - writesFuture.push(writer.output('docs-scenario.js', ngdoc.scenarios(docs))); - - writesFuture.push(writer.output('docs-data.js',[ - "angular.module('docsData', [])", - ".value('NG_PAGES'," + JSON.stringify(metadata).replace(/{/g, '\n{') + ")", - ".value('NG_VERSION'," + JSON.stringify(currentVersion) + ")", - ".value('NG_VERSIONS'," + JSON.stringify(versions) + ");" - ])); - writesFuture.push(writer.output('sitemap.xml', new SiteMap(docs).render())); - - writesFuture.push(writer.output('robots.txt', 'Sitemap: http://docs.angularjs.org/sitemap.xml\n')); - writesFuture.push(writer.output('appcache.manifest',appCache())); - writesFuture.push(writer.copyTemplate('.htaccess')); // will be rewritten, don't symlink - - writesFuture.push(writer.symlinkTemplate('favicon.ico')); -} - - -function now() { return new Date().getTime(); } - -function noop() {}; - diff --git a/docs/src/ignore.words b/docs/src/ignore.words deleted file mode 100644 index 82b9f2fc..00000000 --- a/docs/src/ignore.words +++ /dev/null @@ -1,701 +0,0 @@ -a -able -about -above -abst -accordance -according -accordingly -across -act -actually -added -adj -adopted -affected -affecting -affects -after -afterwards -again -against -ah -all -almost -alone -along -already -also -although -always -am -among -amongst -an -and -announce -another -any -anybody -anyhow -anymore -anyone -anything -anyway -anyways -anywhere -apparently -approximately -are -aren -arent -arise -around -as -aside -ask -asking -at -auth -available -away -awfully -b -back -be -became -because -become -becomes -becoming -been -before -beforehand -begin -beginning -beginnings -begins -behind -being -believe -below -beside -besides -between -beyond -biol -both -brief -briefly -but -by -c -ca -came -can -cannot -can't -cant -cause -causes -certain -certainly -co -com -come -comes -contain -containing -contains -could -couldnt -d -date -did -didn't -didnt -different -do -does -doesn't -doesnt -doing -done -don't -dont -down -downwards -due -during -e -each -ed -edu -effect -eg -eight -eighty -either -else -elsewhere -end -ending -enough -especially -et -et-al -etc -even -ever -every -everybody -everyone -everything -everywhere -ex -except -f -far -few -ff -fifth -first -five -fix -followed -following -follows -for -former -formerly -forth -found -four -from -further -furthermore -g -gave -get -gets -getting -give -given -gives -giving -go -goes -gone -got -gotten -h -had -happens -hardly -has -hasn't -hasnt -have -haven't -havent -having -he -hed -hence -her -here -hereafter -hereby -herein -heres -hereupon -hers -herself -hes -hi -hid -him -himself -his -hither -home -how -howbeit -however -hundred -i -id -ie -if -i'll -ill -im -immediate -immediately -importance -important -in -inc -indeed -index -information -instead -into -invention -inward -is -isn't -isnt -it -itd -it'll -itll -its -itself -i've -ive -j -just -k -keep -keeps -kept -keys -kg -km -know -known -knows -l -largely -last -lately -later -latter -latterly -least -less -lest -let -lets -like -liked -likely -line -little -'ll -'ll -look -looking -looks -ltd -m -made -mainly -make -makes -many -may -maybe -me -mean -means -meantime -meanwhile -merely -mg -might -million -miss -ml -more -moreover -most -mostly -mr -mrs -much -mug -must -my -myself -n -na -name -namely -nay -nd -near -nearly -necessarily -necessary -need -needs -neither -never -nevertheless -new -next -nine -ninety -no -nobody -non -none -nonetheless -noone -nor -normally -nos -not -noted -nothing -now -nowhere -o -obtain -obtained -obviously -of -off -often -oh -ok -okay -old -omitted -on -once -one -ones -only -onto -or -ord -other -others -otherwise -ought -our -ours -ourselves -out -outside -over -overall -owing -own -p -page -pages -part -particular -particularly -past -per -perhaps -placed -please -plus -poorly -possible -possibly -potentially -pp -predominantly -present -previously -primarily -probably -promptly -proud -provides -put -q -que -quickly -quite -qv -r -ran -rather -rd -re -readily -really -recent -recently -ref -refs -regarding -regardless -regards -related -relatively -research -respectively -resulted -resulting -results -right -run -s -said -same -saw -say -saying -says -sec -section -see -seeing -seem -seemed -seeming -seems -seen -self -selves -sent -seven -several -shall -she -shed -she'll -shell -shes -should -shouldn't -shouldnt -show -showed -shown -showns -shows -significant -significantly -similar -similarly -since -six -slightly -so -some -somebody -somehow -someone -somethan -something -sometime -sometimes -somewhat -somewhere -soon -sorry -specifically -specified -specify -specifying -state -states -still -stop -strongly -sub -substantially -successfully -such -sufficiently -suggest -sup -sure -t -take -taken -taking -tell -tends -th -than -thank -thanks -thanx -that -that'll -thatll -thats -that've -thatve -the -their -theirs -them -themselves -then -thence -there -thereafter -thereby -thered -therefore -therein -there'll -therell -thereof -therere -theres -thereto -thereupon -there've -thereve -these -they -theyd -they'll -theyll -theyre -they've -theyve -think -this -those -thou -though -thoughh -thousand -throug -through -throughout -thru -thus -til -tip -to -together -too -took -toward -towards -tried -tries -truly -try -trying -ts -twice -two -u -un -under -unfortunately -unless -unlike -unlikely -until -unto -up -upon -ups -us -use -used -useful -usefully -usefulness -uses -using -usually -v -value -various -'ve -'ve -very -via -viz -vol -vols -vs -w -want -wants -was -wasn't -wasnt -way -we -wed -welcome -we'll -well -went -were -weren't -werent -we've -weve -what -whatever -what'll -whatll -whats -when -whence -whenever -where -whereafter -whereas -whereby -wherein -wheres -whereupon -wherever -whether -which -while -whim -whither -who -whod -whoever -whole -who'll -wholl -whom -whomever -whos -whose -why -widely -will -willing -wish -with -within -without -won't -wont -words -would -wouldn't -wouldnt -www -x -y -yes -yet -you -youd -you'll -youll -your -youre -yours -yourself -yourselves -you've -youve -z -zero diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js deleted file mode 100644 index 78f968d9..00000000 --- a/docs/src/ngdoc.js +++ /dev/null @@ -1,1435 +0,0 @@ -/** - * All parsing/transformation code goes here. All code here should be sync to ease testing. - */ -var DOM = require('./dom.js').DOM; -var htmlEscape = require('./dom.js').htmlEscape; -var Example = require('./example.js').Example; -var NEW_LINE = /\n\r?/; -var globalID = 0; -var fs = require('fs'); -var fspath = require('path'); -var shell = require('shelljs'); -var gruntUtil = require('../../lib/grunt/utils.js'); -var errorsJson; -var marked = require('marked'); -marked.setOptions({ - gfm: true, - tables: true -}); - -var lookupMinerrMsg = function (doc) { - var code, namespace; - - if (errorsJson === undefined) { - errorsJson = require('../../build/errors.json').errors; - } - - namespace = doc.getMinerrNamespace(); - code = doc.getMinerrCode(); - if (namespace === undefined) { - return errorsJson[code]; - } - return errorsJson[namespace][code]; -}; - -exports.trim = trim; -exports.metadata = metadata; -exports.scenarios = scenarios; -exports.writeProtractorTest = writeProtractorTest; -exports.merge = merge; -exports.checkBrokenLinks = checkBrokenLinks; -exports.Doc = Doc; - -exports.ngVersions = function() { - var versions = [], regex = /^v([1-9]\d*(?:\.\d+\S+)+)$/; //only fetch >= 1.0.0 versions - shell.exec('git tag', {silent: true}).output.split(/\s*\n\s*/) - .forEach(function(line) { - var matches = regex.exec(line); - if(matches && matches.length > 0) { - versions.push(matches[1]); - } - }); - - //match the future version of AngularJS that is set in the package.json file - return expandVersions(sortVersionsNaturally(versions), exports.ngCurrentVersion().full); - - function expandVersions(versions, latestVersion) { - var RC_VERSION = /rc\d/; - //copy the array to avoid changing the versions param data - //the latest version is not on the git tags list, but - //docs.angularjs.org will always point to master as of 1.2 - versions = versions.concat([latestVersion]); - - var firstUnstable, expanded = []; - for(var i=versions.length-1;i>=0;i--) { - var version = versions[i], - split = version.split('.'), - isMaster = version == latestVersion, - isStable = split[1] % 2 === 0 && !RC_VERSION.test(version); - - var title = 'AngularJS - v' + version; - - var docsPath = version < '1.0.2' ? 'docs-' + version : 'docs'; - - var url = isMaster ? - 'http://docs.angularjs.org' : - 'http://code.angularjs.org/' + version + '/' + docsPath; - - expanded.push({ - version : version, - stable : isStable, - title : title, - group : (isStable ? 'Stable' : 'Unstable'), - url : url - }); - }; - - return expanded; - }; - - function sortVersionsNaturally(versions) { - var versionMap = {}, - NON_RC_RELEASE_NUMBER = 999; - for(var i = versions.length - 1; i >= 0; i--) { - var version = versions[i]; - var split = version.split(/\.|rc/); - var baseVersion = split[0] + '.' + split[1] + '.' + split[2]; - - //create a map of RC versions for each version - //this way each RC version can be sorted in "natural" order - versionMap[baseVersion] = versionMap[baseVersion] || []; - - //NON_RC_RELEASE_NUMBER is used to signal the non-RC version for the release and - //it will always appear at the top of the list since the number is so high! - versionMap[baseVersion].push( - version == baseVersion ? NON_RC_RELEASE_NUMBER : parseInt(version.match(/rc\.?(\d+)/)[1])); - }; - - //flatten the map so that the RC versions occur in a natural sorted order - //and the official non-RC version shows up at the top of the list of sorted - //RC versions! - var angularVersions = []; - sortedKeys(versionMap).forEach(function(key) { - var versions = versionMap[key]; - - //basic numerical sort - versions.sort(function(a,b) { - return a - b; - }); - - versions.forEach(function(v) { - angularVersions.push(v == NON_RC_RELEASE_NUMBER ? key : key + 'rc' + v); - }); - }); - - return angularVersions; - }; - - function sortedKeys(obj) { - var keys = []; - for(var key in obj) { - keys.push(key); - }; - keys.sort(true); - return keys; - }; -}; - -exports.ngCurrentVersion = function() { - return gruntUtil.getVersion(); -}; - -var BOOLEAN_ATTR = {}; -['multiple', 'selected', 'checked', 'disabled', 'readOnly', 'required'].forEach(function(value) { - BOOLEAN_ATTR[value] = true; -}); - -////////////////////////////////////////////////////////// -function Doc(text, file, line) { - if (typeof text == 'object') { - for ( var key in text) { - this[key] = text[key]; - } - } else { - this.text = text; - this.file = file; - this.line = line; - } - this.scenarios = this.scenarios || []; - this.protractorTests = this.protractorTests || []; - this.requires = this.requires || []; - this.param = this.param || []; - this.properties = this.properties || []; - this.methods = this.methods || []; - this.events = this.events || []; - this.links = this.links || []; - this.anchors = this.anchors || []; -} -Doc.METADATA_IGNORE = (function() { - var words = fs.readFileSync(__dirname + '/ignore.words', 'utf8'); - return words.toString().split(/[,\s\n\r]+/gm); -})(); - - -Doc.prototype = { - keywords: function keywords() { - var keywords = {}; - var words = []; - Doc.METADATA_IGNORE.forEach(function(ignore){ keywords[ignore] = true; }); - - function extractWords(text) { - var tokens = text.toLowerCase().split(/[\.\s,`'"#]+/mg); - tokens.forEach(function(key){ - var match = key.match(/^((ng:|[\$_a-z])[\w\-_]+)/); - if (match){ - key = match[1]; - if (!keywords[key]) { - keywords[key] = true; - words.push(key); - } - } - }); - } - - extractWords(this.text); - this.properties.forEach(function(prop) { - extractWords(prop.text || prop.description || ''); - }); - this.methods.forEach(function(method) { - extractWords(method.text || method.description || ''); - }); - if (this.ngdoc === 'error') { - words.push(this.getMinerrNamespace()); - words.push(this.getMinerrCode()); - } - words.sort(); - return words.join(' '); - }, - - shortDescription : function() { - if (!this.description) return this.description; - var text = this.description.split("\n")[0]; - text = text.replace(/<.+?\/?>/g, ''); - text = text.replace(/{/g,'{'); - text = text.replace(/}/g,'}'); - return text; - }, - - getMinerrNamespace: function () { - if (this.ngdoc !== 'error') { - throw new Error('Tried to get the minErr namespace, but @ngdoc ' + - this.ngdoc + ' was supplied. It should be @ngdoc error'); - } - return this.name.split(':')[0]; - }, - - getMinerrCode: function () { - if (this.ngdoc !== 'error') { - throw new Error('Tried to get the minErr error code, but @ngdoc ' + - this.ngdoc + ' was supplied. It should be @ngdoc error'); - } - return this.name.split(':')[1]; - }, - - /** - * Converts relative urls (without section) into absolute - * Absolute url means url with section - * - * @example - * - if the link is inside any api doc: - * angular.widget -> api/angular.widget - * - * - if the link is inside any guid doc: - * intro -> guide/intro - * - * @param {string} url Absolute or relative url - * @returns {string} Absolute url - */ - convertUrlToAbsolute: function(url) { - var hashIdx = url.indexOf('#'); - - // Lowercase hash parts of the links, - // so that we can keep correct API names even when the urls are lowercased. - if (hashIdx !== -1) { - url = url.substr(0, hashIdx) + url.substr(hashIdx).toLowerCase(); - } - - if (url.substr(-1) == '/') return url + 'index'; - if (url.match(/\//)) return url; - return this.section + '/' + url; - }, - - markdown: function(text) { - if (!text) return text; - - var self = this, - IS_URL = /^(https?:\/\/|ftps?:\/\/|mailto:|\.|\/)/, - IS_ANGULAR = /^(api\/)?(angular|ng|AUTO)\./, - IS_HASH = /^#/, - parts = trim(text).split(/(<pre.*?>[\s\S]*?<\/pre>|<doc:example(\S*).*?>[\s\S]*?<\/doc:example>|<example[^>]*>[\s\S]*?<\/example>)/), - seq = 0, - placeholderMap = {}; - - function placeholder(text) { - var id = 'REPLACEME' + (seq++); - placeholderMap[id] = text; - return id; - } - - function extractInlineDocCode(text, tag) { - if(tag == 'all') { - //use a greedy operator to match the last </docs> tag - regex = /\/\/<docs.*?>([.\s\S]+)\/\/<\/docs>/im; - } - else { - //use a non-greedy operator to match the next </docs> tag - regex = new RegExp("\/\/<docs\\s*tag=\"" + tag + "\".*?>([.\\s\\S]+?)\/\/<\/docs>","im"); - } - var matches = regex.exec(text.toString()); - return matches && matches.length > 1 ? matches[1] : ""; - } - - parts.forEach(function(text, i) { - parts[i] = (text || ''). - replace(/<example(?:\s+module="([^"]*)")?(?:\s+deps="([^"]*)")?(\s+animations="true")?>([\s\S]*?)<\/example>/gmi, - function(_, module, deps, animations, content) { - - var example = new Example(self.scenarios, self.protractorTests); - if(animations) { - example.enableAnimations(); - example.addDeps('angular-animate.js'); - } - - example.setModule(module); - example.addDeps(deps); - content.replace(/<file\s+name="([^"]*)"\s*>([\s\S]*?)<\/file>/gmi, function(_, name, content) { - example.addSource(name, content); - }); - content.replace(/<file\s+src="([^"]+)"(?:\s+tag="([^"]+)")?(?:\s+name="([^"]+)")?\s*\/?>/gmi, function(_, file, tag, name) { - if(fs.existsSync(file)) { - var content = fs.readFileSync(file, 'utf8'); - if(content && content.length > 0) { - if(tag && tag.length > 0) { - content = extractInlineDocCode(content, tag); - } - name = name && name.length > 0 ? name : fspath.basename(file); - example.addSource(name, content); - } - } - return ''; - }) - return placeholder(example.toHtml()); - }). - replace(/(?:\*\s+)?<file.+?src="([^"]+)"(?:\s+tag="([^"]+)")?\s*\/?>/i, function(_, file, tag) { - if(fs.existsSync(file)) { - var content = fs.readFileSync(file, 'utf8'); - if(tag && tag.length > 0) { - content = extractInlineDocCode(content, tag); - } - return content; - } - }). - replace(/^<doc:example(\s+[^>]*)?>([\s\S]*)<\/doc:example>/mi, function(_, attrs, content) { - var html, script, scenario, - example = new Example(self.scenarios, self.protractorTests); - - example.setModule((attrs||'module=""').match(/^\s*module=["'](.*)["']\s*$/)[1]); - content. - replace(/<doc:source(\s+[^>]*)?>([\s\S]*)<\/doc:source>/mi, function(_, attrs, content) { - example.addSource('index.html', content. - replace(/<script>([\s\S]*)<\/script>/mi, function(_, script) { - example.addSource('script.js', script); - return ''; - }). - replace(/<style>([\s\S]*)<\/style>/mi, function(_, style) { - example.addSource('style.css', style); - return ''; - }) - ); - }). - replace(/(<doc:scenario>)([\s\S]*)(<\/doc:scenario>)/mi, function(_, before, content){ - example.addSource('scenario.js', content); - }).replace(/(<doc:protractor>)([\s\S]*)(<\/doc:protractor>)/mi, function(_, before, content){ - example.addSource('protractorTest.js', content); - }); - - return placeholder(example.toHtml()); - }). - replace(/^<pre(.*?)>([\s\S]*?)<\/pre>/mi, function(_, attrs, content){ - return placeholder( - '<pre'+attrs+' class="prettyprint linenums">' + - content.replace(/</g, '<').replace(/>/g, '>') + - '</pre>'); - }). - replace(/<div([^>]*)><\/div>/, '<div$1>\n<\/div>'). - replace(/{@link\s+([^\s}]+)\s*([^}]*?)\s*}/g, function(_all, url, title){ - var isFullUrl = url.match(IS_URL), - isAngular = url.match(IS_ANGULAR), - isHash = url.match(IS_HASH), - absUrl = isHash - ? url - : (isFullUrl ? url : self.convertUrlToAbsolute(url)); - - if (!isFullUrl) self.links.push(absUrl); - - return '<a href="' + absUrl + '">' + - (isAngular ? '<code>' : '') + - (title || url).replace(/^#/g, '').replace(/\n/g, ' ') + - (isAngular ? '</code>' : '') + - '</a>'; - }). - replace(/{@type\s+(\S+)(?:\s+(\S+))?}/g, function(_, type, url) { - url = url || '#'; - return '<a href="' + url + '" class="' + self.prepare_type_hint_class_name(type) + '">' + type + '</a>'; - }). - replace(/{@installModule\s+(\S+)?}/g, function(_, module) { - return explainModuleInstallation(module); - }); - }); - text = parts.join(''); - - function prepareClassName(text) { - return text.toLowerCase().replace(/[_\W]+/g, '-'); - }; - - var pageClassName, suffix = '-page'; - if(this.name) { - var split = this.name.match(/^\s*(.+?)\s*:\s*(.+)/); - if(split && split.length > 1) { - var before = prepareClassName(split[1]); - var after = prepareClassName(split[2]); - pageClassName = before + suffix + ' ' + before + '-' + after + suffix; - } - } - pageClassName = pageClassName || prepareClassName(this.name || 'docs') + suffix; - - text = '<div class="' + pageClassName + '">' + - marked(text) + - '</div>'; - text = text.replace(/(?:<p>)?(REPLACEME\d+)(?:<\/p>)?/g, function(_, id) { - return placeholderMap[id]; - }); - - //!annotate CONTENT - //!annotate="REGEX" CONTENT - //!annotate="REGEX" TITLE|CONTENT - text = text.replace(/\n?\/\/!annotate\s*(?:=\s*['"](.+?)['"])?\s+(.+?)\n\s*(.+?\n)/img, - function(_, pattern, content, line) { - var pattern = new RegExp(pattern || '.+'); - var title, text, split = content.split(/\|/); - if(split.length > 1) { - text = split[1]; - title = split[0]; - } - else { - title = 'Info'; - text = content; - } - return "\n" + line.replace(pattern, function(match) { - return '<div class="nocode nocode-content" data-popover ' + - 'data-content="' + text + '" ' + - 'data-title="' + title + '">' + - match + - '</div>'; - }); - } - ); - - //!details /path/to/local/docs/file.html - //!details="REGEX" /path/to/local/docs/file.html - text = text.replace(/\/\/!details\s*(?:=\s*['"](.+?)['"])?\s+(.+?)\n\s*(.+?\n)/img, - function(_, pattern, url, line) { - url = '/notes/' + url; - var pattern = new RegExp(pattern || '.+'); - return line.replace(pattern, function(match) { - return '<div class="nocode nocode-content" data-foldout data-url="' + url + '">' + match + '</div>'; - }); - } - ); - - return text; - }, - - parse: function() { - var atName; - var atText; - var match; - var self = this; - self.text.split(NEW_LINE).forEach(function(line){ - if ((match = line.match(/^\s*@(\w+)(\s+(.*))?/))) { - // we found @name ... - // if we have existing name - flush(); - atName = match[1]; - atText = []; - if(match[3]) atText.push(match[3]); - } else { - if (atName) { - atText.push(line); - } - } - }); - flush(); - this.shortName = this.name.split(/[\.:#]/).pop().trim(); - this.id = this.id || // if we have an id just use it - (this.ngdoc === 'error' ? this.name : '') || - (((this.file||'').match(/.*(\/|\\)([^(\/|\\)]*)\.ngdoc/)||{})[2]) || // try to extract it from file name - this.name; // default to name - this.moduleName = parseModuleName(this.id); - this.description = this.markdown(this.description); - this.example = this.markdown(this.example); - this['this'] = this.markdown(this['this']); - return this; - - function parseModuleName(id) { - var module = id.split('.')[0]; - if(module == 'angular') { - module = 'ng'; - } - return module; - } - - function flush() { - if (atName) { - var text = trim(atText.join('\n')), match; - if (atName == 'param') { - match = text.match(/^\{([^}]+)\}\s+(([^\s=]+)|\[(\S+)=([^\]]+)\])\s+(.*)/); - // 1 1 23 3 4 4 5 5 2 6 6 - if (!match) { - throw new Error("Not a valid 'param' format: " + text + ' (found in: ' + self.file + ':' + self.line + ')'); - } - - var optional = (match[1].slice(-1) === '='); - var param = { - name: match[4] || match[3], - description:self.markdown(text.replace(match[0], match[6])), - type: optional ? match[1].substring(0, match[1].length-1) : match[1], - optional: optional, - default: match[5] - }; - self.param.push(param); - } else if (atName == 'returns' || atName == 'return') { - match = text.match(/^\{([^}]+)\}\s+(.*)/); - if (!match) { - throw new Error("Not a valid 'returns' format: " + text + ' (found in: ' + self.file + ':' + self.line + ')'); - } - self.returns = { - type: match[1], - description: self.markdown(text.replace(match[0], match[2])) - }; - } else if(atName == 'requires') { - match = text.match(/^([^\s]*)\s*([\S\s]*)/); - self.requires.push({ - name: match[1], - text: self.markdown(match[2]) - }); - } else if(atName == 'property') { - match = text.match(/^\{(\S+)\}\s+(\S+)(\s+(.*))?/); - if (!match) { - throw new Error("Not a valid 'property' format: " + text + ' (found in: ' + self.file + ':' + self.line + ')'); - } - var property = new Doc({ - type: match[1], - name: match[2], - shortName: match[2], - description: self.markdown(text.replace(match[0], match[4])) - }); - self.properties.push(property); - } else if(atName == 'eventType') { - match = text.match(/^([^\s]*)\s+on\s+([\S\s]*)/); - self.type = match[1]; - self.target = match[2]; - } else { - self[atName] = text; - } - } - } - }, - - html: function() { - var dom = new DOM(), - self = this, - minerrMsg; - - var gitTagFromFullVersion = function(version) { - var match = version.match(/sha\.(\w{7})/); - - if (match) { - // git sha - return match[1]; - } - - // git tag - return 'v' + version; - }; - - if (this.section === 'api') { - dom.tag('a', { - href: 'http://github.com/angular/angular.js/tree/' + - gitTagFromFullVersion(gruntUtil.getVersion().full) + '/' + self.file + '#L' + self.line, - class: 'view-source btn btn-action' }, function(dom) { - dom.tag('i', {class:'icon-zoom-in'}, ' '); - dom.text(' View source'); - }); - } - dom.tag('a', { - href: 'http://github.com/angular/angular.js/edit/master/' + self.file, - class: 'improve-docs btn btn-primary' }, function(dom) { - dom.tag('i', {class:'icon-edit'}, ' '); - dom.text(' Improve this doc'); - }); - dom.h(title(this), function() { - notice('deprecated', 'Deprecated API', self.deprecated); - if (self.ngdoc === 'error') { - minerrMsg = lookupMinerrMsg(self); - dom.tag('pre', { - class:'minerr-errmsg', - 'error-display': minerrMsg.replace(/"/g, '"') - }, minerrMsg); - } - if (self.ngdoc != 'overview') { - dom.h('Description', self.description, dom.html); - } - dom.h('Dependencies', self.requires, function(require){ - dom.tag('code', function() { - dom.tag('a', {href: 'api/ng.' + require.name}, require.name); - }); - dom.html(require.text); - }); - - (self['html_usage_' + self.ngdoc] || function() { - throw new Error("Don't know how to format @ngdoc: " + self.ngdoc); - }).call(self, dom); - - dom.h('Example', self.example, dom.html); - }); - - self.anchors = dom.anchors; - - return dom.toString(); - - ////////////////////////// - - function notice(name, legend, msg){ - if (self[name] === undefined) return; - dom.tag('fieldset', {'class':name}, function(dom){ - dom.tag('legend', legend); - dom.text(msg); - }); - } - - }, - - prepare_type_hint_class_name : function(type) { - var typeClass = type.toLowerCase().match(/^[-\w]+/) || []; - typeClass = typeClass[0] ? typeClass[0] : 'object'; - return 'label type-hint type-hint-' + typeClass; - }, - - html_usage_parameters: function(dom) { - var self = this; - var params = this.param ? this.param : []; - if(this.animations) { - dom.h('Animations', this.animations, function(animations){ - dom.html('<ul>'); - var animations = animations.split("\n"); - animations.forEach(function(ani) { - dom.html('<li>'); - dom.text(ani); - dom.html('</li>'); - }); - dom.html('</ul>'); - }); - dom.html('<a href="api/ngAnimate.$animate">Click here</a> to learn more about the steps involved in the animation.'); - } - if(params.length > 0) { - dom.html('<h2>Parameters</h2>'); - dom.html('<table class="variables-matrix table table-bordered table-striped">'); - dom.html('<thead>'); - dom.html('<tr>'); - dom.html('<th>Param</th>'); - dom.html('<th>Type</th>'); - dom.html('<th>Details</th>'); - dom.html('</tr>'); - dom.html('</thead>'); - dom.html('<tbody>'); - for(var i=0;i<params.length;i++) { - param = params[i]; - var name = param.name; - var types = param.type; - if(types[0]=='(') { - types = types.substr(1); - } - - var limit = types.length - 1; - if(types.charAt(limit) == ')' && types.charAt(limit-1) != '(') { - types = types.substr(0,limit); - } - types = types.split(/\|(?![\(\)\w\|\s]+>)/); - if (param.optional) { - name += ' <div><em>(optional)</em></div>'; - } - dom.html('<tr>'); - dom.html('<td>' + name + '</td>'); - dom.html('<td>'); - for(var j=0;j<types.length;j++) { - var type = types[j]; - dom.html('<a href="" class="' + self.prepare_type_hint_class_name(type) + '">'); - dom.text(type); - dom.html('</a>'); - } - - dom.html('</td>'); - var description = '<td>'; - description += param.description; - if (param.default) { - description += ' <p><em>(default: ' + param.default + ')</em></p>'; - } - description += '</td>'; - dom.html(description); - dom.html('</tr>'); - }; - dom.html('</tbody>'); - dom.html('</table>'); - } - }, - - html_usage_returns: function(dom) { - var self = this; - if (self.returns) { - dom.html('<h2>Returns</h2>'); - dom.html('<table class="variables-matrix">'); - dom.html('<tr>'); - dom.html('<td>'); - dom.html('<a href="" class="' + self.prepare_type_hint_class_name(self.returns.type) + '">'); - dom.text(self.returns.type); - dom.html('</a>'); - dom.html('</td>'); - dom.html('<td>'); - dom.html(self.returns.description); - dom.html('</td>'); - dom.html('</tr>'); - dom.html('</table>'); - } - }, - - html_usage_this: function(dom) { - var self = this; - if (self['this']) { - dom.h(function(dom){ - dom.html("Method's <code>this</code>"); - }, function(dom){ - dom.html(self['this']); - }); - } - }, - - html_usage_function: function(dom){ - var self = this; - var name = self.name.match(/^angular(\.mock)?\.(\w+)$/) ? self.name : self.name.split(/\./).pop() - - dom.h('Usage', function() { - dom.code(function() { - dom.text(name); - dom.text('('); - self.parameters(dom, ', '); - dom.text(');'); - }); - - self.html_usage_parameters(dom); - self.html_usage_this(dom); - self.html_usage_returns(dom); - }); - this.method_properties_events(dom); - }, - - html_usage_property: function(dom){ - var self = this; - dom.h('Usage', function() { - dom.code(function() { - dom.text(self.name); - }); - - self.html_usage_returns(dom); - }); - }, - - html_usage_directive: function(dom){ - var self = this; - dom.h('Usage', function() { - var restrict = self.restrict || 'A'; - - if (restrict.match(/E/)) { - dom.html('<p>'); - dom.text('This directive can be used as custom element, but be aware of '); - dom.tag('a', {href:'guide/ie'}, 'IE restrictions'); - dom.text('.'); - dom.html('</p>'); - } - - if (self.usage) { - dom.tag('pre', function() { - dom.tag('code', function() { - dom.text(self.usage); - }); - }); - } else { - if (restrict.match(/E/)) { - dom.text('as element:'); - dom.code(function() { - dom.text('<'); - dom.text(dashCase(self.shortName)); - renderParams('\n ', '="', '"'); - dom.text('>\n</'); - dom.text(dashCase(self.shortName)); - dom.text('>'); - }); - } - if (restrict.match(/A/)) { - var element = self.element || 'ANY'; - dom.text('as attribute'); - dom.code(function() { - dom.text('<' + element + ' '); - dom.text(dashCase(self.shortName)); - renderParams('\n ', '="', '"', true); - dom.text('>\n ...\n'); - dom.text('</' + element + '>'); - }); - } - if (restrict.match(/C/)) { - dom.text('as class'); - var element = self.element || 'ANY'; - dom.code(function() { - dom.text('<' + element + ' class="'); - dom.text(dashCase(self.shortName)); - renderParams(' ', ': ', ';', true); - dom.text('">\n ...\n'); - dom.text('</' + element + '>'); - }); - } - } - self.html_usage_directiveInfo(dom); - self.html_usage_parameters(dom); - }); - - self.method_properties_events(dom); - - function renderParams(prefix, infix, suffix, skipSelf) { - (self.param||[]).forEach(function(param) { - var skip = skipSelf && (param.name == self.shortName || param.name.indexOf(self.shortName + '|') == 0); - if (!skip) { - dom.text(prefix); - dom.text(param.optional ? '[' : ''); - var parts = param.name.split('|'); - dom.text(dashCase(parts[skipSelf ? 0 : 1] || parts[0])); - } - if (BOOLEAN_ATTR[param.name]) { - dom.text(param.optional ? ']' : ''); - } else { - dom.text(BOOLEAN_ATTR[param.name] ? '' : infix ); - dom.text(('{' + param.type + '}').replace(/^\{\'(.*)\'\}$/, '$1')); - dom.text(suffix); - dom.text(param.optional && !skip ? ']' : ''); - } - }); - } - - }, - - html_usage_filter: function(dom){ - var self = this; - dom.h('Usage', function() { - dom.h('In HTML Template Binding', function() { - dom.tag('code', function() { - if (self.usage) { - dom.text(self.usage); - } else { - dom.text('{{ '); - dom.text(self.shortName); - dom.text('_expression | '); - dom.text(self.shortName); - self.parameters(dom, ':', true); - dom.text(' }}'); - } - }); - }); - - dom.h('In JavaScript', function() { - dom.tag('code', function() { - dom.text('$filter(\''); - dom.text(self.shortName); - dom.text('\')('); - self.parameters(dom, ', '); - dom.text(')'); - }); - }); - - self.html_usage_parameters(dom); - self.html_usage_this(dom); - self.html_usage_returns(dom); - }); - }, - - html_usage_inputType: function(dom){ - var self = this; - dom.h('Usage', function() { - dom.code(function() { - dom.text('<input type="' + self.shortName + '"'); - (self.param||[]).forEach(function(param){ - dom.text('\n '); - dom.text(param.optional ? ' [' : ' '); - dom.text(dashCase(param.name)); - dom.text(BOOLEAN_ATTR[param.name] ? '' : '="{' + param.type + '}"'); - dom.text(param.optional ? ']' : ''); - }); - dom.text('>'); - }); - self.html_usage_parameters(dom); - }); - }, - - html_usage_directiveInfo: function(dom) { - var self = this; - var list = []; - - - if (self.scope !== undefined) { - list.push('This directive creates new scope.'); - } - if (self.priority !== undefined) { - list.push('This directive executes at priority level ' + self.priority + '.'); - } - - if (list.length) { - dom.h('Directive info', function() { - dom.ul(list); - }); - } - }, - - html_usage_overview: function(dom){ - dom.html(this.description); - }, - - html_usage_error: function (dom) { - dom.html(); - }, - - html_usage_interface: function(dom){ - var self = this; - - if (this.param.length) { - dom.h('Usage', function() { - dom.code(function() { - dom.text(self.name.split('.').pop()); - dom.text('('); - self.parameters(dom, ', '); - dom.text(');'); - }); - - self.html_usage_parameters(dom); - self.html_usage_this(dom); - self.html_usage_returns(dom); - }); - } - this.method_properties_events(dom); - }, - - html_usage_service: function(dom) { - this.html_usage_interface(dom) - }, - - html_usage_object: function(dom) { - this.html_usage_interface(dom) - }, - - method_properties_events: function(dom) { - var self = this; - if (self.methods.length) { - dom.div({class:'member method'}, function(){ - dom.h('Methods', self.methods, function(method){ - var signature = (method.param || []).map(property('name')); - dom.h(method.shortName + '(' + signature.join(', ') + ')', method, function() { - dom.html(method.description); - method.html_usage_parameters(dom); - self.html_usage_this(dom); - method.html_usage_returns(dom); - - dom.h('Example', method.example, dom.html); - }); - }); - }); - } - if (self.properties.length) { - dom.div({class:'member property'}, function(){ - dom.h('Properties', self.properties, function(property){ - dom.h(property.shortName, function() { - dom.html(property.description); - if (!property.html_usage_returns) { - console.log(property); - } - property.html_usage_returns(dom); - dom.h('Example', property.example, dom.html); - }); - }); - }); - } - if (self.events.length) { - dom.div({class:'member event'}, function(){ - dom.h('Events', self.events, function(event){ - dom.h(event.shortName, event, function() { - dom.html(event.description); - if (event.type == 'listen') { - dom.tag('div', {class:'inline'}, function() { - dom.h('Listen on:', event.target); - }); - } else { - dom.tag('div', {class:'inline'}, function() { - dom.h('Type:', event.type); - }); - dom.tag('div', {class:'inline'}, function() { - dom.h('Target:', event.target); - }); - } - event.html_usage_parameters(dom); - self.html_usage_this(dom); - - dom.h('Example', event.example, dom.html); - }); - }); - }); - } - }, - - parameters: function(dom, separator, skipFirst, prefix) { - var sep = prefix ? separator : ''; - (this.param||[]).forEach(function(param, i){ - if (!(skipFirst && i==0)) { - if (param.optional) { - dom.text('[' + sep + param.name + ']'); - } else { - dom.text(sep + param.name); - } - } - sep = separator; - }); - } - -}; -////////////////////////////////////////////////////////// - - -////////////////////////////////////////////////////////// -var GLOBALS = /^angular\.([^\.]+)$/, - MODULE = /^((?:(?!^angular\.)[^\.])+)$/, - MODULE_MOCK = /^angular\.mock\.([^\.]+)$/, - MODULE_DIRECTIVE = /^((?:(?!^angular\.)[^\.])+)\.directive:([^\.]+)$/, - MODULE_DIRECTIVE_INPUT = /^((?:(?!^angular\.)[^\.])+)\.directive:input\.([^\.]+)$/, - MODULE_FILTER = /^((?:(?!^angular\.)[^\.])+)\.filter:([^\.]+)$/, - MODULE_SERVICE = /^((?:(?!^angular\.)[^\.])+)\.([^\.]+?)(Provider)?$/, - MODULE_TYPE = /^((?:(?!^angular\.)[^\.])+)\..+\.([A-Z][^\.]+)$/; - - -function title(doc) { - if (!doc.name) return doc.name; - var match, - text = doc.name; - - var makeTitle = function (name, type, componentType, component) { - // Makes title markup. - // makeTitle('Foo', 'directive', 'module', 'ng') -> - // Foo is a directive in module ng - return function () { - this.tag('code', name); - this.tag('div', function () { - this.tag('span', {class: 'hint'}, function () { - if (type && component) { - this.text(type + ' in ' + componentType + ' '); - this.tag('code', component); - } - }); - }); - }; - }; - - if (doc.ngdoc === 'error') { - return makeTitle(doc.fullName, 'error', 'component', doc.getMinerrNamespace()); - } else if (text == 'angular.Module') { - return makeTitle('Module', 'Type', 'module', 'ng'); - } else if (match = text.match(GLOBALS)) { - return makeTitle('angular.' + match[1], 'API', 'module', 'ng'); - } else if (match = text.match(MODULE)) { - return makeTitle('', '', 'module', match[1]); - } else if (match = text.match(MODULE_MOCK)) { - return makeTitle('angular.mock.' + match[1], 'API', 'module', 'ng'); - } else if (match = text.match(MODULE_DIRECTIVE)) { - return makeTitle(match[2], 'directive', 'module', match[1]); - } else if (match = text.match(MODULE_DIRECTIVE_INPUT)) { - return makeTitle('input [' + match[2] + ']', 'directive', 'module', match[1]); - } else if (match = text.match(MODULE_FILTER)) { - return makeTitle(match[2], 'filter', 'module', match[1]); - } else if (match = text.match(MODULE_SERVICE)) { - return makeTitle(match[2] + (match[3] || ''), 'service', 'module', match[1]); - } else if (match = text.match(MODULE_TYPE)) { - return makeTitle(match[2], 'type', 'module', match[1]); - } - return text; -} - - -function scenarios(docs){ - var specs = []; - - specs.push('describe("angular+jqlite", function() {'); - appendSpecs('index-nocache.html#!/'); - specs.push('});'); - - specs.push(''); - specs.push(''); - - specs.push('describe("angular+jquery", function() {'); - appendSpecs('index-jq-nocache.html#!/'); - specs.push('});'); - - return specs.join('\n'); - - function appendSpecs(urlPrefix) { - docs.forEach(function(doc){ - specs.push(' describe("' + doc.section + '/' + doc.id + '", function() {'); - specs.push(' beforeEach(function() {'); - specs.push(' browser().navigateTo("' + urlPrefix + doc.section + '/' + doc.id + '");'); - specs.push(' });'); - specs.push(' '); - doc.scenarios.forEach(function(scenario){ - specs.push(indentCode(trim(scenario), 4)); - specs.push(''); - }); - specs.push('});'); - specs.push(''); - }); - } -} - -function writeProtractorTest(doc, pathPrefix){ - var lines = []; - lines.push('describe("' + doc.section + '/' + doc.id + '", function() {'); - lines.push(' beforeEach(function() {'); - lines.push(' browser.get("' + pathPrefix + doc.section + '/' + doc.id + '");'); - lines.push(' });'); - lines.push(''); - doc.protractorTests.forEach(function(test){ - lines.push(indentCode(trim(test), 0)); - lines.push(''); - }); - lines.push('});'); - lines.push(''); - return lines.join('\n'); -} - - -////////////////////////////////////////////////////////// -function metadata(docs){ - var pages = []; - docs.forEach(function(doc){ - var path = (doc.name || '').split(/(\:\s*)/); - for ( var i = 1; i < path.length; i++) { - path.splice(i, 1); - } - var shortName = path.pop().trim(); - - if (path.pop() == 'input') { - shortName = 'input [' + shortName + ']'; - } - - pages.push({ - section: doc.section, - id: doc.id, - name: title(doc), - shortName: shortName, - type: doc.ngdoc, - moduleName: doc.moduleName, - shortDescription: doc.shortDescription(), - keywords: doc.keywords() - }); - }); - pages.sort(sidebarSort); - return pages; -} - -var KEYWORD_PRIORITY = { - '.index': 1, - '.overview': 1, - '.bootstrap': 2, - '.mvc': 3, - '.scopes': 4, - '.compiler': 5, - '.templates': 6, - '.services': 7, - '.di': 8, - '.unit-testing': 9, - '.dev_guide': 9, - '.dev_guide.overview': 1, - '.dev_guide.bootstrap': 2, - '.dev_guide.bootstrap.auto_bootstrap': 1, - '.dev_guide.bootstrap.manual_bootstrap': 2, - '.dev_guide.mvc': 3, - '.dev_guide.mvc.understanding_model': 1, - '.dev_guide.mvc.understanding_controller': 2, - '.dev_guide.mvc.understanding_view': 3, - '.dev_guide.scopes': 4, - '.dev_guide.scopes.understanding_scopes': 1, - '.dev_guide.scopes.internals': 2, - '.dev_guide.compiler': 5, - '.dev_guide.templates': 6, - '.dev_guide.services': 7, - '.dev_guide.di': 8, - '.dev_guide.unit-testing': 9 -}; - -var GUIDE_PRIORITY = [ - 'introduction', - 'overview', - 'concepts', - 'dev_guide.mvc', - - 'dev_guide.mvc.understanding_controller', - 'dev_guide.mvc.understanding_model', - 'dev_guide.mvc.understanding_view', - - 'dev_guide.services.understanding_services', - 'dev_guide.services.managing_dependencies', - 'dev_guide.services.creating_services', - 'dev_guide.services.injecting_controllers', - 'dev_guide.services.testing_services', - 'dev_guide.services.$location', - 'dev_guide.services', - - 'databinding', - 'dev_guide.templates.css-styling', - 'dev_guide.templates.filters.creating_filters', - 'dev_guide.templates.filters', - 'dev_guide.templates.filters.using_filters', - 'dev_guide.templates', - - 'di', - 'providers', - 'module', - 'scope', - 'expression', - 'bootstrap', - 'directive', - 'compiler', - - 'forms', - 'animations', - - 'dev_guide.e2e-testing', - 'dev_guide.unit-testing', - - 'i18n', - 'ie', - 'migration', -]; - -function sidebarSort(a, b){ - priorityA = GUIDE_PRIORITY.indexOf(a.id); - priorityB = GUIDE_PRIORITY.indexOf(b.id); - - if (priorityA > -1 || priorityB > -1) { - return priorityA < priorityB ? -1 : (priorityA > priorityB ? 1 : 0); - } - - function mangleName(doc) { - var path = doc.id.split(/\./); - var mangled = []; - var partialName = ''; - path.forEach(function(name){ - partialName += '.' + name; - mangled.push(KEYWORD_PRIORITY[partialName] || 5); - mangled.push(name); - }); - return (doc.section + '/' + mangled.join('.')).toLowerCase(); - } - var nameA = mangleName(a); - var nameB = mangleName(b); - return nameA < nameB ? -1 : (nameA > nameB ? 1 : 0); -} - - -////////////////////////////////////////////////////////// -function trim(text) { - var MAX_INDENT = 9999; - var empty = RegExp.prototype.test.bind(/^\s*$/); - var lines = text.split('\n'); - var minIndent = MAX_INDENT; - var indentRegExp; - var ignoreLine = (lines[0][0] != ' ' && lines.length > 1); - // ignore first line if it has no indentation and there is more than one line - - lines.forEach(function(line){ - if (ignoreLine) { - ignoreLine = false; - return; - } - - var indent = line.match(/^\s*/)[0].length; - if (indent > 0 || minIndent == MAX_INDENT) { - minIndent = Math.min(minIndent, indent); - } - }); - - indentRegExp = new RegExp('^\\s{0,' + minIndent + '}'); - - for ( var i = 0; i < lines.length; i++) { - lines[i] = lines[i].replace(indentRegExp, ''); - } - - // remove leading lines - while (empty(lines[0])) { - lines.shift(); - } - - // remove trailing - while (empty(lines[lines.length - 1])) { - lines.pop(); - } - return lines.join('\n'); -} - -function indentCode(text, spaceCount) { - var lines = text.split('\n'), - indent = '', - fixedLines = []; - - while(spaceCount--) indent += ' '; - - lines.forEach(function(line) { - fixedLines.push(indent + line); - }); - - return fixedLines.join('\n'); -} - -////////////////////////////////////////////////////////// -function merge(docs){ - var byFullId = {}; - - docs.forEach(function(doc) { - byFullId[doc.section + '/' + doc.id] = doc; - }); - - for(var i = 0; i < docs.length;) { - if (findParent(docs[i], 'method') || findParent(docs[i], 'property') || findParent(docs[i], 'event')) { - docs.splice(i, 1); - } else { - i++; - } - } - - function findParent(doc, name) { - var parentName = doc[name + 'Of']; - if (!parentName) return false; - - var parent = byFullId['api/' + parentName]; - if (!parent) - throw new Error("No parent named '" + parentName + "' for '" + - doc.name + "' in @" + name + "Of."); - - var listName = (name + 's').replace(/ys$/, 'ies'); - var list = parent[listName] = (parent[listName] || []); - list.push(doc); - list.sort(orderByName); - return true; - } - - function orderByName(a, b){ - return a.name < b.name ? -1 : (a.name > b.name ? 1 : 0); - } -} -////////////////////////////////////////////////////////// - - -function checkBrokenLinks(docs) { - var byFullId = Object.create(null); - - docs.forEach(function(doc) { - byFullId[doc.section + '/' + doc.id] = doc; - if (doc.section === 'api') { - doc.anchors.push('directive', 'service', 'filter', 'function'); - } - }); - - docs.forEach(function(doc) { - doc.links.forEach(function(link) { - // convert #id to path#id - if (link[0] == '#') { - link = doc.section + '/' + doc.id.split('#').shift() + link; - } - - var parts = link.split('#'); - var pageLink = parts[0]; - var anchorLink = parts[1]; - var linkedPage = byFullId[pageLink]; - - if (!linkedPage) { - console.log('WARNING: ' + doc.section + '/' + doc.id + ' (defined in ' + doc.file + ') points to a non existing page "' + link + '"!'); - } else if (anchorLink && linkedPage.anchors.indexOf(anchorLink) === -1) { - console.log('WARNING: ' + doc.section + '/' + doc.id + ' (defined in ' + doc.file + ') points to a non existing anchor "' + link + '"!'); - } - }); - }); -} - - -function property(name) { - return function(value){ - return value[name]; - }; -} - - -var DASH_CASE_REGEXP = /[A-Z]/g; -function dashCase(name){ - return name.replace(DASH_CASE_REGEXP, function(letter, pos) { - return (pos ? '-' : '') + letter.toLowerCase(); - }); -} -////////////////////////////////////////////////////////// - -function explainModuleInstallation(moduleName){ - var ngMod = ngModule(moduleName), - modulePackage = 'angular-' + moduleName, - modulePackageFile = modulePackage + '.js'; - - // Deal with inconsistent ngMock naming - doing it verbosely and explicitly here - // rather than cleverly interweaving it in the previous lines to make it obvious - // what is going on - if ( moduleName == 'mock' ) { - modulePackage = 'angular-mocks'; - modulePackageFile = modulePackage + '.js'; - } - - return '<h1>Installation</h1>' + - '<p>First include <code>' + modulePackageFile +'</code> in your HTML:</p><pre><code>' + - ' <script src="angular.js">\n' + - ' <script src="' + modulePackageFile + '"></pre></code>' + - - '<p>You can download this file from the following places:</p>' + - '<ul>' + - '<li>[Google CDN](https://developers.google.com/speed/libraries/devguide#angularjs)<br>' + - 'e.g. <code>"//ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/' + modulePackageFile + '"</code></li>' + - '<li>[Bower](http://bower.io)<br>' + - 'e.g. <code>bower install ' + modulePackage + '@X.Y.Z</code></li>' + - '<li><a href="http://code.angularjs.org/">code.angularjs.org</a><br>' + - 'e.g. <code>"//code.angularjs.org/X.Y.Z/' + modulePackageFile + '"</code></li>' + - '</ul>' + - '<p>where X.Y.Z is the AngularJS version you are running.</p>' + - '<p>Then load the module in your application by adding it as a dependent module:</p><pre><code>' + - ' angular.module(\'app\', [\'' + ngMod + '\']);</pre></code>' + - - '<p>With that you\'re ready to get started!</p>'; -} - -function ngModule(moduleName) { - return 'ng' + moduleName[0].toUpperCase() + moduleName.substr(1); -} diff --git a/docs/src/reader.js b/docs/src/reader.js deleted file mode 100644 index bb9b6b5f..00000000 --- a/docs/src/reader.js +++ /dev/null @@ -1,97 +0,0 @@ -/** - * All reading related code here. This is so that we can separate the async code from sync code - * for testability - */ - -exports.collect = collect; - -var ngdoc = require('./ngdoc.js'), - Q = require('qq'), - qfs = require('q-io/fs'), - PATH = require('path'); - -var NEW_LINE = /\n\r?/; - -function collect() { - var allDocs = []; - - //collect docs in JS Files - var path = 'src'; - var promiseA = Q.when(qfs.listTree(path), function(files) { - var done; - //read all files in parallel. - files.forEach(function(file) { - var work; - if(/\.js$/.test(file)) { - work = Q.when(qfs.read(file, 'b'), function(content) { - processJsFile(content, file).forEach (function(doc) { - allDocs.push(doc); - }); - }); - } - done = Q.when(done, function() { - return work; - }); - }); - return done; - }); - - //collect all ng Docs in Content Folder - var path2 = 'docs/content'; - var promiseB = Q.when(qfs.listTree(path2), function(files){ - var done2; - files.forEach(function(file) { - var work2; - if (file.match(/\.ngdoc$/)) { - work2 = Q.when(qfs.read(file, 'b'), function(content){ - var section = '@section ' + file.split(PATH.sep)[2] + '\n'; - allDocs.push(new ngdoc.Doc(section + content.toString(),file, 1).parse()); - }); - } - done2 = Q.when(done2, function() { - return work2; - }); - }); - return done2; - }); - - return Q.join(promiseA, promiseB, function() { - return allDocs; - }); -} - -function processJsFile(content, file) { - var docs = []; - var lines = content.toString().split(NEW_LINE); - var text; - var startingLine ; - var match; - var inDoc = false; - - lines.forEach(function(line, lineNumber){ - lineNumber++; - // is the comment starting? - if (!inDoc && (match = line.match(/^\s*\/\*\*\s*(.*)$/))) { - line = match[1]; - inDoc = true; - text = []; - startingLine = lineNumber; - } - // are we done? - if (inDoc && line.match(/\*\//)) { - text = text.join('\n'); - text = text.replace(/^\n/, ''); - if (text.match(/@ngdoc/)){ - //console.log(file, startingLine) - docs.push(new ngdoc.Doc('@section api\n' + text, file, startingLine).parse()); - } - doc = null; - inDoc = false; - } - // is the comment add text - if (inDoc){ - text.push(line.replace(/^\s*\*\s?/, '')); - } - }); - return docs; -} diff --git a/docs/src/templates/.htaccess b/docs/src/templates/.htaccess deleted file mode 100644 index aa3ae543..00000000 --- a/docs/src/templates/.htaccess +++ /dev/null @@ -1,19 +0,0 @@ -## OFFLINE SUPPORT ## - -# These rules tell apache to check if there is a cookie called "offline", with value set to the -# current angular version. If this rule matches the appcache-offline.manifest will be served for -# requests to appcache.manifest -# -# This file must be processed by Grunt in order to replace %ANGULAR_VERSION% with the actual version. - -Options -Indexes -RewriteEngine on -RewriteCond %{HTTP_COOKIE} ng-offline="NG_VERSION_FULL" -RewriteRule appcache.manifest appcache-offline.manifest - -## Redirect to the latest manifest -RewriteCond %{HTTP_HOST} ^docs-next\.angularjs\.org$ -RewriteRule appcache.manifest http://code.angularjs.org/next/docs/appcache.manifest [R=301] - -## HTML5 URL Support ## -RewriteRule ^(guide|api|misc|tutorial)(/.*)?$ index.html diff --git a/docs/src/templates/css/animations.css b/docs/src/templates/css/animations.css deleted file mode 100644 index 7bf1e2e8..00000000 --- a/docs/src/templates/css/animations.css +++ /dev/null @@ -1,62 +0,0 @@ -.reveal.ng-enter { - -webkit-transition:1s linear all; - -moz-transition:1s linear all; - -o-transition:1s linear all; - transition:1s linear all; - - opacity:0; -} -.reveal.ng-enter.ng-enter-active { - opacity:1; -} - -.nav-list { - padding: 0; -} - -.nav-list li { - margin:0!important; - padding:2px 15px; - overflow:hidden; - line-height:1.1em; -} - -.slide-reveal.ng-enter { - -webkit-transition:0.5s linear all; - -moz-transition:0.5s linear all; - -o-transition:0.5s linear all; - transition:0.5s linear all; - - opacity:0.5; - position:relative; - opacity:0; - top:10px; -} -.slide-reveal.ng-enter.ng-enter-active { - top:0; - opacity:1; -} - -.foldout.ng-enter, -.foldout.ng-move, -.foldout.ng-hide-add, -.foldout.ng-hide-remove { - -webkit-transition:0.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) all; - -moz-transition:0.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) all; - -o-transition:0.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) all; - transition:0.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) all; -} - -.foldout.ng-hide-remove, -.foldout.ng-hide-add.ng-hide-active, -.foldout.ng-enter, -.foldout.ng-move { - opacity:0; -} - -.foldout.ng-move.ng-move-active, -.foldout.ng-hide-remove.ng-hide-remove-active, -.foldout.ng-hide-add, -.foldout.ng-enter.ng-enter-active { - opacity:1; -} diff --git a/docs/src/templates/css/doc_widgets.css b/docs/src/templates/css/doc_widgets.css deleted file mode 100644 index 587d5a7e..00000000 --- a/docs/src/templates/css/doc_widgets.css +++ /dev/null @@ -1,150 +0,0 @@ -ul.doc-example { - list-style-type: none; - position: relative; - font-size: 14px; -} - -ul.doc-example > li { - border: 2px solid gray; - border-radius: 5px; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; - background-color: white; - margin-bottom: 20px; -} - -ul.doc-example > li.doc-example-heading { - border: none; - border-radius: 0; - margin-bottom: -10px; -} - -span.nojsfiddle { - float: right; - font-size: 14px; - margin-right:10px; - margin-top: 10px; -} - -form.jsfiddle { - position: absolute; - right: 0; - z-index: 1; - height: 14px; -} - -form.jsfiddle button { - cursor: pointer; - padding: 4px 10px; - margin: 10px; - background-color: #FFF; - font-weight: bold; - color: #7989D6; - border-color: #7989D6; - -moz-border-radius: 8px; - -webkit-border-radius:8px; - border-radius: 8px; -} - -form.jsfiddle textarea, form.jsfiddle input { - display: none; -} - -li.doc-example-live { - padding: 10px; - font-size: 1.2em; -} - -div.syntaxhighlighter { - padding-bottom: 1px !important; /* fix to remove unnecessary scrollbars http://is.gd/gSMgC */ -} - -/* TABS - tutorial environment navigation */ - -div.tabs-nav { - height: 25px; - position: relative; -} - -div.tabs-nav ul li { - list-style: none; - display: inline-block; - padding: 5px 10px; -} - -div.tabs-nav ul li.current a { - color: white; - text-decoration: none; -} - -div.tabs-nav ul li.current { - background: #7989D6; - -moz-box-shadow: 4px 4px 6px #48577D; - -moz-border-radius-topright: 8px; - -moz-border-radius-topleft: 8px; - box-shadow: 4px 4px 6px #48577D; - border-radius-topright: 8px; - border-radius-topleft: 8px; - -webkit-box-shadow: 4px 4px 6px #48577D; - -webkit-border-top-right-radius: 8px; - -webkit-border-top-left-radius: 8px; - border-top-right-radius: 8px; - border-top-left-radius: 8px; -} - -div.tabs-content { - padding: 4px; - position: relative; - background: #7989D6; - -moz-border-radius: 8px; - border-radius: 8px; - -webkit-border-radius: 8px; -} - -div.tabs-content-inner { - margin: 1px; - padding: 10px; - background: white; - border-radius: 6px; - -moz-border-radius: 6px; - -webkit-border-radius: 6px; -} - - -/* Tutorial Nav Bar */ - -#tutorial-nav { - margin: 0.5em 0 1em 0; - padding: 0; - list-style-type: none; - background: #7989D6; - - -moz-border-radius: 15px; - -webkit-border-radius: 15px; - border-radius: 15px; - - -moz-box-shadow: 4px 4px 6px #48577D; - -webkit-box-shadow: 4px 4px 6px #48577D; - box-shadow: 4px 4px 6px #48577D; -} - - -#tutorial-nav li { - display: inline; -} - - -#tutorial-nav a:link, #tutorial-nav a:visited { - font-size: 1.2em; - color: #FFF; - text-decoration: none; - text-align: center; - display: inline-block; - width: 11em; - padding: 0.2em 0; -} - - -#tutorial-nav a:hover { - color: #000; -} diff --git a/docs/src/templates/css/docs.css b/docs/src/templates/css/docs.css deleted file mode 100644 index 10b60b5b..00000000 --- a/docs/src/templates/css/docs.css +++ /dev/null @@ -1,575 +0,0 @@ -/* Logo */ - -.header .brand { - padding-top: 6px; - padding-bottom: 0px; -} - -.header .brand img { - height: 25px; - width: 92px; -} - -/* end: Logo */ - - -/* this is here to avoid the display=block shuffling of ngShow */ -.breadcrumb li > * { - float:left; - margin:0 2px 0 0; -} - -.breadcrumb { - padding-bottom:2px; -} - -.clear-navbar { - margin-top: 60px; -} - -.footer { - padding-top: 2em; - background-color: #333; - color: white; - padding-bottom: 2em; -} - -.spacer { - height: 1em; -} - - -.icon-cog { - line-height: 13px; -} - -/* =============================== */ - -.side-navigation .dropdown-menu { - margin-left: 10px; -} - -.side-navigation .code { - font-family: monospace; - font-weight: bold; - font-size: 13px; - color: black; -} - -.side-navigation > ul.nav > li.module { - background-color: #d3d3d3; -} - -.side-navigation > ul.nav > li.section { - background-color: #ebebeb; - min-height: 14px; -} - -.side-navigation > ul.nav > li.last { - padding-bottom: 1em; -} - -.side-navigation > ul.nav > li.last + li.api-list-item { - margin-top:-1em; - padding-bottom: 1em; -} - -.side-navigation .well { - border-color: #d3d3d3; - padding-top: 0; - padding-bottom: 0; - margin-bottom: 15px; -} - -.side-navigation .well .nav-header { - text-transform: none; - margin-top: 0; - margin-left: -15px; - margin-right: -15px; -} - -.side-navigation .well .nav-header a { - text-transform: none; - color: black; -} -.side-navigation .well .nav-header a:hover { - background-color: inherit; -} - -.side-navigation .well li { - line-height: 14px; -} - -.side-navigation .well .guide { - float: right; - padding-top: 0; - color: gray; -} - -/* =============================== */ -/* Content */ -/* =============================== */ - -.improve-docs, .view-source { - float: right; - margin: 0 5px; - position: relative; -} - -.improve-docs { - z-index:100; -} - -.hint { - font-size: .7em; - color: #c0c0c0; -} - -.content code { - background-color: inherit; - color: inherit; - border: none; - padding: 0; - font-size: inherit; - font-family: monospace; - white-space: nowrap; -} - -.content pre code { - white-space: inherit; -} - -.content h2, -.content h3, -.content h4, -.content h5 { - margin-top: 1em; - letter-spacing: -0.06em; -} - -.content h2 { - font-size: 36px; - margin-bottom: .5em; -} - -.content h3 { - font-size: 24px; - border-top: 1px solid #eee; - padding-top: .5em; -} - -.content h4 { - font-size: 16px; - margin-top: 1.5em; -} - -.content ul { - margin-top: .5em; -} - -.content h6 { - text-transform:none; - color:black; -} - -ul.parameters > li > p, -.returns > p { - display: inline; -} - -ul.methods > li, -ul.properties > li, -ul.events > li { - list-style: none; - min-height: 20px; - padding: 19px; - margin-bottom: 20px; - background-color: #f5f5f5; - border: 1px solid #eee; - border: 1px solid rgba(0, 0, 0, 0.05); - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); - -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); -} - -.member.method > h2, -.member.property > h2, -.member.event > h2 { - margin-bottom: .5em; -} - -ul.methods > li > h3, -ul.properties > li > h3, -ul.events > li > h3 { - margin: -19px -19px 1em -19px; - padding: .25em 19px; - background-color: #d3d3d3; - font-family: monospace; -} - -.center { - display: block; - margin: 2em auto; -} - -.diagram { - display: block; - margin: 2em auto; - padding: 1em; - border: 1px solid black; - - -moz-box-shadow: 4px 4px 6px #48577D; - -webkit-box-shadow: 4px 4px 6px #48577D; - box-shadow: 4px 4px 6px #48577D; - - -moz-border-radius: 15px; - -webkit-border-radius: 15px; - border-radius: 15px; -} - -.tutorial-nav { - margin-left: 175px; - color: black; - margin-top: 2em; - margin-bottom: 2em; -} - -.tutorial-nav a { - color: white; -} - -.tutorial-nav a:hover { - color: white; - text-decoration: none; -} - -.tutorial-nav li { - margin-right: 5px; -} - -.clear { - clear: both; -} - -.variables-matrix td { - vertical-align:top; - padding:5px; -} - -.type-hint { - display:inline-block; -} - -.variables-matrix .type-hint { - text-align:center; - display:block; - min-width:60px; -} - -.type-hint + .type-hint { - margin-top:5px; -} - -.type-hint-string { - background:#3a87ad; -} - -.type-hint-object { - background:#999; -} - -.type-hint-array { - background:#F90;; -} - -.type-hint-boolean { - background:rgb(18, 131, 39); -} - -.type-hint-number { - background:rgb(189, 63, 66); -} - -.syntax-links { - background:#eee; - border:1px solid #ddd; - text-align:right; - padding:1em; - border-bottom:0; - border-top-left-radius:4px; - border-top-right-radius:4px; -} - -.syntax-links a { - margin-left:10px; -} - -.syntax-links + pre { - border-top-left-radius:0; - border-top-right-radius:0; -} - -.search-results { - clear:both; - display:table; - width:100%; -} - -.search-results.ng-hide { - display:none; -} - -.search-results > .search-group { - vertical-align:top; - padding:10px 0; - display:table-cell; -} - -.search-group.cols-1 { width:100%; } -.search-group.cols-2 { width:50%; } -.search-group.cols-3 { width:33%; } -.search-group.cols-4 { width:25%; } - -.search-close { - z-index:1029; - position:absolute; - bottom:-25px; - left:80%; - text-align:center; - line-height:50px; - width:50px; - font-size:2em; - background:#222222; - border-radius:15px; -} - -.search-close span { - text-decoration:none; - position:relative; - z-index:1031; -} - -.tutorial-index-page, -.tutorial-the-end-page { - padding-top:50px; -} - -.tutorial-page { - position:relative; -} - -.tutorial-page .improve-docs { - position:absolute; - top:0; - right:0; -} - -.nocode-content { - cursor:pointer; - display:inline-block; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; - - -webkit-transition:0.5s linear all; - -moz-transition:0.5s linear all; - -o-transition:0.5s linear all; - transition:0.5s linear all; - color: #223f7a; - background:#ddd; - border: 1px solid #ccc; -} - -.nocode-content:hover { - background-color: #99c2ff; - border: 1px solid #e1e1e8; -} - -.popover-incode .popover-inner { - width:auto; - min-width:200px; - max-width:500px; -} - -.popover-incode { - -webkit-transition:0.2s linear opacity; - -moz-transition:0.2s linear opacity; - -o-transition:0.2s linear opacity; - transition:0.2s linear opacity; - opacity:0; -} - -.popover-incode.visible { - opacity:1; -} - -.popover-incode code, -.popover-incode pre { - white-space:nowrap; -} - -.popover-incode .arrow { - left:50px!important; -} - -.foldover-content { - display:none; -} - -.foldout:after { - content:""; - position:absolute; - left:50%; - top:-1px; - margin-left:-10px; - border-width:10px; - border-style:solid; - border-color:#f7f7f9 transparent transparent; -} - -.foldout:before { - content:""; - position:absolute; - left:50%; - top:0; - margin-left:-10px; - border-width:10px; - border-style:solid; - border-color:#bbb transparent transparent; -} - -.foldout { - padding:8px 15px 5px; - position:relative; - background:#eee; - white-space:normal; - box-shadow:inset 0 0 20px #ccc; - border-top:1px solid #bbb; -} - -.prettyprint { - padding-right:0!important; - padding-bottom:0!important; -} - -pre ol li { - padding-bottom:2px; - padding-right:5px; -} - -#docs-fold { - position:absolute; - top:0; - right:0; - width:500px; - min-height:100%; - padding-top:50px; - padding:50px 20px 20px 20px; - background:white; - border-left:1px solid #999; - box-shadow:0 0 10px #555; - z-index:1002; -} - -#docs-fold.fold-show { - -webkit-transition:0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) all; - -moz-transition:0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) all; - -o-transition:0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) all; - transition:0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) all; -} - -#docs-fold.fold-show { - right:-200px; - opacity:0; -} - -#docs-fold.fold-show.fold-show-active { - right:0; - opacity:1; -} - -#docs-fold-overlay { - background:rgba(255,255,255,0.5); - position:fixed; - left:0; - bottom:0; - right:0; - top:0; - z-index:1001; - cursor:pointer; -} - -.fixed_body { - position:fixed; - top:0; - z-index:1000; - left:0; - right:0; -} - -#docs-fold-close { - z-index: 1029; - position: absolute; - left: -30px; - top: 60px; - cursor:pointer; - text-align: center; - width:50px; - line-height:50px; - font-size: 2em; - background: #fff; - box-shadow:-6px 0 5px #555; - display:block; - border-radius:10px; -} - -.docs-version-jump { - width:180px; - margin-bottom:20px; -} - -.minerr-errmsg { - clear: both; - position: relative; - top: 10px; - font-size: 16px; - word-break: normal; -} - -.text-info { - color:#3a87ad; -} - -.definition-table tr > td:first-child { - font-weight:bold; - width:30%; -} - -.definition-table.spaced { - margin-bottom:30px; -} - -.definition-table td { - vertical-align: top; -} - -.component-heading { - text-transform:capitalize; -} - -.component-breakdown { - margin-bottom:30px; - padding-bottom:30px; - border-bottom:1px solid #aaa; -} - -td.success { - background-color: #dff0d8; -} - -td.error { - background-color: #f2dede; -} diff --git a/docs/src/templates/css/prettify.css b/docs/src/templates/css/prettify.css deleted file mode 100644 index 16e0cafb..00000000 --- a/docs/src/templates/css/prettify.css +++ /dev/null @@ -1,51 +0,0 @@ -.pln { color: #000 } /* plain text */ - -@media screen { - .str { color: #080 } /* string content */ - .kwd { color: #008 } /* a keyword */ - .com { color: #800 } /* a comment */ - .typ { color: #606 } /* a type name */ - .lit { color: #066 } /* a literal value */ - /* punctuation, lisp open bracket, lisp close bracket */ - .pun, .opn, .clo { color: #660 } - .tag { color: #008 } /* a markup tag name */ - .atn { color: #606 } /* a markup attribute name */ - .atv { color: #080 } /* a markup attribute value */ - .dec, .var { color: #606 } /* a declaration; a variable name */ - .fun { color: red } /* a function name */ -} - -/* Use higher contrast and text-weight for printable form. */ -@media print, projection { - .str { color: #060 } - .kwd { color: #006; font-weight: bold } - .com { color: #600; font-style: italic } - .typ { color: #404; font-weight: bold } - .lit { color: #044 } - .pun, .opn, .clo { color: #440 } - .tag { color: #006; font-weight: bold } - .atn { color: #404 } - .atv { color: #060 } -} - -pre.prettyprint { - padding: 8px; - background-color: #f7f7f9; - border: 1px solid #e1e1e8; -} -pre.prettyprint.linenums { - -webkit-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0; - -moz-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0; - box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0; -} -ol.linenums { - margin: 0 0 0 33px; /* IE indents via margin-left */ -} -ol.linenums li { - padding-left: 12px; - font-size:12px; - color: #bebec5; - line-height: 18px; - text-shadow: 0 1px 0 #fff; - list-style-type:decimal!important; -} diff --git a/docs/src/templates/docs-scenario.html b/docs/src/templates/docs-scenario.html deleted file mode 100644 index 2eca5f87..00000000 --- a/docs/src/templates/docs-scenario.html +++ /dev/null @@ -1,44 +0,0 @@ -<!DOCTYPE HTML> -<html xmlns:ng="http://angularjs.org"> -<head> - <title>AngularJS Docs E2E Test Runner</title> - <script> - var production = location.hostname === 'docs.angularjs.org', - headEl = document.head, - angularVersion = { - current: '"NG_VERSION_FULL"', // rewrite during build - cdn: '"NG_VERSION_CDN"' - }; - - addTag('script', {src: path('angular-scenario.js')}, function() { - addTag('script', {src: 'docs-scenario.js'}, function() { - angular.scenario.setUpAndRun(); - }); - }); - - function addTag(name, attributes, callback) { - var el = document.createElement(name), - attrName; - - for (attrName in attributes) { - el.setAttribute(attrName, attributes[attrName]); - } - - if (callback) { - el.onload = callback; - } - - headEl.appendChild(el); - } - - - function path(name) { - return production - ? 'http://code.angularjs.org/' + angularVersion.cdn + '/' + name - : '../' + name; - } - </script> -</head> -<body> -</body> -</html> diff --git a/docs/src/templates/favicon.ico b/docs/src/templates/favicon.ico Binary files differdeleted file mode 100644 index fe24a63a..00000000 --- a/docs/src/templates/favicon.ico +++ /dev/null diff --git a/docs/src/templates/index.html b/docs/src/templates/index.html deleted file mode 100644 index bc695119..00000000 --- a/docs/src/templates/index.html +++ /dev/null @@ -1,388 +0,0 @@ -<!doctype html> -<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7 ng-app: docsApp;" lang="en" ng-controller="DocsController"> <![endif]--> -<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8 ng-app: docsApp;" lang="en" ng-controller="DocsController"> <![endif]--> -<!--[if IE 8]> <html class="no-js lt-ie9 ng-app: docsApp;" lang="en" ng-controller="DocsController"> <![endif]--> -<!--[if gt IE 8]><!--> <html class="no-js ng-app: docsApp;" lang="en" ng-controller="DocsController"> <!--<![endif]--> -<head> - <style> - .ng-hide { display:none!important; } - </style> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> - <meta name="Description" - content="AngularJS is what HTML would have been, had it been designed for building web-apps. - Declarative templates with data-binding, MVC, dependency injection and great - testability story all implemented with pure client-side JavaScript!"> - <meta name="fragment" content="!"> - <title ng-bind-template="AngularJS: {{partialTitle}}">AngularJS</title> - <script type="text/javascript"> - // dynamically add base tag as well as css and javascript files. - // we can't add css/js the usual way, because some browsers (FF) eagerly prefetch resources - // before the base attribute is added, causing 404 and terribly slow loading of the docs app. - (function() { - if (window.name.indexOf('NG_DEFER_BOOTSTRAP!') == 0) { - //TODO(i): super ugly hack to temporarily speed up our e2e tests until we move to protractor + extracted examples - window.RUNNING_IN_NG_TEST_RUNNER = true; - } - - var indexFile = (location.pathname.match(/\/(index[^\.]*\.html)/) || ['', ''])[1], - rUrl = /(#!\/|api|guide|misc|tutorial|error|index[^\.]*\.html).*$/, - baseUrl = location.href.replace(rUrl, indexFile), - jQuery = /index-jq[^\.]*\.html$/.test(baseUrl), - debug = /index[^\.]*-debug\.html$/.test(baseUrl), - production = location.hostname === 'docs.angularjs.org', - headEl = document.getElementsByTagName('head')[0], - sync = true, - angularVersion = { - current: '"NG_VERSION_FULL"', // rewrite during build - cdn: '"NG_VERSION_CDN"' - }; - - addTag('base', {href: baseUrl}); - addTag('link', {rel: 'stylesheet', href: 'components/bootstrap/css/' + (debug ? 'bootstrap.css' : 'bootstrap.min.css'), type: 'text/css'}); - addTag('link', {rel: 'stylesheet', href: 'components/font-awesome/css/' + (debug ? 'font-awesome.css' : 'font-awesome.min.css'), type: 'text/css'}); - addTag('link', {rel: 'stylesheet', href: 'css/prettify.css', type: 'text/css'}); - addTag('link', {rel: 'stylesheet', href: 'css/docs.css', type: 'text/css'}); - addTag('link', {rel: 'stylesheet', href: 'css/animations.css', type: 'text/css'}); - if (jQuery) addTag('script', {src: (debug ? 'components/jquery.js' : 'components/jquery.min.js')}); - addTag('script', {src: path('angular.js')}, sync); - addTag('script', {src: path('angular-resource.js') }, sync); - addTag('script', {src: path('angular-route.js') }, sync); - addTag('script', {src: path('angular-cookies.js') }, sync); - addTag('script', {src: path('angular-sanitize.js') }, sync); - addTag('script', {src: path('angular-touch.js') }, sync); - addTag('script', {src: path('angular-animate.js') }, sync); - addTag('script', {src: 'components/angular-bootstrap.js' }, sync); - addTag('script', {src: 'components/angular-bootstrap-prettify.js' }, sync); - if (!window.RUNNING_IN_NG_TEST_RUNNER) { - addTag('script', {src: 'components/google-code-prettify.js' }, sync); - addTag('script', {src: 'components/' + (debug ? 'lunr.js' : 'lunr.min.js') }, sync); - } - addTag('script', {src: 'components/marked.js' }, sync); - addTag('script', {src: 'docs-data.js'}, sync); - addTag('script', {src: 'js/docs.js'}, sync); - - function path(name) { - if (production) { - if (name.match(/^angular(-\w+)?\.js/) && !name.match(/bootstrap/)) { - name = '//ajax.googleapis.com/ajax/libs/angularjs/' + - angularVersion.cdn + - '/' + - name.replace(/\.js$/, '.min.js'); - } else { - name = 'http://code.angularjs.org/' + - angularVersion.cdn + - '/' + - name.replace(/\.js$/, '.min.js'); - } - return name; - } - return '../' + name.replace(/\.js$/, debug ? '.js' : '.min.js'); - } - - function addTag(name, attributes, sync) { - var el = document.createElement(name), - attrName; - - for (attrName in attributes) { - el.setAttribute(attrName, attributes[attrName]); - } - - sync ? document.write(outerHTML(el)) : headEl.appendChild(el); - } - - function outerHTML(node){ - // if IE, Chrome take the internal method otherwise build one - return node.outerHTML || ( - function(n){ - var div = document.createElement('div'), h; - div.appendChild(n); - h = div.innerHTML; - div = null; - return h; - })(node); - } - })(); - - - // force page reload when new update is available - window.applicationCache && window.applicationCache.addEventListener('updateready', function(e) { - if (window.applicationCache.status == window.applicationCache.UPDATEREADY) { - window.applicationCache.swapCache(); - window.location.reload(); - } - }, false); - - - // GA asynchronous tracker - var _gaq = _gaq || []; - _gaq.push(['_setAccount', 'UA-8594346-3']); - _gaq.push(['_setDomainName', '.angularjs.org']); - - if (!window.RUNNING_IN_NG_TEST_RUNNER) { - (function() { - var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; - ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; - var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); - })(); - } - </script> -</head> - -<body> - <header class="header" ng-controller="DocsNavigationCtrl"> - <div class="navbar navbar-inverse navbar-fixed-top"> - <div class="navbar-inner"> - <div class="container"> - <a class="brand" href="http://angularjs.org"> - <img class="logo" src="img/angularjs-for-header-only.svg"> - </a> - <ul class="nav"> - <li class="divider-vertical"></li> - <li><a href="http://angularjs.org"><i class="icon-home icon-white"></i> Home</a></li> - <li class="divider-vertical"></li> - <li class="dropdown"> - <a href="#" class="dropdown-toggle" data-toggle="dropdown"> - <i class="icon-eye-open icon-white"></i> Learn <b class="caret"></b> - </a> - <ul class="dropdown-menu"> - <li class="disabled"><a href="http://angularjs.org/">Why AngularJS?</a></li> - <li><a href="http://www.youtube.com/user/angularjs">Watch</a></li> - <li><a href="tutorial">Tutorial</a></li> - <li><a href="http://builtwith.angularjs.org/">Case Studies</a></li> - <li><a href="https://github.com/angular/angular-seed">Seed App project template</a></li> - <li><a href="misc/faq">FAQ</a></li> - </ul> - </li> - <li class="divider-vertical"></li> - <li class="dropdown active"> - <a href="#" class="dropdown-toggle" data-toggle="dropdown"> - <i class="icon-book icon-white"></i> Develop <b class="caret"></b> - </a> - <ul class="dropdown-menu"> - <li><a href="./tutorial/">Tutorial</a></li> - <li><a href="./guide/">Developer Guide</a></li> - <li><a href="./api/">API Reference</a></li> - <li><a href="./error/">Error Reference</a></li> - <li><a href="http://docs.angularjs.org/misc/contribute">Contribute</a></li> - <li><a href="http://code.angularjs.org/">Download</a></li> - </ul> - </li> - <li class="divider-vertical"></li> - <li class="dropdown"> - <a href="#" class="dropdown-toggle" data-toggle="dropdown"> - <i class="icon-comment icon-white"></i> Discuss <b class="caret"></b> - </a> - <ul class="dropdown-menu"> - <li><a href="http://blog.angularjs.org">Blog</a></li> - <li><a href="http://groups.google.com/group/angular">Mailing List</a></li> - <li><a href="http://webchat.freenode.net/?channels=angularjs&uio=d4">Chat Room</a></li> - <li class="divider"></li> - <li><a href="https://twitter.com/#!/angularjs">Twitter</a></li> - <li><a href="https://plus.google.com/110323587230527980117">Google+</a></li> - <li class="divider"></li> - <li><a href="https://github.com/angular/angular.js">GitHub</a></li> - <li><a href="https://github.com/angular/angular.js/issues">Issue Tracker</a></li> - </ul> - </li> - <li class="divider-vertical"></li> - </ul> - <form class="navbar-search pull-right" ng-submit="submit()"> - <input type="text" - name="as_q" - class="search-query" - placeholder="Click to focus or press '/' to search" - ng-change="search(q)" - ng-model="q" - docs-search-input - autocomplete="off" /> - </form> - <div ng-show="hasResults" class="search-results"> - <div ng-repeat="(key, value) in results" class="search-group" ng-class="colClassName"> - <h4>{{ key }}</h4> - <div ng-repeat="item in value" class="search-result"> - <a ng-click="hideResults()" href="{{ item.url }}">{{ item.shortName }}</a> - </div> - </div> - <a href="" ng-click="hideResults()" class="search-close"> - <span class="icon-remove-sign"></span> - </a> - </div> - </div> - </div> - </div> - </header> - - <div class="ng-hide" id="docs-fold-overlay" ng-show="docs_fold" ng-click="fold(null)"></div> - <div class="foldout ng-hide" id="docs-fold" ng-show="docs_fold"> - <div id="docs-fold-close" ng-click="fold(null)"> - <span class="icon-remove-sign"></span> - </div> - <div ng-include="docs_fold"></div> - </div> - -<div ng-class="{fixed_body:docs_fold}"> - <div role="main" class="container"> - <div class="row clear-navbar"></div> - - <div class="row"> - <div class="span12"> - <!--[if lt IE 7]> - <p class="alert alert-error">Your browser is <em>ancient!</em> - <a href="http://browsehappy.com/">Upgrade to a different browser</a> or - <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to - experience this site. - </p> - <![endif]--> - - <!--[if lt IE 9]> - <div class="alert"> - You are using an old version of Internet Explorer. - For better and safer browsing experience please <a href="http://www.microsoft.com/IE9">upgrade IE</a> - or install <a href="http://google.com/chrome">Google Chrome browser</a>. - </div> - <![endif]--> - </div> - - </div> - - <div class="row"> - <div class="span3"> - <div class="well"> - <div ng-controller="DocsVersionsCtrl"> - <select ng-options="v as v.title group by v.group for v in docs_versions" - ng-model="docs_version" - ng-change="jumpToDocsVersion(docs_version)" - class="docs-version-jump"> - </select> - </div> - <div class="side-navigation"> - <ul class="nav nav-list" ng-hide="page"> - <li ng-repeat="page in pages track by page.url" ng-class="navClass(page)" class="api-list-item"> - <a href="{{page.url}}" tabindex="2">{{page.shortName}}</a> - </li> - </ul> - - <ul class="nav nav-list well api-list-item" ng-repeat="namespace in namespaces track by namespace.url"> - <li class="nav-header module"> - <a class="code" href="{{namespace.url}}">{{namespace.name}}</a> - </li> - - <li ng-repeat="page in namespace.errors track by page.url" ng-class="navClass(page)" class="api-list-item"> - <a href="{{page.url}}" tabindex="2">{{page.shortName}}</a> - </li> - </ul> - - <ul class="nav nav-list well api-list-item" ng-repeat="module in modules track by module.url"> - <li class="nav-header module"> - <a class="guide" href="{{URL.module}}">module</a> - <a class="code" href="{{module.url}}">{{module.name}}</a> - </li> - - <li class="nav-header section" ng-show="module.directives"> - <a href="{{URL.directive}}" class="guide">directive</a> - </li> - <li ng-repeat="page in module.directives track by page.url" ng-class="navClass(page)" class="api-list-item"> - <a href="{{page.url}}" tabindex="2">{{page.shortName}}</a> - </li> - - <li class="nav-header section" ng-show="module.filters"> - <a href="{{URL.filter}}" class="guide">filter</a> - </li> - <li ng-repeat="page in module.filters track by page.url" ng-class="navClass(page)" class="api-list-item"> - <a href="{{page.url}}" tabindex="2">{{page.shortName}}</a> - </li> - - <li class="nav-header section" ng-show="module.services"> - <a href="{{URL.service}}" class="guide">service</a> - </li> - <li ng-repeat="service in module.services track by service.instance.url" ng-class="navClass(service.instance, service.provider)" class="api-list-item"> - <a ng-show="service.provider" class="pull-right" href="{{service.provider.url}}" tabindex="2"><i class="icon-cog"></i></a> - <a href="{{service.instance.url}}" tabindex="2">{{service.name}}</a> - </li> - - <li class="nav-header section" ng-show="module.types"> - <a href="{{URL.type}}" class="guide">Types</a> - </li> - <li ng-repeat="page in module.types track by page.url" ng-class="navClass(page)" class="api-list-item"> - <a href="{{page.url}}" tabindex="2">{{page.shortName}}</a> - </li> - - <li class="nav-header section" ng-show="module.globals"> - <a href="{{URL.api}}" class="global guide">global APIs</a> - - </li> - <li ng-repeat="page in module.globals track by page.url" ng-class="navClass(page)" class="api-list-item"> - <a href="{{page.url}}" tabindex="2">{{page.id}}</a> - </li> - - </ul> - - </div> - </div> - </div> - <div class="span9"> - - <ul class="breadcrumb"> - <li ng-repeat="crumb in breadcrumb"> - <span ng-hide="crumb.url">{{crumb.name}}</span> - <a ng-show="crumb.url" href="{{crumb.url}}">{{crumb.name}}</a> - <span ng-show="crumb.url" class="divider">/</span> - </li> - </ul> - - <div id="loading" ng-show="loading">Loading...</div> - - <div ng-hide="loading" ng-include src="currentPage.partialUrl" onload="afterPartialLoaded()" autoscroll class="content slide-reveal"></div> - </div> - </div> - </div> - - - - <div id="fader" ng-show="subpage" style="display: none"></div> - <div id="subpage" ng-show="subpage" style="display: none"> - <div> - <h2>Would you like full offline support for this AngularJS Docs App?</h2> - <a ng-click="subpage=false">✕</a> - <p> - If you want to be able to access the entire AngularJS documentation offline, click the - button below. This will reload the current page and trigger background downloads of all the - necessary files (approximately 3.5MB). The next time you load the docs, the browser will - use these cached files. - <br><br> - This feature is supported on all modern browsers, except for IE9 which lacks application - cache support. - </p> - <button id="cacheButton" ng-click="enableOffline()">Let me have them all!</button> - </div> - </div> - - <footer class="footer"> - <div class="container"> - <p class="pull-right"><a back-to-top href="#">Back to top</a></p> - - <p> - Super-powered by Google ©2010-2012 - ( <a id="version" - ng-href="https://github.com/angular/angular.js/blob/master/CHANGELOG.md#{{versionNumber}}" - ng-bind-template="v{{version}}"> - </a> - <!-- TODO(i): enable - <a ng-hide="offlineEnabled" ng-click ="subpage = true">(enable offline support)</a> - <span ng-show="offlineEnabled">(offline support enabled)</span> - --> - ) - </p> - <p> - Code licensed under the - <a href="https://github.com/angular/angular.js/blob/master/LICENSE" target="_blank">The - MIT License</a>. Documentation licensed under <a - href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>. - </p> - </div> - </footer> -</div> - -</body> -</html> diff --git a/docs/src/templates/js/docs.js b/docs/src/templates/js/docs.js deleted file mode 100644 index dad57aa5..00000000 --- a/docs/src/templates/js/docs.js +++ /dev/null @@ -1,933 +0,0 @@ -var docsApp = { - controller: {}, - directive: {}, - serviceFactory: {}, - filter: {} -}; - -docsApp.controller.DocsVersionsCtrl = ['$scope', '$rootScope', '$window', 'NG_VERSIONS', 'NG_VERSION', function($scope, $rootScope, $window, NG_VERSIONS, NG_VERSION) { - $scope.docs_versions = NG_VERSIONS; - $scope.docs_version = NG_VERSIONS[0]; - - $scope.jumpToDocsVersion = function(version) { - var currentPagePath = ''; - - // preserve URL path when switching between doc versions - if (angular.isObject($rootScope.currentPage) && $rootScope.currentPage.section && $rootScope.currentPage.id) { - currentPagePath = '/' + $rootScope.currentPage.section + '/' + $rootScope.currentPage.id; - } - - $window.location = version.url + currentPagePath; - }; -}]; - -docsApp.controller.DocsNavigationCtrl = ['$scope', '$location', 'docsSearch', function($scope, $location, docsSearch) { - function clearResults() { - $scope.results = []; - $scope.colClassName = null; - $scope.hasResults = false; - } - - $scope.search = function(q) { - var MIN_SEARCH_LENGTH = 3; - if(q.length >= MIN_SEARCH_LENGTH) { - var results = docsSearch(q); - var totalSections = 0; - for(var i in results) { - ++totalSections; - } - if(totalSections > 0) { - $scope.colClassName = 'cols-' + totalSections; - } - $scope.hasResults = totalSections > 0; - $scope.results = results; - } - else { - clearResults(); - } - if(!$scope.$$phase) $scope.$apply(); - }; - $scope.submit = function() { - var result; - for(var i in $scope.results) { - result = $scope.results[i][0]; - if(result) { - break; - } - } - if(result) { - $location.path(result.url); - $scope.hideResults(); - } - }; - $scope.hideResults = function() { - clearResults(); - $scope.q = ''; - }; -}]; - -docsApp.serviceFactory.lunrSearch = function() { - return function(properties) { - if (window.RUNNING_IN_NG_TEST_RUNNER) return null; - - var engine = lunr(properties); - return { - store : function(values) { - engine.add(values); - }, - search : function(q) { - return engine.search(q); - } - }; - }; -}; - -docsApp.serviceFactory.docsSearch = ['$rootScope','lunrSearch', 'NG_PAGES', - function($rootScope, lunrSearch, NG_PAGES) { - if (window.RUNNING_IN_NG_TEST_RUNNER) { - return null; - } - - var index = lunrSearch(function() { - this.ref('id'); - this.field('title', {boost: 50}); - this.field('description', { boost : 20 }); - }); - - angular.forEach(NG_PAGES, function(page, i) { - var title = page.shortName; - if(title.charAt(0) == 'n' && title.charAt(1) == 'g') { - title = title + ' ' + title.charAt(2).toLowerCase() + title.substr(3); - } - index.store({ - id: i, - title: title, - description: page.keywords - }); - }); - - return function(q) { - var results = {}; - angular.forEach(index.search(q), function(result) { - var item = NG_PAGES[result.ref]; - var section = item.section; - results[section] = results[section] || []; - if(results[section].length < 15) { - results[section].push(item); - } - }); - return results; - }; -}]; - -docsApp.directive.focused = function($timeout) { - return function(scope, element, attrs) { - element[0].focus(); - element.on('focus', function() { - scope.$apply(attrs.focused + '=true'); - }); - element.on('blur', function() { - // have to use $timeout, so that we close the drop-down after the user clicks, - // otherwise when the user clicks we process the closing before we process the click. - $timeout(function() { - scope.$eval(attrs.focused + '=false'); - }); - }); - scope.$eval(attrs.focused + '=true'); - }; -}; - -docsApp.directive.docsSearchInput = ['$document',function($document) { - return function(scope, element, attrs) { - var ESCAPE_KEY_KEYCODE = 27, - FORWARD_SLASH_KEYCODE = 191; - angular.element($document[0].body).bind('keydown', function(event) { - if(event.keyCode == FORWARD_SLASH_KEYCODE && document.activeElement) { - var activeElement = document.activeElement; - var activeTagName = activeElement.nodeName.toLowerCase(); - var hasInputFocus = activeTagName == 'input' || activeTagName == 'select' || - activeTagName == 'option' || activeTagName == 'textarea' || - activeElement.hasAttribute('contenteditable'); - if(!hasInputFocus) { - event.stopPropagation(); - event.preventDefault(); - - var input = element[0]; - input.focus(); - } - } - }); - - element.bind('keydown', function(event) { - if(event.keyCode == ESCAPE_KEY_KEYCODE) { - event.stopPropagation(); - event.preventDefault(); - scope.$apply(function() { - scope.hideResults(); - }); - } - }); - }; -}]; - - -docsApp.directive.code = function() { - return { restrict:'E', terminal: true }; -}; - - -docsApp.directive.sourceEdit = function(getEmbeddedTemplate) { - return { - template: '<div class="btn-group pull-right">' + - '<a class="btn dropdown-toggle btn-primary" data-toggle="dropdown" href>' + - ' <i class="icon-pencil icon-white"></i> Edit<span class="caret"></span>' + - '</a>' + - '<ul class="dropdown-menu">' + - ' <li><a ng-click="plunkr($event)" href="">In Plunkr</a></li>' + - ' <li><a ng-click="fiddle($event)" href="">In JsFiddle</a></li>' + - '</ul>' + - '</div>', - scope: true, - controller: function($scope, $attrs, openJsFiddle, openPlunkr) { - var sources = { - module: $attrs.sourceEdit, - deps: read($attrs.sourceEditDeps), - html: read($attrs.sourceEditHtml), - css: read($attrs.sourceEditCss), - js: read($attrs.sourceEditJs), - json: read($attrs.sourceEditJson), - unit: read($attrs.sourceEditUnit), - scenario: read($attrs.sourceEditScenario) - }; - $scope.fiddle = function(e) { - e.stopPropagation(); - openJsFiddle(sources); - }; - $scope.plunkr = function(e) { - e.stopPropagation(); - openPlunkr(sources); - }; - } - }; - - function read(text) { - var files = []; - angular.forEach(text ? text.split(' ') : [], function(refId) { - // refId is index.html-343, so we need to strip the unique ID when exporting the name - files.push({name: refId.replace(/-\d+$/, ''), content: getEmbeddedTemplate(refId)}); - }); - return files; - } -}; - -docsApp.directive.docModuleComponents = function() { - return { - template: ' <div class="component-breakdown">' + - ' <h2>Module Components</h2>' + - ' <div ng-repeat="(key, section) in components">' + - ' <h3 class="component-heading" id="{{ section.type }}">{{ section.title }}</h3>' + - ' <table class="definition-table">' + - ' <tr>' + - ' <th>Name</th>' + - ' <th>Description</th>' + - ' </tr>' + - ' <tr ng-repeat="component in section.components">' + - ' <td><a ng-href="{{ component.url }}">{{ component.shortName }}</a></td>' + - ' <td>{{ component.shortDescription }}</td>' + - ' </tr>' + - ' </table>' + - ' </div>' + - ' </div>', - scope : { - module : '@docModuleComponents' - }, - controller : ['$scope', '$anchorScroll', '$timeout', 'sections', - function($scope, $anchorScroll, $timeout, sections) { - var validTypes = ['property','function','directive','service','object','filter']; - var components = {}; - angular.forEach(sections.api, function(item) { - if(item.moduleName == $scope.module) { - var type = item.type; - if(type == 'object') type = 'service'; - if(validTypes.indexOf(type) >= 0) { - components[type] = components[type] || { - title : type, - type : type, - components : [] - }; - components[type].components.push(item); - } - } - }); - $scope.components = components; - $timeout($anchorScroll, 0, false); - }] - }; -}; - -docsApp.directive.docTutorialNav = function(templateMerge) { - var pages = [ - '', - 'step_00', 'step_01', 'step_02', 'step_03', 'step_04', - 'step_05', 'step_06', 'step_07', 'step_08', 'step_09', - 'step_10', 'step_11', 'step_12', 'the_end' - ]; - return { - compile: function(element, attrs) { - var seq = 1 * attrs.docTutorialNav, - props = { - seq: seq, - prev: pages[seq], - next: pages[2 + seq], - diffLo: seq ? (seq - 1): '0~1', - diffHi: seq - }; - - element.addClass('btn-group'); - element.addClass('tutorial-nav'); - element.append(templateMerge( - '<a href="tutorial/{{prev}}"><li class="btn btn-primary"><i class="icon-step-backward"></i> Previous</li></a>\n' + - '<a href="http://angular.github.com/angular-phonecat/step-{{seq}}/app"><li class="btn btn-primary"><i class="icon-play"></i> Live Demo</li></a>\n' + - '<a href="https://github.com/angular/angular-phonecat/compare/step-{{diffLo}}...step-{{diffHi}}"><li class="btn btn-primary"><i class="icon-search"></i> Code Diff</li></a>\n' + - '<a href="tutorial/{{next}}"><li class="btn btn-primary">Next <i class="icon-step-forward"></i></li></a>', props)); - } - }; -}; - - -docsApp.directive.docTutorialReset = function() { - function tab(name, command, id, step) { - return '' + - ' <div class=\'tab-pane well\' title="' + name + '" value="' + id + '">\n' + - ' <ol>\n' + - ' <li><p>Reset the workspace to step ' + step + '.</p>' + - ' <pre>' + command + '</pre></li>\n' + - ' <li><p>Refresh your browser or check the app out on <a href="http://angular.github.com/angular-phonecat/step-' + step + '/app">Angular\'s server</a>.</p></li>\n' + - ' </ol>\n' + - ' </div>\n'; - } - - return { - compile: function(element, attrs) { - var step = attrs.docTutorialReset; - element.html( - '<div ng-hide="show">' + - '<p><a href="" ng-click="show=true;$event.stopPropagation()">Workspace Reset Instructions ➤</a></p>' + - '</div>\n' + - '<div class="tabbable" ng-show="show" ng-model="$cookies.platformPreference">\n' + - tab('Git on Mac/Linux', 'git checkout -f step-' + step, 'gitUnix', step) + - tab('Git on Windows', 'git checkout -f step-' + step, 'gitWin', step) + - '</div>\n'); - } - }; -}; - - -docsApp.filter.errorLink = ['$sanitize', function ($sanitize) { - var LINKY_URL_REGEXP = /((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s\.\;\,\(\)\{\}\<\>]/g, - MAILTO_REGEXP = /^mailto:/, - STACK_TRACE_REGEXP = /:\d+:\d+$/; - - var truncate = function (text, nchars) { - if (text.length > nchars) { - return text.substr(0, nchars - 3) + '...'; - } - return text; - }; - - return function (text, target) { - var targetHtml = target ? ' target="' + target + '"' : ''; - - if (!text) return text; - - return $sanitize(text.replace(LINKY_URL_REGEXP, function (url) { - if (STACK_TRACE_REGEXP.test(url)) { - return url; - } - - // if we did not match ftp/http/mailto then assume mailto - if (!/^((ftp|https?):\/\/|mailto:)/.test(url)) url = 'mailto:' + url; - - return '<a' + targetHtml + ' href="' + url +'">' + - truncate(url.replace(MAILTO_REGEXP, ''), 60) + - '</a>'; - })); - }; -}]; - - -docsApp.directive.errorDisplay = ['$location', 'errorLinkFilter', function ($location, errorLinkFilter) { - var interpolate = function (formatString) { - var formatArgs = arguments; - return formatString.replace(/\{\d+\}/g, function (match) { - // Drop the braces and use the unary plus to convert to an integer. - // The index will be off by one because of the formatString. - var index = +match.slice(1, -1); - if (index + 1 >= formatArgs.length) { - return match; - } - return formatArgs[index+1]; - }); - }; - - return { - link: function (scope, element, attrs) { - var search = $location.search(), - formatArgs = [attrs.errorDisplay], - i; - - for (i = 0; angular.isDefined(search['p'+i]); i++) { - formatArgs.push(search['p'+i]); - } - element.html(errorLinkFilter(interpolate.apply(null, formatArgs), '_blank')); - } - }; -}]; - - -/** - * backToTop Directive - * @param {Function} $anchorScroll - * - * @description Ensure that the browser scrolls when the anchor is clicked - */ -docsApp.directive.backToTop = ['$anchorScroll', function($anchorScroll) { - return function link(scope, element) { - element.on('click', function(event) { - scope.$apply($anchorScroll); - }); - }; -}]; - - -docsApp.serviceFactory.angularUrls = function($document) { - var urls = {}; - - angular.forEach($document.find('script'), function(script) { - var match = script.src.match(/^.*\/(angular[^\/]*\.js)$/); - if (match) { - urls[match[1].replace(/(\-\d.*)?(\.min)?\.js$/, '.js')] = match[0]; - } - }); - - return urls; -}; - - -docsApp.serviceFactory.formPostData = function($document) { - return function(url, fields) { - var form = angular.element('<form style="display: none;" method="post" action="' + url + '" target="_blank"></form>'); - angular.forEach(fields, function(value, name) { - var input = angular.element('<input type="hidden" name="' + name + '">'); - input.attr('value', value); - form.append(input); - }); - $document.find('body').append(form); - form[0].submit(); - form.remove(); - }; -}; - - -docsApp.serviceFactory.prepareDefaultAppModule = function() { - return function(content) { - var deps = []; - angular.forEach(content.deps, function(file) { - if(file.name == 'angular-animate.js') { - deps.push('ngAnimate'); - } - }); - - var moduleName = 'App'; - return { - module : moduleName, - script : "angular.module('" + moduleName + "', [" + - (deps.length ? "'" + deps.join("','") + "'" : "") + "]);\n\n" - }; - }; -}; - -docsApp.serviceFactory.prepareEditorAssetTags = function(angularUrls) { - return function(content, options) { - options = options || {}; - var includeLocalFiles = options.includeLocalFiles; - var html = makeScriptTag(angularUrls['angular.js']); - - var allFiles = [].concat(content.js, content.css, content.html, content.json); - angular.forEach(content.deps, function(file) { - if (file.name !== 'angular.js') { - var isLocal = false; - for(var i=0;i<allFiles.length;i++) { - if(allFiles[i].name == file.name) { - isLocal = true; - break; - } - } - if(!(isLocal && !includeLocalFiles)) { - var assetUrl = angularUrls[file.name] || file.name; - html += makeScriptTag(assetUrl); - } - } - }); - - if(includeLocalFiles) { - angular.forEach(content.css, function(file, index) { - html += makeCssLinkTag(file.name); - }); - } - - return html; - - - function makeScriptTag(src) { - return '<script type="text/javascript" src="' + src + '"></script>\n'; - }; - - function makeCssLinkTag(src) { - return '<link rel="stylesheet" type="text/css" href="' + src + '" />\n'; - }; - }; -}; - - -docsApp.serviceFactory.openPlunkr = function(templateMerge, formPostData, prepareEditorAssetTags, prepareDefaultAppModule) { - return function(content) { - var hasRouting = false; - angular.forEach(content.deps, function(file) { - hasRouting = hasRouting || file.name == 'angular-route.js'; - }); - var indexHtmlContent = '<!doctype html>\n' + - '<html ng-app="{{module}}">\n' + - ' <head>\n' + - '{{scriptDeps}}'; - - if(hasRouting) { - indexHtmlContent += '<script type="text/javascript">\n' + - '//this is here to make plunkr work with AngularJS routing\n' + - 'angular.element(document.getElementsByTagName(\'head\')).append(' + - 'angular.element(\'<base href="\' + window.location.pathname + \'" />\')' + - ');\n' + - '</script>\n'; - } - - indexHtmlContent += '</head>\n' + - ' <body>\n\n' + - '{{indexContents}}\n\n' + - ' </body>\n' + - '</html>\n'; - - indexProp = { - module: content.module, - scriptDeps: prepareEditorAssetTags(content, { includeLocalFiles : true }), - indexContents: content.html[0].content - }; - - var allFiles = [].concat(content.js, content.css, content.html, content.json); - - if(!content.module) { - var moduleData = prepareDefaultAppModule(content); - indexProp.module = moduleData.module; - - var found = false; - angular.forEach(content.js, function(file) { - if(file.name == 'script.js') { - file.content = moduleData.script + file.content; - found = true; - } - }); - if(!found) { - indexProp.scriptDeps += '<script type="text/javascript" src="script.js"></script>\n'; - allFiles.push({ - name : 'script.js', - content : moduleData.script - }); - } - }; - - var postData = {}; - - angular.forEach(allFiles, function(file, index) { - if (file.content && file.name != 'index.html') { - postData['files[' + file.name + ']'] = file.content; - } - }); - - postData['files[index.html]'] = templateMerge(indexHtmlContent, indexProp); - postData['tags[]'] = "angularjs"; - - postData.private = true; - postData.description = 'AngularJS Example Plunkr'; - - formPostData('http://plnkr.co/edit/?p=preview', postData); - }; -}; - -docsApp.serviceFactory.openJsFiddle = function(templateMerge, formPostData, prepareEditorAssetTags, prepareDefaultAppModule) { - var HTML = '<div ng-app=\"{{module}}\">\n{{html:2}}</div>', - CSS = '</style> <!-- Ugly Hack to make remote files preload in jsFiddle --> \n' + - '{{head:0}}<style>{{css}}', - SCRIPT = '{{script}}', - SCRIPT_CACHE = '\n\n<!-- {{name}} -->\n<script type="text/ng-template" id="{{name}}">\n{{content:2}}</script>', - BASE_HREF_TAG = '<!-- Ugly Hack to make AngularJS routing work inside of jsFiddle -->\n' + - '<base href="/" />\n\n'; - - return function(content) { - var prop = { - module: content.module, - html: '', - css: '', - script: '' - }; - if(!prop.module) { - var moduleData = prepareDefaultAppModule(content); - prop.script = moduleData.script; - prop.module = moduleData.module; - }; - - angular.forEach(content.html, function(file, index) { - if (index) { - prop.html += templateMerge(SCRIPT_CACHE, file); - } else { - prop.html += file.content; - } - }); - - prop.head = prepareEditorAssetTags(content, { includeLocalFiles : false }); - - angular.forEach(content.js, function(file, index) { - prop.script += file.content; - }); - - angular.forEach(content.css, function(file, index) { - prop.css += file.content; - }); - - var hasRouting = false; - angular.forEach(content.deps, function(file) { - hasRouting = hasRouting || file.name == 'angular-route.js'; - }); - - var compiledHTML = templateMerge(HTML, prop); - if(hasRouting) { - compiledHTML = BASE_HREF_TAG + compiledHTML; - } - formPostData("http://jsfiddle.net/api/post/library/pure/", { - title: 'AngularJS Example', - html: compiledHTML, - js: templateMerge(SCRIPT, prop), - css: templateMerge(CSS, prop) - }); - }; -}; - - -docsApp.serviceFactory.sections = ['NG_PAGES', function sections(NG_PAGES) { - var sections = { - guide: [], - api: [], - tutorial: [], - misc: [], - error: [], - getPage: function(sectionId, partialId) { - var pages = sections[sectionId]; - - partialId = partialId || 'index'; - - for (var i = 0, ii = pages.length; i < ii; i++) { - if (pages[i].id == partialId) { - return pages[i]; - } - } - return null; - } - }; - - angular.forEach(NG_PAGES, function(page) { - page.url = page.section + '/' + page.id; - if (page.id == 'angular.Module') { - page.partialUrl = 'partials/api/angular.IModule.html'; - } else { - page.partialUrl = 'partials/' + page.url + '.html'; - } - - sections[page.section].push(page); - }); - - return sections; -}]; - - -docsApp.controller.DocsController = function($scope, $rootScope, $location, $window, $cookies, sections) { - $scope.fold = function(url) { - if(url) { - $scope.docs_fold = '/notes/' + url; - if(/\/build/.test($window.location.href)) { - $scope.docs_fold = '/build/docs' + $scope.docs_fold; - } - window.scrollTo(0,0); - } - else { - $scope.docs_fold = null; - } - }; - var OFFLINE_COOKIE_NAME = 'ng-offline', - DOCS_PATH = /^\/(api)|(guide)|(misc)|(tutorial)|(error)/, - INDEX_PATH = /^(\/|\/index[^\.]*.html)$/, - GLOBALS = /^angular\.([^\.]+)$/, - ERROR = /^([a-zA-Z0-9_$]+:)?([a-zA-Z0-9_$]+)$/, - MODULE = /^((?:(?!^angular\.)[^\.])+)$/, - MODULE_MOCK = /^angular\.mock\.([^\.]+)$/, - MODULE_DIRECTIVE = /^((?:(?!^angular\.)[^\.])+)\.directive:([^\.]+)$/, - MODULE_DIRECTIVE_INPUT = /^((?:(?!^angular\.)[^\.])+)\.directive:input\.([^\.]+)$/, - MODULE_FILTER = /^((?:(?!^angular\.)[^\.])+)\.filter:([^\.]+)$/, - MODULE_SERVICE = /^((?:(?!^angular\.)[^\.])+)\.([^\.]+?)(Provider)?$/, - MODULE_TYPE = /^((?:(?!^angular\.)[^\.])+)\..+\.([A-Z][^\.]+)$/, - URL = { - module: 'guide/module', - directive: 'guide/directive', - input: 'api/ng.directive:input', - filter: 'guide/dev_guide.templates.filters', - service: 'guide/dev_guide.services', - type: 'guide/types' - }; - - - /********************************** - Publish methods - ***********************************/ - - $scope.navClass = function(page1, page2) { - return { - last: this.$last, - active: page1 && this.currentPage == page1 || page2 && this.currentPage == page2 - }; - }; - - $scope.afterPartialLoaded = function() { - var currentPageId = $location.path(); - $scope.partialTitle = $scope.currentPage.shortName; - $window._gaq.push(['_trackPageview', currentPageId]); - }; - - /** stores a cookie that is used by apache to decide which manifest ot send */ - $scope.enableOffline = function() { - //The cookie will be good for one year! - var date = new Date(); - date.setTime(date.getTime()+(365*24*60*60*1000)); - var expires = "; expires="+date.toGMTString(); - var value = angular.version.full; - document.cookie = OFFLINE_COOKIE_NAME + "="+value+expires+"; path=" + $location.path; - - //force the page to reload so server can serve new manifest file - window.location.reload(true); - }; - - - - /********************************** - Watches - ***********************************/ - - var SECTION_NAME = { - api: 'API Reference', - guide: 'Developer Guide', - misc: 'Miscellaneous', - tutorial: 'Tutorial', - error: 'Error Reference' - }; - - populateComponentsList(); - - $scope.$watch(function docsPathWatch() {return $location.path(); }, function docsPathWatchAction(path) { - // ignore non-doc links which are used in examples - if (DOCS_PATH.test(path)) { - var parts = path.split('/'), - sectionId = parts[1], - partialId = parts.slice(2).join('/'), - sectionName = SECTION_NAME[sectionId] || sectionId, - page = sections.getPage(sectionId, partialId); - - $rootScope.currentPage = sections.getPage(sectionId, partialId); - - if (!$rootScope.currentPage) { - $scope.partialTitle = 'Error: Page Not Found!'; - } - - populateComponentsList(); - - // Update breadcrumbs - var breadcrumb = $scope.breadcrumb = [], - match; - - if (partialId) { - breadcrumb.push({ name: sectionName, url: sectionId }); - if (partialId == 'angular.Module') { - breadcrumb.push({ name: 'angular.Module' }); - } else if (match = partialId.match(GLOBALS)) { - breadcrumb.push({ name: partialId }); - } else if (match = partialId.match(MODULE)) { - breadcrumb.push({ name: match[1] }); - } else if (match = partialId.match(MODULE_FILTER)) { - breadcrumb.push({ name: match[1], url: sectionId + '/' + match[1] }); - breadcrumb.push({ name: match[2] }); - } else if (match = partialId.match(MODULE_DIRECTIVE)) { - breadcrumb.push({ name: match[1], url: sectionId + '/' + match[1] }); - breadcrumb.push({ name: match[2] }); - } else if (match = partialId.match(MODULE_DIRECTIVE_INPUT)) { - breadcrumb.push({ name: match[1], url: sectionId + '/' + match[1] }); - breadcrumb.push({ name: 'input', url: URL.input }); - breadcrumb.push({ name: match[2] }); - } else if (match = partialId.match(MODULE_TYPE)) { - breadcrumb.push({ name: match[1], url: sectionId + '/' + match[1] }); - breadcrumb.push({ name: match[2] }); - } else if (match = partialId.match(MODULE_SERVICE)) { - breadcrumb.push({ name: match[1], url: sectionId + '/' + match[1] }); - breadcrumb.push({ name: match[2] + (match[3] || '') }); - } else if (match = partialId.match(MODULE_MOCK)) { - breadcrumb.push({ name: 'angular.mock.' + match[1] }); - } else { - breadcrumb.push({ name: page.shortName }); - } - } else { - breadcrumb.push({ name: sectionName }); - } - } - }); - - /********************************** - Initialize - ***********************************/ - - $scope.versionNumber = angular.version.full; - $scope.version = angular.version.full + " " + angular.version.codeName; - $scope.subpage = false; - $scope.offlineEnabled = ($cookies[OFFLINE_COOKIE_NAME] == angular.version.full); - $scope.futurePartialTitle = null; - $scope.loading = 0; - $scope.URL = URL; - $scope.$cookies = $cookies; - - $cookies.platformPreference = $cookies.platformPreference || 'gitUnix'; - - if (!$location.path() || INDEX_PATH.test($location.path())) { - $location.path('/api').replace(); - } - // bind escape to hash reset callback - angular.element(window).on('keydown', function(e) { - if (e.keyCode === 27) { - $scope.$apply(function() { - $scope.subpage = false; - }); - } - }); - - /********************************** - Private methods - ***********************************/ - - function populateComponentsList() { - var area = $location.path().split('/')[1]; - area = /^index-\w/.test(area) ? 'api' : area; - var moduleCache = {}, - namespaceCache = {}, - pages = sections[area], - modules = $scope.modules = [], - namespaces = $scope.namespaces = [], - globalErrors = $scope.globalErrors = [], - otherPages = $scope.pages = [], - search = $scope.search; - - angular.forEach(pages, function(page) { - var match, - id = page.id; - - if (page.id == 'index') { - //skip - } else if (page.section != 'api') { - if (page.section === 'error') { - match = id.match(ERROR); - if (match[1] !== undefined) { - namespace(match[1].replace(/:/g, '')).errors.push(page); - } else { - globalErrors.push(page); - } - } else { - otherPages.push(page); - } - } else if (id == 'angular.Module') { - module('ng').types.push(page); - } else if (match = id.match(GLOBALS)) { - module('ng').globals.push(page); - } else if (match = id.match(MODULE)) { - module(match[1]); - } else if (match = id.match(MODULE_FILTER)) { - module(match[1]).filters.push(page); - } else if (match = id.match(MODULE_DIRECTIVE)) { - module(match[1]).directives.push(page); - } else if (match = id.match(MODULE_DIRECTIVE_INPUT)) { - module(match[1]).directives.push(page); - } else if (match = id.match(MODULE_SERVICE)) { - module(match[1]).service(match[2])[match[3] ? 'provider' : 'instance'] = page; - } else if (match = id.match(MODULE_TYPE)) { - module(match[1]).types.push(page); - } else if (match = id.match(MODULE_MOCK)) { - module('ngMock').globals.push(page); - } - - }); - - function module(name) { - var module = moduleCache[name]; - - if (!module) { - module = moduleCache[name] = { - name: name, - url: 'api/' + name, - globals: [], - directives: [], - services: [], - service: function(name) { - var service = moduleCache[this.name + ':' + name]; - if (!service) { - service = {name: name}; - moduleCache[this.name + ':' + name] = service; - this.services.push(service); - } - return service; - }, - types: [], - filters: [] - }; - modules.push(module); - } - return module; - } - - function namespace(name) { - var namespace = namespaceCache[name]; - - if (!namespace) { - namespace = namespaceCache[name] = { - name: name, - url: 'error/' + name, - errors: [] - }; - namespaces.push(namespace); - } - return namespace; - } - } -}; - - -angular.module('docsApp', ['ngResource', 'ngRoute', 'ngCookies', 'ngSanitize', 'ngAnimate', 'bootstrap', 'bootstrapPrettify', 'docsData']). - config(function($locationProvider) { - $locationProvider.html5Mode(true).hashPrefix('!'); - }). - factory(docsApp.serviceFactory). - directive(docsApp.directive). - controller(docsApp.controller); - -angular.forEach(docsApp.filter, function (docsAppFilter, filterName) { - angular.module('docsApp').filter(filterName, docsAppFilter); -}); diff --git a/docs/src/templates/offline.html b/docs/src/templates/offline.html deleted file mode 100644 index f52ca6e5..00000000 --- a/docs/src/templates/offline.html +++ /dev/null @@ -1,4 +0,0 @@ -<h2>OFFLINE</h2> - -<p>This page is currently unavailable because your are offline.</p> -<p>Please connect to the Internet and reload the page.</p> diff --git a/docs/src/writer.js b/docs/src/writer.js deleted file mode 100644 index 498766b5..00000000 --- a/docs/src/writer.js +++ /dev/null @@ -1,166 +0,0 @@ -/** - * All writing related code here. This is so that we can separate the async code from sync code - * for testability - */ -var pathUtils = require('path'); -var qfs = require('q-io/fs'); -var Q = require('qq'); -var OUTPUT_DIR = pathUtils.join('build','docs'); -var TEMPLATES_DIR = pathUtils.join('docs','src','templates'); -var fs = require('fs'); - -exports.output = output; -function output(file, content) { - var fullPath = pathUtils.join(OUTPUT_DIR,file); - var dir = pathUtils.dirname(fullPath); - return Q.when(exports.makeDir(dir), function () { - return qfs.write(fullPath, exports.toString(content)); - }); -} - -//recursively create directory -exports.makeDir = function(p) { - p = pathUtils.normalize(p); - var parts = p.split(pathUtils.sep); - - var makePartialDir = function makePartialDir(path) { - return qfs.makeDirectory(path).then(function() { - if (parts.length) { - return makePartialDir(pathUtils.join(path, parts.shift())); - } - }, function(error) { - if (error.code !== 'EEXIST') { - throw error; - } - if (parts.length) { - return makePartialDir(pathUtils.join(path, parts.shift())); - } - }); - }; - - return makePartialDir(pathUtils.join('.', parts.shift())); -}; - -exports.copyTemplate = function(filename) { - // Don't need to normalize here as `exports.copy` will do it for us - return exports.copy(pathUtils.join(TEMPLATES_DIR,filename), filename); -}; - -/* Copy files from one place to another. - * @param from{string} path of the source file to be copied - * @param to{string} path of where the copied file should be stored - * @param transform{function=} transfromation function to be applied before return - */ -exports.copy = function(from, to, transform) { - var transformArgs = Array.prototype.slice.call(arguments, 3); - - from = pathUtils.normalize(from); - to = pathUtils.normalize(to); - - // We have to use binary reading, Since some characters are unicode. - return qfs.read(from, 'b').then(function(content) { - if (transform) { - // Pass any extra arguments, e.g. - // `copy(from, to, transform, extra1, extra2, ...)` - // to the transform function - transformArgs.unshift(content.toString()); - content = transform.apply(null, transformArgs); - } - return output(to, content); - }); -}; - - -exports.symlink = symlink; -function symlink(from, to, type) { - // qfs will normalize the path arguments for us here - return qfs.exists(to).then(function(exists) { - if (!exists) { - return qfs.symbolicLink(to, from, type || 'file'); - } - }); -} - - -exports.symlinkTemplate = symlinkTemplate; -function symlinkTemplate(filename, type) { - // pathUtils.join will normalize the filename for us - var dest = pathUtils.join(OUTPUT_DIR, filename), - dirDepth = dest.split(pathUtils.sep).length, - src = pathUtils.join(Array(dirDepth).join('..' + pathUtils.sep), TEMPLATES_DIR, filename); - return symlink(src, dest, type); -} - - -/* Replace placeholders in content accordingly - * @param content{string} content to be modified - * @param replacements{obj} key and value pairs in which key will be replaced with value in content - */ -exports.replace = function(content, replacements) { - for(var key in replacements) { - content = content.replace(key, replacements[key]); - } - return content; -}; - -exports.copyDir = function copyDir(from, to) { - from = pathUtils.normalize(from); - to = pathUtils.normalize(to); - return qfs.listTree(from).then(function(files) { - files.forEach(function(file) { - var path = to ? file.replace(from, to) : from; - // Not sure why this next line is here... - path = path.replace('/docs/build', ''); - exports.copy(file, path); - }); - }); -}; - -exports.merge = function(srcs, to) { - // pathUtils.join will normalize each of the srcs inside the mapping - to = pathUtils.normalize(to); - return merge(srcs.map(function(src) { return pathUtils.join(TEMPLATES_DIR, src); }), to); -}; - -function merge(srcs, to) { - var contents = []; - //Sequentially read file - var done; - srcs.forEach(function(src) { - done = Q.when(done, function(content) { - if(content) contents.push(content); - return qfs.read(src, 'b'); - }); - }); - - // write to file - return Q.when(done, function(content) { - contents.push(content); - return output(to, contents.join('\n')); - }); -} - -//----------------------- Synchronous Methods ---------------------------------- - -exports.toString = function toString(obj) { - switch (typeof obj) { - case 'string': - return obj; - case 'object': - if (obj instanceof Array) { - obj.forEach(function(value, key) { - obj[key] = toString(value); - }); - return obj.join(''); - } else if (obj.constructor.name == 'Buffer'){ - // do nothing it is Buffer Object - } else { - return JSON.stringify(obj); - } - } - return obj; -}; - - -function noop() {} - |
