chore(doc-gen): automatically update environment and version on the cheatsheet
Closes #515
This commit is contained in:
parent
b11cf9419f
commit
452e7e7729
@ -3,6 +3,4 @@
|
|||||||
|
|
||||||
article(class="l-content-small grid-fluid docs-content")
|
article(class="l-content-small grid-fluid docs-content")
|
||||||
.cheatsheet
|
.cheatsheet
|
||||||
h2 Angular for Dart Cheat Sheet (v2.0.0-alpha.54)
|
|
||||||
br
|
|
||||||
ngio-cheatsheet(src='./cheatsheet.json')
|
ngio-cheatsheet(src='./cheatsheet.json')
|
||||||
|
@ -3,6 +3,4 @@
|
|||||||
|
|
||||||
article(class="l-content-small grid-fluid docs-content")
|
article(class="l-content-small grid-fluid docs-content")
|
||||||
.cheatsheet
|
.cheatsheet
|
||||||
h2 Angular for JavaScript Cheat Sheet (v2.0.0-alpha.54)
|
|
||||||
br
|
|
||||||
ngio-cheatsheet(src='./cheatsheet.json')
|
ngio-cheatsheet(src='./cheatsheet.json')
|
||||||
|
@ -3,7 +3,4 @@
|
|||||||
|
|
||||||
article(class="l-content-small grid-fluid docs-content")
|
article(class="l-content-small grid-fluid docs-content")
|
||||||
.cheatsheet
|
.cheatsheet
|
||||||
h2 Angular for TypeScript Cheat Sheet (v2.0.0-alpha.54)
|
|
||||||
br
|
|
||||||
|
|
||||||
ngio-cheatsheet(src='./cheatsheet.json')
|
ngio-cheatsheet(src='./cheatsheet.json')
|
||||||
|
@ -4,13 +4,17 @@ angularIO.directive('ngioCheatsheet', function() {
|
|||||||
controller: function($http, $attrs, $sce) {
|
controller: function($http, $attrs, $sce) {
|
||||||
var $ctrl = this;
|
var $ctrl = this;
|
||||||
$http.get($attrs.src).then(function(response) {
|
$http.get($attrs.src).then(function(response) {
|
||||||
$ctrl.sections = response.data;
|
$ctrl.currentEnvironment = response.data.currentEnvironment;
|
||||||
|
$ctrl.version = response.data.version;
|
||||||
|
$ctrl.sections = response.data.sections;
|
||||||
});
|
});
|
||||||
$ctrl.getSafeHtml = function(html) {
|
$ctrl.getSafeHtml = function(html) {
|
||||||
return $sce.trustAsHtml(html);
|
return $sce.trustAsHtml(html);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
template:
|
template:
|
||||||
|
'<h2>Angular for {{$ctrl.currentEnvironment}} Cheat Sheet (v{{ $ctrl.version.raw }})</h2>' +
|
||||||
|
'<br>' +
|
||||||
'<div ng-if="!$ctrl.sections">Loading Cheatsheet...</div>\n' +
|
'<div ng-if="!$ctrl.sections">Loading Cheatsheet...</div>\n' +
|
||||||
'<table ng-repeat="section in $ctrl.sections" ng-cloak>\n' +
|
'<table ng-repeat="section in $ctrl.sections" ng-cloak>\n' +
|
||||||
'<tr>\n' +
|
'<tr>\n' +
|
||||||
|
@ -1 +1,5 @@
|
|||||||
{$ doc.sections | json $}
|
{
|
||||||
|
"currentEnvironment": {$ doc.currentEnvironment | json | trim $},
|
||||||
|
"version": {$ doc.version.currentVersion | json | indent(2) | trim $},
|
||||||
|
"sections": {$ doc.sections | json | indent(2) | trim $}
|
||||||
|
}
|
@ -1,16 +1,22 @@
|
|||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
|
|
||||||
module.exports = function createCheatsheetDoc(createDocMessage, renderMarkdown) {
|
module.exports = function createCheatsheetDoc(createDocMessage, renderMarkdown, versionInfo, targetEnvironments) {
|
||||||
return {
|
return {
|
||||||
$runAfter: ['processing-docs'],
|
$runAfter: ['processing-docs'],
|
||||||
$runBefore: ['docs-processed'],
|
$runBefore: ['docs-processed'],
|
||||||
$process: function(docs) {
|
$process: function(docs) {
|
||||||
|
|
||||||
|
var currentEnvironment = targetEnvironments.isActive('ts') && 'TypeScript' ||
|
||||||
|
targetEnvironments.isActive('js') && 'JavaScript' ||
|
||||||
|
targetEnvironments.isActive('dart') && 'Dart';
|
||||||
|
|
||||||
var cheatsheetDoc = {
|
var cheatsheetDoc = {
|
||||||
id: 'cheatsheet',
|
id: 'cheatsheet',
|
||||||
aliases: ['cheatsheet'],
|
aliases: ['cheatsheet'],
|
||||||
docType: 'cheatsheet-data',
|
docType: 'cheatsheet-data',
|
||||||
sections: []
|
sections: [],
|
||||||
|
version: versionInfo,
|
||||||
|
currentEnvironment: currentEnvironment
|
||||||
};
|
};
|
||||||
|
|
||||||
docs = docs.filter(function(doc) {
|
docs = docs.filter(function(doc) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user