diff options
author | John McLear <john@mclear.co.uk> | 2014-12-08 19:08:12 +0000 |
---|---|---|
committer | John McLear <john@mclear.co.uk> | 2014-12-08 19:08:12 +0000 |
commit | 2218cbd252d23a188e772f03167d08dc05bd104c (patch) | |
tree | 597afafec5cad69bce85c0c79e769d9cc5e7a094 | |
parent | 6080de9d79626f2da3afe3b18f7dd230343cf1c4 (diff) | |
download | etherpad-lite-2218cbd252d23a188e772f03167d08dc05bd104c.zip |
docs
-rw-r--r-- | doc/api/hooks_server-side.md | 17 | ||||
-rw-r--r-- | src/node/utils/ExportHtml.js | 5 |
2 files changed, 22 insertions, 0 deletions
diff --git a/doc/api/hooks_server-side.md b/doc/api/hooks_server-side.md index 435872ea..90f1b59c 100644 --- a/doc/api/hooks_server-side.md +++ b/doc/api/hooks_server-side.md @@ -247,6 +247,23 @@ Things in context: This hook will allow a plug-in developer to re-write each line when exporting to HTML. +## stylesForExport +Called from: src/node/utils/ExportHtml.js + +Things in context: + +1. padId - The Pad Id + +This hook will allow a plug-in developer to append Styles to the Exported HTML. + +Example: + +``` +exports.stylesForExport = function(hook, context){ + return("body{margin-left:20px;body{color:orange}"); +} +``` + ## exportFileName Called from src/node/handler/ExportHandler.js diff --git a/src/node/utils/ExportHtml.js b/src/node/utils/ExportHtml.js index 01920da7..16c67618 100644 --- a/src/node/utils/ExportHtml.js +++ b/src/node/utils/ExportHtml.js @@ -425,6 +425,9 @@ exports.getPadHTMLDocument = function (padId, revNum, noDocType, callback) { if(ERR(err, callback)) return; + // Include some Styles into the Head for Export + var stylesForExport = hooks.callAllStr("stylesForExport") || '' + var head = (noDocType ? '' : '<!doctype html>\n') + '<html lang="en">\n' + (noDocType ? '' : '<head>\n' + @@ -442,6 +445,7 @@ exports.getPadHTMLDocument = function (padId, revNum, noDocType, callback) 'ol ol ol ol ol ol{ list-style-type: lower-roman; }' + 'ol ol ol ol ol ol ol { list-style-type: decimal; }' + 'ol ol ol ol ol ol ol ol{ list-style-type: lower-latin; }' + + stylesForExport + '</style>\n' + '</head>\n') + '<body>'; @@ -452,6 +456,7 @@ exports.getPadHTMLDocument = function (padId, revNum, noDocType, callback) if(ERR(err, callback)) return; callback(null, head + html + foot); }); + }); }; |