Code coverage report for master/plugins/escapeHtml.js

Statements: 100% (3 / 3)      Branches: 100% (2 / 2)      Functions: 100% (1 / 1)      Lines: 100% (3 / 3)      Ignored: none     

All files » master/plugins/ » escapeHtml.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22              1           4 2              
/**
    @overview Escape HTML tags in descriptions.
    @module plugins/escapeHtml
    @author Michael Mathews <micmath@gmail.com>
 */
'use strict';
 
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(/\r\n|\n|\r/g, '<br>');
        }
    }
};