summaryrefslogtreecommitdiffstats
path: root/index.js
diff options
context:
space:
mode:
authorAlexander Sulfrian <alex@spline.inf.fu-berlin.de>2016-01-11 04:26:42 +0100
committerAlexander Sulfrian <alex@spline.inf.fu-berlin.de>2016-01-11 04:26:42 +0100
commit735a3379c508a9fed2af68d41d1204d6a31061db (patch)
tree00592723f76e15dfee1e7f057ab2bcd033bc4447 /index.js
parent33b97da914105927bc5800224b9bab0ad1d312c6 (diff)
downloadep_headline_buttons-735a3379c508a9fed2af68d41d1204d6a31061db.tar.gz
ep_headline_buttons-735a3379c508a9fed2af68d41d1204d6a31061db.tar.bz2
ep_headline_buttons-735a3379c508a9fed2af68d41d1204d6a31061db.zip
First working versionHEADmaster
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 + ">";
+ }
+}