Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions tools/api-builder/angular.io-package/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ module.exports = new Package('angular.io', [basePackage, targetPackage, cheatshe
}
readTypeScriptModules.basePath = path.resolve(angular_repo_path, 'modules');
readTypeScriptModules.ignoreExportsMatching = [
'__esModule',
'__core_private__',
'__core_private_testing__',
'__platform_browser_private__',
'__platform_browser_dynamic_private__',
'__platform_server_private__',
'__router_private__',
'___core_private__',
'___core_private_testing__',
'___core_private_testing_placeholder__',
'___platform_browser_private__',
'___platform_browser_dynamic_private__',
'___platform_server_private__',
'___router_private__',
];

readTypeScriptModules.sourceFiles = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ var titleCase = function(text) {
});
};

var escapeQuotes = function(text) {
return text ? text.replace(/"/g, '\\"') : text;
};


/*
* Create _data.json file for Harp pages
*
Expand Down Expand Up @@ -130,10 +135,10 @@ module.exports = function addJadeDataDocsProcessor() {
title: exportDoc.name,
docType: exportDoc.docType,
exportDoc: exportDoc,
stability: stability,
howToUse: howToUse,
whatItDoes: whatItDoes,
security: security
stability: escapeQuotes(stability),
howToUse: escapeQuotes(howToUse),
whatItDoes: escapeQuotes(whatItDoes),
security: escapeQuotes(security)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like doing the replacement here in the code.
We don't necessarily know at this point what the output rendering file format would be...
It is better to do the escaping in the template at /angular.io/tools/api-builder/angular.io-package/templates/api-list-data.template.html

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is my fix for this: #2324

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah. I agree but I didn't know how to do it in a template :) I left a comment on your pr

};

if (exportDoc.symbolTypeName) dataDoc.varType = titleCase(exportDoc.symbolTypeName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ describe('addJadeDataDocsProcessor', function() {
exportDoc = { name: 'someObj', docType: 'var', symbolTypeName: 'MyClass', originalModule: 'some/private/module' }
],
fileInfo: { baseName: 'x_y' },
description: 'some description\nsecond line'
description: 'some description\nsecond line',
howToUse: 'use with "quotes" or without'
}
];
docs = processor.$process(docs);
Expand All @@ -40,7 +41,7 @@ describe('addJadeDataDocsProcessor', function() {
originalModule: 'some/private/module',
exportDoc: exportDoc,
stability : '',
howToUse : '',
howToUse : 'use with \\"quotes\\" or without',
whatItDoes : '',
security : false
}
Expand Down