summaryrefslogtreecommitdiffstats
path: root/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'index.js')
-rw-r--r--index.js35
1 files changed, 35 insertions, 0 deletions
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) + "</" + tag + ">";
+ }
+}