diff --git a/available_plugins/ep_fintest/ep.json b/available_plugins/ep_fintest/ep.json index f9e91491..4ec8e392 100644 --- a/available_plugins/ep_fintest/ep.json +++ b/available_plugins/ep_fintest/ep.json @@ -25,7 +25,8 @@ "hooks": { "somehookname": "ep_fintest/otherpart:somehook", "morehook": "ep_fintest/otherpart:morehook", - "expressCreateServer": "ep_fintest/otherpart:expressServer" + "expressCreateServer": "ep_fintest/otherpart:expressServer", + "eejsBlock_editbarMenuLeft": "ep_fintest/otherpart:eejsBlock_editbarMenuLeft" }, "client_hooks": { "somehookname": "ep_fintest/static/js/test:bar" diff --git a/available_plugins/ep_fintest/otherpart.js b/available_plugins/ep_fintest/otherpart.js index ca259f44..718fb095 100644 --- a/available_plugins/ep_fintest/otherpart.js +++ b/available_plugins/ep_fintest/otherpart.js @@ -14,3 +14,12 @@ exports.expressServer = function (hook_name, args, cb) { res.send("Abra cadabra"); }); } + +exports.eejsBlock_editbarMenuLeft = function (hook_name, args, cb) { + args.content = args.content + '\ +
  • \ + \ +
  • \ + '; + return cb(); +} diff --git a/src/node/eejs/examples/foo.ejs b/src/node/eejs/examples/foo.ejs index 3778b59a..daee5f8e 100644 --- a/src/node/eejs/examples/foo.ejs +++ b/src/node/eejs/examples/foo.ejs @@ -2,4 +2,6 @@ <% e.begin_define_block("foo"); %> YY + <% e.super(); %> + ZZ <% e.end_define_block(); %> diff --git a/src/node/eejs/index.js b/src/node/eejs/index.js index 9291a341..a16ddc80 100644 --- a/src/node/eejs/index.js +++ b/src/node/eejs/index.js @@ -16,12 +16,13 @@ /* Basic usage: * - * require("./eejs").require("./examples/foo.ejs") + * require("./index").require("./examples/foo.ejs") */ var ejs = require("ejs"); var fs = require("fs"); var path = require("path"); +var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks.js"); exports.info = { buf_stack: [], @@ -62,17 +63,26 @@ exports.begin_define_block = function (name) { exports.begin_capture(); } +exports.super = function () { + exports.info.buf.push(''); +} + exports.end_define_block = function () { content = exports.end_capture(); var name = exports.info.block_stack.pop(); if (typeof exports.info.blocks[name].content == "undefined") exports.info.blocks[name].content = content; + else if (typeof exports.info.blocks[name].content.indexOf('')) + exports.info.blocks[name].content = exports.info.blocks[name].content.replace('', content); + return exports.info.blocks[name].content; } exports.end_block = function () { - var res = exports.end_define_block(); - exports.info.buf.push(res); + var name = exports.info.block_stack[exports.info.block_stack.length-1]; + var args = {content: exports.end_define_block()}; + hooks.callAll("eejsBlock_" + name, args); + exports.info.buf.push(args.content); } exports.begin_block = exports.begin_define_block; diff --git a/src/templates/pad.html b/src/templates/pad.html index 95a5b98f..e34f572b 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -15,61 +15,65 @@