Added plugin to escape HTML tags in descriptions.

This commit is contained in:
Michael Mathews 2011-10-13 23:08:33 +01:00
parent bd7a5631c1
commit bf5d6eb505
2 changed files with 18 additions and 1 deletions

View File

@ -1,7 +1,7 @@
{
"name": "JSDoc",
"version": "3.0.0alpha",
"revision": "1318543155292",
"revision": "1318543678039",
"description": "An automatic documentation generator for javascript.",
"keywords": [ "documentation", "javascript" ],
"licenses": [

17
plugins/escapeHtml.js Normal file
View File

@ -0,0 +1,17 @@
/**
@overview Escape HTML tags in descriptions.
@module plugins/escapeHtml
@author Michael Mathews <micmath@gmail.com>
*/
/**
Translate HTML tags in descriptions into safe entities.
*/
exports.newDoclet = function(e) {
if (e.doclet.description) {
e.doclet.description = e.doclet.description
.replace(/&/g,'&amp;')
.replace(/</g,'&lt;')
.replace(/\n/g, '<br>');
}
};