From 2218cbd252d23a188e772f03167d08dc05bd104c Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 8 Dec 2014 19:08:12 +0000 Subject: [PATCH] docs --- doc/api/hooks_server-side.md | 17 +++++++++++++++++ src/node/utils/ExportHtml.js | 5 +++++ 2 files changed, 22 insertions(+) diff --git a/doc/api/hooks_server-side.md b/doc/api/hooks_server-side.md index 435872ea1..90f1b59c4 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 01920da79..16c676180 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 ? '' : '\n') + '\n' + (noDocType ? '' : '\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 + '\n' + '\n') + ''; @@ -452,6 +456,7 @@ exports.getPadHTMLDocument = function (padId, revNum, noDocType, callback) if(ERR(err, callback)) return; callback(null, head + html + foot); }); + }); };