From bf5d6eb5053f16bd1b98bd8cd938aa9c23a51a04 Mon Sep 17 00:00:00 2001 From: Michael Mathews Date: Thu, 13 Oct 2011 23:08:33 +0100 Subject: [PATCH] Added plugin to escape HTML tags in descriptions. --- package.json | 2 +- plugins/escapeHtml.js | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 plugins/escapeHtml.js diff --git a/package.json b/package.json index b39343b6..794dca3b 100644 --- a/package.json +++ b/package.json @@ -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": [ diff --git a/plugins/escapeHtml.js b/plugins/escapeHtml.js new file mode 100644 index 00000000..aaef19d2 --- /dev/null +++ b/plugins/escapeHtml.js @@ -0,0 +1,17 @@ +/** + @overview Escape HTML tags in descriptions. + @module plugins/escapeHtml + @author Michael Mathews + */ + +/** + Translate HTML tags in descriptions into safe entities. + */ +exports.newDoclet = function(e) { + if (e.doclet.description) { + e.doclet.description = e.doclet.description + .replace(/&/g,'&') + .replace(/'); + } +};