/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('');
- dom.text(fn ? fn(item) : item);
- dom.out.push('\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 = "Source
\n";
- html += this.toHtmlEdit();
- html += this.toHtmlTabs();
- if(this.animations) {
- html += '';
- html += ' ';
- html += ' ';
- html += '
';
- }
- html += "Demo
\n";
- html += this.toHtmlEmbed();
- return html;
-};
-
-
-exports.Example.prototype.toHtmlEdit = function() {
- var out = [];
- out.push('\n');
- return out.join('');
-};
-
-exports.Example.prototype.toHtmlTabs = function() {
- var out = [],
- self = this;
-
- out.push('');
- htmlTabs(this.html);
- htmlTabs(this.css);
- htmlTabs(this.js);
- htmlTabs(this.json);
- htmlTabs(this.unit);
- htmlTabs(this.scenario);
- htmlTabs(this.protractorTest);
- out.push('
');
- 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(
- '\n' +
- '
\n' +
- (isCss
- ? ('\n')
- : ('\n') ) +
- '
\n');
- });
- }
-};
-
-exports.Example.prototype.toHtmlEmbed = function() {
- var out = [];
- out.push('');
- out.push('
');
- 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(/([\s\S]*?<\/pre>|[\s\S]*?<\/doc: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 tag
- regex = /\/\/([.\s\S]+)\/\/<\/docs>/im;
- }
- else {
- //use a non-greedy operator to match the next tag
- regex = new RegExp("\/\/([.\\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(/([\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(/([\s\S]*?)<\/file>/gmi, function(_, name, content) {
- example.addSource(name, content);
- });
- content.replace(//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+)?/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(/^]*)?>([\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(/]*)?>([\s\S]*)<\/doc:source>/mi, function(_, attrs, content) {
- example.addSource('index.html', content.
- replace(/
-
-
-
-