diff options
| author | Misko Hevery | 2011-02-03 15:21:34 -0800 |
|---|---|---|
| committer | Misko Hevery | 2011-02-03 20:03:38 -0800 |
| commit | 882f412d578e4f01394847fa5fde21b6b4096de2 (patch) | |
| tree | 2d62877e0c00a5117ae3988172e630b1af9c10e5 /docs/src | |
| parent | 0d4def68ae0d95dd106d2731d60b6d6b635b5afc (diff) | |
| download | angular.js-882f412d578e4f01394847fa5fde21b6b4096de2.tar.bz2 | |
Added remainder of the cookbook
Diffstat (limited to 'docs/src')
| -rw-r--r-- | docs/src/gen-docs.js | 3 | ||||
| -rw-r--r-- | docs/src/ngdoc.js | 2 | ||||
| -rw-r--r-- | docs/src/templates/docs.js | 8 | ||||
| -rw-r--r-- | docs/src/writer.js | 10 |
4 files changed, 13 insertions, 10 deletions
diff --git a/docs/src/gen-docs.js b/docs/src/gen-docs.js index 7e17ea8f..83e33942 100644 --- a/docs/src/gen-docs.js +++ b/docs/src/gen-docs.js @@ -24,7 +24,8 @@ var writes = callback.chain(function(){ }); var metadata = ngdoc.metadata(docs); writer.output('docs-keywords.js', ['NG_PAGES=', JSON.stringify(metadata).replace(/{/g, '\n{'), ';'], writes.waitFor()); - writer.copyImages(writes.waitFor()); + writer.copyDir('img', writes.waitFor()); + writer.copyDir('static', writes.waitFor()); writer.copy('index.html', writes.waitFor()); writer.copy('docs.js', writes.waitFor()); writer.copy('docs.css', writes.waitFor()); diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js index 92379420..18ea523b 100644 --- a/docs/src/ngdoc.js +++ b/docs/src/ngdoc.js @@ -59,7 +59,7 @@ Doc.prototype = { markdown: function (text) { var self = this; - var IS_URL = /^(https?:\/\/|ftps?:\/\/|mailto:)/; + var IS_URL = /^(https?:\/\/|ftps?:\/\/|mailto:|\.|\/)/; var IS_ANGULAR = /^angular\./; if (!text) return text; var parts = text.split(/(<pre>[\s\S]*?<\/pre>|<doc:example>[\s\S]*?<\/doc:example>)/), diff --git a/docs/src/templates/docs.js b/docs/src/templates/docs.js index e244bc7e..9483496e 100644 --- a/docs/src/templates/docs.js +++ b/docs/src/templates/docs.js @@ -1,11 +1,15 @@ +var HAS_HASH = /#/; DocsController.$inject = ['$location', '$browser', '$window']; function DocsController($location, $browser, $window) { this.pages = NG_PAGES; window.$root = this.$root; this.$location = $location; - this.$watch('$location.hashPath', function(hashPath){ - hashPath = hashPath || '!angular'; + if (!HAS_HASH.test($location.href)) { + $location.hashPath = '!angular'; + } + + this.$watch('$location.hashPath', function(hashPath) { if (hashPath.match(/^!/)) { this.partialId = hashPath.substring(1); this.partialTitle = (angular.Array.filter(NG_PAGES, {id:this.partialId})[0]||{}).name; diff --git a/docs/src/writer.js b/docs/src/writer.js index 953302d4..3251b9cd 100644 --- a/docs/src/writer.js +++ b/docs/src/writer.js @@ -61,14 +61,12 @@ function copy(from, to, callback) { }); } -exports.copyImages = function(callback) { - exports.makeDir(OUTPUT_DIR + '/img', callback.waitFor(function(){ - fs.readdir('docs/img', callback.waitFor(function(err, files){ +exports.copyDir = function(dir, callback) { + exports.makeDir(OUTPUT_DIR + '/' + dir, callback.waitFor(function(){ + fs.readdir('docs/' + dir, callback.waitFor(function(err, files){ if (err) return this.error(err); files.forEach(function(file){ - if (file.match(/\.(png|gif|jpg|jpeg)$/)) { - copy('docs/img/' + file, OUTPUT_DIR + '/img/' + file, callback.waitFor()); - } + copy('docs/' + dir + '/' + file, OUTPUT_DIR + '/' + dir + '/' + file, callback.waitFor()); }); callback(); })); |
