chore(doc-gen): allow dart cheatsheet to be generated
This commit is contained in:
parent
652bf47de4
commit
8459a4dd5c
14
gulpfile.js
14
gulpfile.js
|
@ -122,6 +122,10 @@ gulp.task('build-plunkers', function() {
|
||||||
return plunkerBuilder.buildPlunkers(EXAMPLES_PATH, LIVE_EXAMPLES_PATH, { errFn: gutil.log });
|
return plunkerBuilder.buildPlunkers(EXAMPLES_PATH, LIVE_EXAMPLES_PATH, { errFn: gutil.log });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
gulp.task('build-dart-cheatsheet', [], function() {
|
||||||
|
return buildApiDocs('dart');
|
||||||
|
});
|
||||||
|
|
||||||
gulp.task('git-changed-examples', ['_shred-devguide-examples'], function(){
|
gulp.task('git-changed-examples', ['_shred-devguide-examples'], function(){
|
||||||
var after, sha, messageSuffix;
|
var after, sha, messageSuffix;
|
||||||
if (argv.after) {
|
if (argv.after) {
|
||||||
|
@ -330,15 +334,21 @@ function devGuideExamplesWatch(shredOptions, postShredAction) {
|
||||||
|
|
||||||
// Generate the API docs for the specified language, if not specified then it defaults to ts
|
// Generate the API docs for the specified language, if not specified then it defaults to ts
|
||||||
function buildApiDocs(targetLanguage) {
|
function buildApiDocs(targetLanguage) {
|
||||||
var ALLOWED_LANGUAGES = ['ts', 'js'];
|
var ALLOWED_LANGUAGES = ['ts', 'js', 'dart'];
|
||||||
|
var GENERATE_API_LANGUAGES = ['ts', 'js'];
|
||||||
checkAngularProjectPath();
|
checkAngularProjectPath();
|
||||||
try {
|
try {
|
||||||
// Build a specialized package to generate different versions of the API docs
|
// Build a specialized package to generate different versions of the API docs
|
||||||
var package = new Package('apiDocs', [require(path.resolve(TOOLS_PATH, 'api-builder/angular.io-package'))]);
|
var package = new Package('apiDocs', [require(path.resolve(TOOLS_PATH, 'api-builder/angular.io-package'))]);
|
||||||
package.config(function(targetEnvironments, writeFilesProcessor) {
|
package.config(function(targetEnvironments, writeFilesProcessor, readTypeScriptModules) {
|
||||||
ALLOWED_LANGUAGES.forEach(function(target) { targetEnvironments.addAllowed(target); });
|
ALLOWED_LANGUAGES.forEach(function(target) { targetEnvironments.addAllowed(target); });
|
||||||
if (targetLanguage) {
|
if (targetLanguage) {
|
||||||
targetEnvironments.activate(targetLanguage);
|
targetEnvironments.activate(targetLanguage);
|
||||||
|
|
||||||
|
if (GENERATE_API_LANGUAGES.indexOf(targetLanguage) === -1) {
|
||||||
|
// Don't read TypeScript modules if we are not generating API docs - Dart I am looking at you!
|
||||||
|
readTypeScriptModules.$enabled = false;
|
||||||
|
}
|
||||||
writeFilesProcessor.outputFolder = targetLanguage + '/latest/api';
|
writeFilesProcessor.outputFolder = targetLanguage + '/latest/api';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,6 +16,7 @@ script(src="https://ajax.googleapis.com/ajax/libs/angular_material/0.8.3/angular
|
||||||
<!-- Angular.io Site JS -->
|
<!-- Angular.io Site JS -->
|
||||||
script(src="/resources/js/site.js")
|
script(src="/resources/js/site.js")
|
||||||
script(src="/resources/js/controllers/app-controller.js")
|
script(src="/resources/js/controllers/app-controller.js")
|
||||||
|
script(src="/resources/js/directives/cheatsheet.js")
|
||||||
script(src="/resources/js/directives/bio.js")
|
script(src="/resources/js/directives/bio.js")
|
||||||
script(src="/resources/js/directives/code.js")
|
script(src="/resources/js/directives/code.js")
|
||||||
script(src="/resources/js/directives/code-tabs.js")
|
script(src="/resources/js/directives/code-tabs.js")
|
||||||
|
|
|
@ -5,6 +5,10 @@
|
||||||
"title": "Step By Step Guide"
|
"title": "Step By Step Guide"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"cheatsheet": {
|
||||||
|
"title": "Angular Cheat Sheet"
|
||||||
|
},
|
||||||
|
|
||||||
"setup": {
|
"setup": {
|
||||||
"title": "Getting Started"
|
"title": "Getting Started"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
.banner
|
||||||
|
p.text-body This cheat sheet is provisional and may change. Angular 2 is currently in Developer Preview.
|
||||||
|
|
||||||
|
article(class="l-content-small grid-fluid docs-content")
|
||||||
|
.cheatsheet
|
||||||
|
h2 Angular for Dart Cheat Sheet (v2.0.0-alpha.44)
|
||||||
|
br
|
||||||
|
br
|
||||||
|
ngio-cheatsheet(src='./cheatsheet.json')
|
|
@ -5,6 +5,10 @@
|
||||||
"title": "Developer Guide"
|
"title": "Developer Guide"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"cheatsheet": {
|
||||||
|
"title": "Angular Cheat Sheet"
|
||||||
|
},
|
||||||
|
|
||||||
"displaying-data": {
|
"displaying-data": {
|
||||||
"title": "Displaying Data",
|
"title": "Displaying Data",
|
||||||
"intro": "Displaying data is job number one for any good application. In Angular, you bind data to elements in HTML templates and Angular automatically updates the UI as data changes."
|
"intro": "Displaying data is job number one for any good application. In Angular, you bind data to elements in HTML templates and Angular automatically updates the UI as data changes."
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
.banner
|
||||||
|
p.text-body This cheat sheet is provisional and may change. Angular 2 is currently in Developer Preview.
|
||||||
|
|
||||||
|
article(class="l-content-small grid-fluid docs-content")
|
||||||
|
.cheatsheet
|
||||||
|
h2 Angular for JavaScript Cheat Sheet (v2.0.0-alpha.44)
|
||||||
|
br
|
||||||
|
br
|
||||||
|
ngio-cheatsheet(src='./cheatsheet.json')
|
|
@ -16,11 +16,4 @@ article(class="l-content-small grid-fluid docs-content")
|
||||||
br
|
br
|
||||||
br
|
br
|
||||||
|
|
||||||
table(ng-repeat='section in appCtrl.cheatsheet' ng-cloak)
|
ngio-cheatsheet(src='./cheatsheet.json')
|
||||||
tr
|
|
||||||
th {{section.name}}
|
|
||||||
th(ng-bind-html="appCtrl.getSafeHtml(section.description)")
|
|
||||||
tr(ng-repeat='child in section.items')
|
|
||||||
td
|
|
||||||
code(bold='child.bold',ng-compile) {{child.syntax}}
|
|
||||||
td(ng-bind-html="appCtrl.getSafeHtml(child.description)")
|
|
||||||
|
|
|
@ -31,10 +31,6 @@ angularIO.controller('AppCtrl', ['$mdDialog', '$timeout', '$http', '$sce', funct
|
||||||
vm.apiList = response.data;
|
vm.apiList = response.data;
|
||||||
});
|
});
|
||||||
|
|
||||||
$http.get('/resources/js/cheatsheet.json').then(function(response) {
|
|
||||||
vm.cheatsheet = response.data;
|
|
||||||
});
|
|
||||||
|
|
||||||
vm.showDocsNav = false;
|
vm.showDocsNav = false;
|
||||||
vm.showMainNav = false;
|
vm.showMainNav = false;
|
||||||
vm.showMenu = false;
|
vm.showMenu = false;
|
||||||
|
@ -72,10 +68,6 @@ angularIO.controller('AppCtrl', ['$mdDialog', '$timeout', '$http', '$sce', funct
|
||||||
vm.apiType = '';
|
vm.apiType = '';
|
||||||
vm.apiFilter = '';
|
vm.apiFilter = '';
|
||||||
|
|
||||||
vm.getSafeHtml = function(html) {
|
|
||||||
return $sce.trustAsHtml(html);
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Prettify Code
|
* Prettify Code
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
angularIO.directive('ngioCheatsheet', function() {
|
||||||
|
return {
|
||||||
|
controllerAs: '$ctrl',
|
||||||
|
controller: function($http, $attrs, $sce) {
|
||||||
|
var $ctrl = this;
|
||||||
|
$http.get($attrs.src).then(function(response) {
|
||||||
|
$ctrl.sections = response.data;
|
||||||
|
});
|
||||||
|
$ctrl.getSafeHtml = function(html) {
|
||||||
|
return $sce.trustAsHtml(html);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
template:
|
||||||
|
'<div ng-if="!$ctrl.sections">Loading Cheatsheet...</div>\n' +
|
||||||
|
'<table ng-repeat="section in $ctrl.sections" ng-cloak>\n' +
|
||||||
|
'<tr>\n' +
|
||||||
|
' <th>{{section.name}}</th>\n' +
|
||||||
|
' <th ng-bind-html="$ctrl.getSafeHtml(section.description)"></th>\n' +
|
||||||
|
'</tr>\n' +
|
||||||
|
'<tr ng-repeat="child in section.items">\n' +
|
||||||
|
' <td><code bold="child.bold" ng-compile="true">{{child.syntax}}</code></td>\n' +
|
||||||
|
' <td ng-bind-html="$ctrl.getSafeHtml(child.description)"></td>\n' +
|
||||||
|
'</tr>\n' +
|
||||||
|
'</table>'
|
||||||
|
};
|
||||||
|
});
|
|
@ -101,6 +101,12 @@ module.exports = new Package('angular.io', [basePackage, targetPackage, cheatshe
|
||||||
pathTemplate: path.resolve(PUBLIC_PATH, 'resources/js/${id}'),
|
pathTemplate: path.resolve(PUBLIC_PATH, 'resources/js/${id}'),
|
||||||
outputPathTemplate: '${path}.json'
|
outputPathTemplate: '${path}.json'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
computePathsProcessor.pathTemplates.push({
|
||||||
|
docTypes: ['cheatsheet-data'],
|
||||||
|
pathTemplate: '../guide/cheatsheet.json',
|
||||||
|
outputPathTemplate: '${path}'
|
||||||
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
.config(function(getLinkInfo) {
|
.config(function(getLinkInfo) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ module.exports = function createCheatsheetDoc(createDocMessage, renderMarkdown)
|
||||||
var cheatsheetDoc = {
|
var cheatsheetDoc = {
|
||||||
id: 'cheatsheet',
|
id: 'cheatsheet',
|
||||||
aliases: ['cheatsheet'],
|
aliases: ['cheatsheet'],
|
||||||
docType: 'json-data',
|
docType: 'cheatsheet-data',
|
||||||
sections: []
|
sections: []
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue