From 389d4879da4aa620ee95d789b19ff9be44eb730a Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Wed, 12 Feb 2014 22:47:42 +0000 Subject: chore(doc-gen): new docs chore(doc-gen): implement dgeni --- docs/src/example.js | 160 ---------------------------------------------------- 1 file changed, 160 deletions(-) delete mode 100644 docs/src/example.js (limited to 'docs/src/example.js') 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(''); -}; - -- cgit v1.2.3