diff --git a/docs/docs.config.js b/docs/docs.config.js index ebe6a01ee3..f9b4cd8e98 100644 --- a/docs/docs.config.js +++ b/docs/docs.config.js @@ -7,6 +7,7 @@ var basePackage = require('dgeni-packages/ngdoc'); var pkg = require('../package.json'); module.exports = function(config) { + config.set('currentVersion', process.env.DOC_VERSION || 'nightly'); config = basePackage(config); @@ -19,7 +20,7 @@ module.exports = function(config) { config.set('basePath', __dirname); config.set('source.projectPath', '.'); config.set('rendering.outputFolder', '../tmp/ionic-site'); - config.set('rendering.contentsFolder', 'docs/angularjs'); + config.set('rendering.contentsFolder', 'docs/' + config.get('currentVersion')); config.set('processing.api-docs', { outputPath: '${area}/${module}/${docType}/${name}/index.md', @@ -60,8 +61,8 @@ module.exports = function(config) { config.append('processing.processors', [ require('./processors/git-data'), require('./processors/keywords'), - require('./processors/versions-data'), require('./processors/pages-data'), + require('./processors/index-page'), require('./processors/debug-dump') ]); diff --git a/docs/inline-tag-defs/link.js b/docs/inline-tag-defs/link.js index c98706ec53..8090953971 100644 --- a/docs/inline-tag-defs/link.js +++ b/docs/inline-tag-defs/link.js @@ -4,9 +4,10 @@ var log = require('winston'); module.exports = { name: 'link', description: 'Process inline link tags (of the form {@link some/uri Some Title}), replacing them with HTML anchors', - handlerFactory: function(partialNames) { + handlerFactory: function(partialNames, config) { return function handleLinkTags(doc, tagName, tagDescription) { + var version = config.get('currentVersion'); // Parse out the uri and title return tagDescription.replace(INLINE_LINK, function(match, uri, title) { @@ -18,7 +19,7 @@ module.exports = { linkInfo.title = 'TODO:' + linkInfo.title; } - return '' + linkInfo.title + ''; + return '' + linkInfo.title + ''; }); }; } diff --git a/docs/nightly/index.md b/docs/nightly/index.md new file mode 100644 index 0000000000..a0bceee5c4 --- /dev/null +++ b/docs/nightly/index.md @@ -0,0 +1,15 @@ +--- +layout: docs_0.9.0 +active: javascript +title: Javascript +header_sub_title: Extend Ionic even further with the power of AngularJS +--- + +# AngularJS Extensions + +Ionic is both a CSS framework and a Javascript UI library. Many components need Javascript in order to produce magic, though often components +can easily be used without coding through framework extensions such as our AngularIonic extensions. + +Ionic follows the View Controller pattern popularized in such frameworks as Cocoa Touch. In the View Controller pattern, we treat different sections of the interface as child Views or even child View Controllers that contain other views. View Controllers then "power" the Views inside of them to provide interaction and UI functionality. A great example is the Tab Bar View Controller which processes taps on a Tab Bar to switch between a set of viewable panes. + +Explore our API docs for detailed information on the View Controllers and Javascript utilities available in Ionic. diff --git a/docs/processors/index-page.js b/docs/processors/index-page.js new file mode 100644 index 0000000000..37154fffc3 --- /dev/null +++ b/docs/processors/index-page.js @@ -0,0 +1,22 @@ +var path = require('canonical-path'); +var log = require('winston'); + +var contentsFolder; +module.exports = { + name: 'index-page', + runAfter: ['adding-extra-docs'], + runBefore: ['extra-docs-added'], + description: 'Create documentation index page', + init: function(config) { + contentsFolder = config.get('rendering.contentsFolder'); + }, + process: function(docs) { + docs.push({ + docType: 'index-page', + id: 'index-page', + template: 'index.template.html', + outputPath: path.resolve(__dirname, '../../tmp/ionic-site/', contentsFolder, 'index.md') + }); + log.warn(docs[docs.length-1]); + } +}; diff --git a/docs/processors/pages-data.js b/docs/processors/pages-data.js index 32d877db80..cc4f652503 100644 --- a/docs/processors/pages-data.js +++ b/docs/processors/pages-data.js @@ -1,6 +1,8 @@ var _ = require('lodash'); var path = require('canonical-path'); var log = require('winston'); +var fs = require('fs'); +var semver = require('semver'); var AREA_NAMES = { api: 'API', @@ -128,6 +130,7 @@ var navGroupMappers = { var outputFolder; var processorConfig; +var currentVersion; module.exports = { name: 'pages-data', @@ -138,6 +141,7 @@ module.exports = { init: function(config) { outputFolder = config.rendering.outputFolder; processorConfig = config.get('processing.pages-data', {}); + currentVersion = config.get('currentVersion'); }, process: function(docs) { @@ -215,6 +219,27 @@ module.exports = { areas: areas, pages: pages }; + + var docsBaseFolder = path.resolve(__dirname, '../../tmp/ionic-site/docs'); + var pkg = require('../../package.json'); + + //Array of versions sorted backwards + var versions = fs.readdirSync(docsBaseFolder) + .filter(function(name) { + return semver.valid(name) || name == 'nightly'; + }) + .sort(semver.rcompare); + if (!_.contains(versions, currentVersion)) { + versions.unshift(currentVersion); + } + docData.versions = versions.map(function(ver) { + return { + href: '/docs/' + ver, + name: ver + }; + }); + docData.currentVersion = _.find(docData.versions, { name: currentVersion }); + docs.push(docData); } }; diff --git a/docs/processors/versions-data.js b/docs/processors/versions-data.js deleted file mode 100644 index f4e35d4405..0000000000 --- a/docs/processors/versions-data.js +++ /dev/null @@ -1,37 +0,0 @@ -var _ = require('lodash'); - -module.exports = { - name: 'versions-data', - description: 'This plugin will create a new doc that will be rendered as an angularjs module ' + - 'which will contain meta information about the versions of angular', - runAfter: ['adding-extra-docs', 'pages-data'], - runBefore: ['extra-docs-added'], - process: function(docs, gitData) { - - var version = gitData.version; - var versions = gitData.versions; - - if ( !version ) { - throw new Error('Invalid configuration. Please provide a valid `source.currentVersion` property'); - } - if ( !versions ) { - throw new Error('Invalid configuration. Please provide a valid `source.previousVersions` property'); - } - - var versionDoc = { - docType: 'versions-data', - id: 'versions-data', - template: 'versions-data.template.js', - outputPath: 'js/versions-data.js', - }; - - versionDoc.currentVersion = version; - - versionDoc.versions = _(versions) - .push(version) - .reverse() - .value(); - - docs.push(versionDoc); - } -}; diff --git a/docs/templates/api/componentGroup.template.html b/docs/templates/api/componentGroup.template.html index 1a605e50c7..5da50ab340 100644 --- a/docs/templates/api/componentGroup.template.html +++ b/docs/templates/api/componentGroup.template.html @@ -1,6 +1,5 @@ --- -layout: docs_0.9.0 -active: javascript +<@ include "lib/yaml.template.html" @> title: "<@ if doc.title @><$ doc.title $><@ elif doc.module @><$ doc.groupType | title $>s in module ionic<@ else @>Pages<@ endif @>" header_sub_title: "<$ doc.components.length $> <$ doc.groupType $>s" doc: "<$ doc.groupType $>" diff --git a/docs/templates/base.template.html b/docs/templates/base.template.html index 3be474edef..d8ee63d2c4 100644 --- a/docs/templates/base.template.html +++ b/docs/templates/base.template.html @@ -1,6 +1,5 @@ --- -layout: docs_0.9.0 -active: javascript +<@ include "lib/yaml.template.html" @> title: "<@ if doc.docType == "directive" @><$ doc.name | dashCase $><@ else @><$ doc.name $><@ endif @>" header_sub_title: "<$ doc.docType | capital $> in module <$ doc.module $>" doc: "<$ doc.name $>" diff --git a/docs/templates/index.template.html b/docs/templates/index.template.html new file mode 100644 index 0000000000..526db5b571 --- /dev/null +++ b/docs/templates/index.template.html @@ -0,0 +1,14 @@ +--- +<@ include "lib/yaml.template.html" @> +title: Javascript +header_sub_title: Extend Ionic even further with the power of AngularJS +--- + +# AngularJS Extensions + +Ionic is both a CSS framework and a Javascript UI library. Many components need Javascript in order to produce magic, though often components +can easily be used without coding through framework extensions such as our AngularIonic extensions. + +Ionic follows the View Controller pattern popularized in such frameworks as Cocoa Touch. In the View Controller pattern, we treat different sections of the interface as child Views or even child View Controllers that contain other views. View Controllers then "power" the Views inside of them to provide interaction and UI functionality. A great example is the Tab Bar View Controller which processes taps on a Tab Bar to switch between a set of viewable panes. + +Explore our API docs for detailed information on the View Controllers and Javascript utilities available in Ionic. diff --git a/docs/templates/indexPage.template.html b/docs/templates/indexPage.template.html deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/docs/templates/lib/yaml.template.html b/docs/templates/lib/yaml.template.html new file mode 100644 index 0000000000..3fd487f8f9 --- /dev/null +++ b/docs/templates/lib/yaml.template.html @@ -0,0 +1,3 @@ +layout: docs_0.9.0 +active: javascript +version: "nightly" diff --git a/docs/templates/pages-data.template.html b/docs/templates/pages-data.template.html index 11d204314c..5fe53b2cc9 100644 --- a/docs/templates/pages-data.template.html +++ b/docs/templates/pages-data.template.html @@ -42,7 +42,6 @@
-