jsdoc/plugins/escapeHtml.js
Jannon a6f68d838c Plugin tests
Tests for the plugin framework as well as for the plugins shipping with JSDoc
2012-05-06 00:43:22 -07:00

22 lines
588 B
JavaScript

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