feat(security badge): add a security badge to api docs. Only appears if @security is present in angular2

This commit is contained in:
Eric Jimenez
2016-05-09 14:22:34 -04:00
committed by Naomi Black
parent 96238bbfab
commit b5d2973163
6 changed files with 34 additions and 2 deletions
@@ -75,7 +75,7 @@ module.exports = function addJadeDataDocsProcessor() {
} else if (_.has(exportDoc, 'deprecated')) {
stability = 'deprecated';
}
var howToUse = '';
if(_.has(exportDoc, 'howToUse')) {
var howToUseArray = exportDoc.tags.tags.filter(function(tag) {
@@ -96,6 +96,16 @@ module.exports = function addJadeDataDocsProcessor() {
whatItDoes = whatItDoesArray[0].description.replace(/(\r\n|\n|\r)/gm,"");
}
// SECURITY STATUS
// Supported tags:
// @security
// Default is no security risk assessed for api
var security = false;
if (_.has(exportDoc, 'security')) {
security = true;
}
// Data inserted into jade-data.template.html
var dataDoc = {
name: exportDoc.name + '-' + exportDoc.docType,
title: exportDoc.name,
@@ -103,7 +113,8 @@ module.exports = function addJadeDataDocsProcessor() {
exportDoc: exportDoc,
stability: stability,
howToUse: howToUse,
whatItDoes: whatItDoes
whatItDoes: whatItDoes,
security: security
};
if (exportDoc.symbolTypeName) dataDoc.varType = titleCase(exportDoc.symbolTypeName);
@@ -6,4 +6,5 @@ module.exports = [
require('./stable'),
require('./experimental'),
require('./docsNotRequired'),
require('./security'),
];
@@ -0,0 +1,5 @@
module.exports = function() {
return {
name: 'security'
};
};
@@ -15,6 +15,9 @@
{%- if item.stability %}
"stability" : "{$ item.stability $}",
{%- endif %}
{%- if item.security %}
"security" : "{$ item.security $}",
{%- endif %}
"docType": "{$ item.docType $}"
}{% if not loop.last %},{% endif %}
{% endfor -%}