From 735a3379c508a9fed2af68d41d1204d6a31061db Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Mon, 11 Jan 2016 04:26:42 +0100 Subject: First working version --- index.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'index.js') diff --git a/index.js b/index.js index 43b349c..1a741d0 100644 --- a/index.js +++ b/index.js @@ -11,4 +11,39 @@ exports.eejsBlock_styles = function (hook_name, args, cb) { return cb(); } +exports.getLineHTMLForExport = function (hook, ctx) { + function _analyzeLine(lineAttrs, pool) { + if (lineAttrs) { + var opIter = Changeset.opIterator(lineAttrs); + if (opIter.hasNext()) { + var op = opIter.next(); + return Changeset.opAttributeValue(op, 'headline_buttons', pool); + } + } + } + function _getStyle(tag) { + switch (tag) { + case 'h1': + return 'margin: 0; line-height: 1.5em; font-size: 2em'; + case 'h2': + return 'margin: 0; line-height: 1.5em; font-size: 1.5em'; + case 'h3': + return 'margin: 0; line-height: 1.5em; font-size: 1.17em'; + case 'h4': + return 'margin: 0; line-height: 1.5em'; + case 'h5': + return 'margin: 0; line-height: 1.5em; font-size: 0.83em'; + case 'h6': + return 'margin: 0; line-height: 1.5em; font-size: 0.75em'; + } + + return ''; + } + + var tag = _analyzeLine(ctx.attribLine, ctx.apool); + if (tag) { + var style = _getStyle(tag); + return "<" + tag + " style=\"" + style + "\">" + ctx.text.substring(1) + ""; + } +} -- cgit v1.2.3-1-g7c22