diff --git a/doc/api/hooks_client-side.md b/doc/api/hooks_client-side.md index b8a58b31..ca429a07 100644 --- a/doc/api/hooks_client-side.md +++ b/doc/api/hooks_client-side.md @@ -80,6 +80,22 @@ This hook is called during the attribute processing procedure, and should be use The return value for this function should be a list of classes, which will then be parsed into a valid class string. +## aceAttribClasses +Called from: src/static/js/linestylefilter.js + +Things in context: +1. Attributes - Object of Attributes + +This hook is called when attributes are investigated on a line. It is useful if you want to add another attribute type or property type to a pad. + +Example: +``` +exports.aceAttribClasses = function(hook_name, attr, cb){ + attr.sub = 'tag:sub'; + cb(attr); +} +``` + ## aceGetFilterStack Called from: src/static/js/linestylefilter.js diff --git a/doc/api/hooks_server-side.md b/doc/api/hooks_server-side.md index 435872ea..251cbf11 100644 --- a/doc/api/hooks_server-side.md +++ b/doc/api/hooks_server-side.md @@ -247,6 +247,40 @@ 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, padId, cb){ + cb("body{font-size:13.37em !important}"); +} +``` + +## aceAttribClasses +Called from: src/static/js/linestylefilter.js + +Things in context: +1. Attributes - Object of Attributes + +This hook is called when attributes are investigated on a line. It is useful if you want to add another attribute type or property type to a pad. + +Example: + +``` +exports.aceAttribClasses = function(hook_name, attr, cb){ + attr.sub = 'tag:sub'; + cb(attr); +} +``` + ## exportFileName Called from src/node/handler/ExportHandler.js @@ -264,6 +298,24 @@ exports.exportFileName = function(hook, padId, callback){ } ``` +## exportHtmlAdditionalTags +Called from src/node/utils/ExportHtml.js + +Things in context: + +1. Pad object + +This hook will allow a plug-in developer to include more properties and attributes to support during HTML Export. An Array should be returned. + +Example: +``` +// Add the props to be supported in export +exports.exportHtmlAdditionalTags = function(hook, pad, cb){ + var padId = pad.id; + cb(["massive","jugs"]); +}; + + ## userLeave Called from src/node/handler/PadMessageHandler.js diff --git a/src/node/utils/ExportHtml.js b/src/node/utils/ExportHtml.js index 01920da7..693cf9cf 100644 --- a/src/node/utils/ExportHtml.js +++ b/src/node/utils/ExportHtml.js @@ -78,6 +78,14 @@ function getHTMLFromAtext(pad, atext, authorColors) var tags = ['h1', 'h2', 'strong', 'em', 'u', 's']; var props = ['heading1', 'heading2', 'bold', 'italic', 'underline', 'strikethrough']; + + hooks.aCallAll("exportHtmlAdditionalTags", pad, function(err, newProps){ + newProps.forEach(function (propName, i){ + tags.push(propName); + props.push(propName); + }); + }); + // holds a map of used styling attributes (*1, *2, etc) in the apool // and maps them to an index in props // *3:2 -> the attribute *3 means strong @@ -425,32 +433,40 @@ exports.getPadHTMLDocument = function (padId, revNum, noDocType, callback) { if(ERR(err, callback)) return; - var head = - (noDocType ? '' : '\n') + - '\n' + (noDocType ? '' : '
\n' + - '