From c89da1a9f21cd5cc84a2b393d8072c5c5003e7a7 Mon Sep 17 00:00:00 2001 From: "translatewiki.net" Date: Mon, 18 Jan 2021 16:46:17 +0100 Subject: [PATCH 1/9] Localisation updates from https://translatewiki.net. --- src/locales/sl.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/locales/sl.json b/src/locales/sl.json index 35dcfba6f..0314f07ce 100644 --- a/src/locales/sl.json +++ b/src/locales/sl.json @@ -41,8 +41,9 @@ "pad.settings.linenocheck": "Številke vrstic", "pad.settings.rtlcheck": "Ali naj se vsebina prebira od desne proti levi?", "pad.settings.fontType": "Vrsta pisave:", - "pad.settings.fontType.normal": "Običajno", + "pad.settings.fontType.normal": "Normalno", "pad.settings.language": "Jezik:", + "pad.settings.poweredBy": "Omogoča", "pad.importExport.import_export": "Uvoz/Izvoz", "pad.importExport.import": "Naloži katerokoli besedilno datoteko ali dokument.", "pad.importExport.importSuccessful": "Opravilo je uspešno končano!", @@ -81,7 +82,7 @@ "pad.modals.disconnected.explanation": "Povezava s strežnikom je bila izgubljena.", "pad.modals.disconnected.cause": "Strežnik morda ni na voljo. Prosimo, obvestite skrbnika storitve, če se to zgodi večkrat.", "pad.share": "Določi souporabo dokumenta", - "pad.share.readonly": "Le za branje", + "pad.share.readonly": "Samo za branje", "pad.share.link": "Povezava", "pad.share.emebdcode": "URL za vključitev", "pad.chat": "Klepet", From ebc4956277c927098bed26bd9502e6d3f899c0c9 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 19 Jan 2021 14:53:14 -0500 Subject: [PATCH 2/9] eejs: Fix straightforward ESLint errors --- src/node/eejs/index.js | 44 ++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/src/node/eejs/index.js b/src/node/eejs/index.js index 1da0b7cca..cb68c3d40 100644 --- a/src/node/eejs/index.js +++ b/src/node/eejs/index.js @@ -1,3 +1,4 @@ +'use strict'; /* * Copyright (c) 2011 RedHog (Egil Möller) * @@ -21,8 +22,8 @@ const ejs = require('ejs'); const fs = require('fs'); +const hooks = require('../../static/js/pluginfw/hooks.js'); const path = require('path'); -const hooks = require('ep_etherpad-lite/static/js/pluginfw/hooks.js'); const resolve = require('resolve'); const settings = require('../utils/Settings'); @@ -35,50 +36,43 @@ exports.info = { args: [], }; -function getCurrentFile() { - return exports.info.file_stack[exports.info.file_stack.length - 1]; -} +const getCurrentFile = () => exports.info.file_stack[exports.info.file_stack.length - 1]; -function createBlockId(name) { - return `${getCurrentFile().path}|${name}`; -} - -exports._init = function (b, recursive) { +exports._init = (b, recursive) => { exports.info.__output_stack.push(exports.info.__output); exports.info.__output = b; }; -exports._exit = function (b, recursive) { +exports._exit = (b, recursive) => { getCurrentFile().inherit.forEach((item) => { exports._require(item.name, item.args); }); exports.info.__output = exports.info.__output_stack.pop(); }; -exports.begin_capture = function () { +exports.begin_capture = () => { exports.info.__output_stack.push(exports.info.__output.concat()); exports.info.__output.splice(0, exports.info.__output.length); }; -exports.end_capture = function () { +exports.end_capture = () => { const res = exports.info.__output.join(''); - exports.info.__output.splice.apply( - exports.info.__output, - [0, exports.info.__output.length].concat(exports.info.__output_stack.pop())); + exports.info.__output.splice( + 0, exports.info.__output.length, ...exports.info.__output_stack.pop()); return res; }; -exports.begin_define_block = function (name) { +exports.begin_define_block = (name) => { exports.info.block_stack.push(name); exports.begin_capture(); }; -exports.end_define_block = function () { +exports.end_define_block = () => { const content = exports.end_capture(); return content; }; -exports.end_block = function () { +exports.end_block = () => { const name = exports.info.block_stack.pop(); const renderContext = exports.info.args[exports.info.args.length - 1]; const args = {content: exports.end_define_block(), renderContext}; @@ -88,12 +82,12 @@ exports.end_block = function () { exports.begin_block = exports.begin_define_block; -exports.inherit = function (name, args) { +exports.inherit = (name, args) => { getCurrentFile().inherit.push({name, args}); }; -exports.require = function (name, args, mod) { - if (args == undefined) args = {}; +exports.require = (name, args, mod) => { + if (args == null) args = {}; let basedir = __dirname; let paths = []; @@ -132,17 +126,13 @@ exports.require = function (name, args, mod) { exports.info.args.push(args); exports.info.file_stack.push({path: ejspath, inherit: []}); - if (settings.maxAge !== 0) { - var res = ejs.render(template, args, {cache: true, filename: ejspath}); - } else { - var res = ejs.render(template, args, {cache: false, filename: ejspath}); - } + const res = ejs.render(template, args, {cache: settings.maxAge !== 0, filename: ejspath}); exports.info.file_stack.pop(); exports.info.args.pop(); return res; }; -exports._require = function (name, args) { +exports._require = (name, args) => { exports.info.__output.push(exports.require(name, args)); }; From 1d6319b852688ee61027e56773adbdda9db3530b Mon Sep 17 00:00:00 2001 From: bytecaster Date: Wed, 20 Jan 2021 05:54:54 +0100 Subject: [PATCH 3/9] docs: Remove ep_page_view from README Removes ep_page_view plugin from the installation instructions in README.md to aid new users installing etherpad-lite. According to the plugin directory at https://static.etherpad.org/index.html, the plugin is defunct as it is now part of etherpad-lite core and when I tried installing etherpad with the plugin (following the instructions), its installation resulted in an error every time I opened a pad. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 086441b19..10dbd36cd 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ Etherpad is very customizable through plugins. Instructions for installing theme Run the following command in your Etherpad folder to get all of the features visible in the demo gif: ``` -npm install ep_headings2 ep_markdown ep_comments_page ep_align ep_page_view ep_font_color ep_webrtc ep_embedded_hyperlinks2 +npm install ep_headings2 ep_markdown ep_comments_page ep_align ep_font_color ep_webrtc ep_embedded_hyperlinks2 ``` ## Customize the style with skin variants From 5987f75b0d5fff339171100a078b3bd6fb952201 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 19 Jan 2021 18:49:45 -0500 Subject: [PATCH 4/9] eejs: Unwrap unnecessarily wrapped line --- src/node/eejs/index.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/node/eejs/index.js b/src/node/eejs/index.js index cb68c3d40..c84b3c6dc 100644 --- a/src/node/eejs/index.js +++ b/src/node/eejs/index.js @@ -100,14 +100,7 @@ exports.require = (name, args, mod) => { paths = mod.paths; } - const ejspath = resolve.sync( - name, - { - paths, - basedir, - extensions: ['.html', '.ejs'], - } - ); + const ejspath = resolve.sync(name, {paths, basedir, extensions: ['.html', '.ejs']}); args.e = exports; args.require = require; From 351913c08ebcbf79c1777e8eac171c448ad03643 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 19 Jan 2021 15:26:45 -0500 Subject: [PATCH 5/9] eejs: Delete broken example --- src/node/eejs/examples/bar.ejs | 9 --------- src/node/eejs/examples/foo.ejs | 7 ------- src/node/eejs/index.js | 2 +- 3 files changed, 1 insertion(+), 17 deletions(-) delete mode 100644 src/node/eejs/examples/bar.ejs delete mode 100644 src/node/eejs/examples/foo.ejs diff --git a/src/node/eejs/examples/bar.ejs b/src/node/eejs/examples/bar.ejs deleted file mode 100644 index 6a2cc4bab..000000000 --- a/src/node/eejs/examples/bar.ejs +++ /dev/null @@ -1,9 +0,0 @@ -a -<% e.begin_block("bar"); %> - A - <% e.begin_block("foo"); %> - XX - <% e.end_block(); %> - B -<% e.end_block(); %> -b diff --git a/src/node/eejs/examples/foo.ejs b/src/node/eejs/examples/foo.ejs deleted file mode 100644 index daee5f8e8..000000000 --- a/src/node/eejs/examples/foo.ejs +++ /dev/null @@ -1,7 +0,0 @@ -<% e.inherit("./bar.ejs"); %> - -<% 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 c84b3c6dc..bcbbee492 100644 --- a/src/node/eejs/index.js +++ b/src/node/eejs/index.js @@ -17,7 +17,7 @@ /* Basic usage: * - * require("./index").require("./examples/foo.ejs") + * require("./index").require("./path/to/template.ejs") */ const ejs = require('ejs'); From 7d11d54323362a7963958b55ae869b6ea94782ee Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 19 Jan 2021 16:01:37 -0500 Subject: [PATCH 6/9] eejs: Delete unused functions --- src/node/eejs/index.js | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/src/node/eejs/index.js b/src/node/eejs/index.js index bcbbee492..416e7807c 100644 --- a/src/node/eejs/index.js +++ b/src/node/eejs/index.js @@ -44,9 +44,6 @@ exports._init = (b, recursive) => { }; exports._exit = (b, recursive) => { - getCurrentFile().inherit.forEach((item) => { - exports._require(item.name, item.args); - }); exports.info.__output = exports.info.__output_stack.pop(); }; @@ -62,30 +59,19 @@ exports.end_capture = () => { return res; }; -exports.begin_define_block = (name) => { +exports.begin_block = (name) => { exports.info.block_stack.push(name); exports.begin_capture(); }; -exports.end_define_block = () => { - const content = exports.end_capture(); - return content; -}; - exports.end_block = () => { const name = exports.info.block_stack.pop(); const renderContext = exports.info.args[exports.info.args.length - 1]; - const args = {content: exports.end_define_block(), renderContext}; + const args = {content: exports.end_capture(), renderContext}; hooks.callAll(`eejsBlock_${name}`, args); exports.info.__output.push(args.content); }; -exports.begin_block = exports.begin_define_block; - -exports.inherit = (name, args) => { - getCurrentFile().inherit.push({name, args}); -}; - exports.require = (name, args, mod) => { if (args == null) args = {}; @@ -118,14 +104,10 @@ exports.require = (name, args, mod) => { } exports.info.args.push(args); - exports.info.file_stack.push({path: ejspath, inherit: []}); + exports.info.file_stack.push({path: ejspath}); const res = ejs.render(template, args, {cache: settings.maxAge !== 0, filename: ejspath}); exports.info.file_stack.pop(); exports.info.args.pop(); return res; }; - -exports._require = (name, args) => { - exports.info.__output.push(exports.require(name, args)); -}; From c8c39290583ecaaffd16ae4f55947b71ed6d1173 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 19 Jan 2021 17:34:09 -0500 Subject: [PATCH 7/9] eejs: Inline `begin_capture`, `end_capture` --- src/node/eejs/index.js | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/node/eejs/index.js b/src/node/eejs/index.js index 416e7807c..428a67637 100644 --- a/src/node/eejs/index.js +++ b/src/node/eejs/index.js @@ -47,27 +47,19 @@ exports._exit = (b, recursive) => { exports.info.__output = exports.info.__output_stack.pop(); }; -exports.begin_capture = () => { - exports.info.__output_stack.push(exports.info.__output.concat()); - exports.info.__output.splice(0, exports.info.__output.length); -}; - -exports.end_capture = () => { - const res = exports.info.__output.join(''); - exports.info.__output.splice( - 0, exports.info.__output.length, ...exports.info.__output_stack.pop()); - return res; -}; - exports.begin_block = (name) => { exports.info.block_stack.push(name); - exports.begin_capture(); + exports.info.__output_stack.push(exports.info.__output.concat()); + exports.info.__output.splice(0, exports.info.__output.length); }; exports.end_block = () => { const name = exports.info.block_stack.pop(); const renderContext = exports.info.args[exports.info.args.length - 1]; - const args = {content: exports.end_capture(), renderContext}; + const content = exports.info.__output.join(''); + exports.info.__output.splice( + 0, exports.info.__output.length, ...exports.info.__output_stack.pop()); + const args = {content, renderContext}; hooks.callAll(`eejsBlock_${name}`, args); exports.info.__output.push(args.content); }; From 4d2d439874eec7e81179ccc61c6d4d6372f3533e Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 19 Jan 2021 17:57:19 -0500 Subject: [PATCH 8/9] eejs: Simplify cache lookup logic --- src/node/eejs/index.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/node/eejs/index.js b/src/node/eejs/index.js index 428a67637..61f5eb0dd 100644 --- a/src/node/eejs/index.js +++ b/src/node/eejs/index.js @@ -83,21 +83,14 @@ exports.require = (name, args, mod) => { args.e = exports; args.require = require; - let template; - if (settings.maxAge !== 0) { // don't cache if maxAge is 0 - if (!templateCache.has(ejspath)) { - template = `<% e._init(__output); %>${fs.readFileSync(ejspath).toString()}<% e._exit(); %>`; - templateCache.set(ejspath, template); - } else { - template = templateCache.get(ejspath); - } - } else { - template = `<% e._init(__output); %>${fs.readFileSync(ejspath).toString()}<% e._exit(); %>`; - } + const cache = settings.maxAge !== 0; + const template = cache && templateCache.get(ejspath) || + `<% e._init(__output); %>${fs.readFileSync(ejspath).toString()}<% e._exit(); %>`; + if (cache) templateCache.set(ejspath, template); exports.info.args.push(args); exports.info.file_stack.push({path: ejspath}); - const res = ejs.render(template, args, {cache: settings.maxAge !== 0, filename: ejspath}); + const res = ejs.render(template, args, {cache, filename: ejspath}); exports.info.file_stack.pop(); exports.info.args.pop(); From 517fc88c5450370b425f7e6f25f408e270be0bbd Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 19 Jan 2021 18:43:46 -0500 Subject: [PATCH 9/9] eejs: Cache the compiled template, not the template string --- src/node/eejs/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/node/eejs/index.js b/src/node/eejs/index.js index 61f5eb0dd..9f04fe1fb 100644 --- a/src/node/eejs/index.js +++ b/src/node/eejs/index.js @@ -84,13 +84,14 @@ exports.require = (name, args, mod) => { args.require = require; const cache = settings.maxAge !== 0; - const template = cache && templateCache.get(ejspath) || - `<% e._init(__output); %>${fs.readFileSync(ejspath).toString()}<% e._exit(); %>`; + const template = cache && templateCache.get(ejspath) || ejs.compile( + `<% e._init(__output); %>${fs.readFileSync(ejspath).toString()}<% e._exit(); %>`, + {filename: ejspath}); if (cache) templateCache.set(ejspath, template); exports.info.args.push(args); exports.info.file_stack.push({path: ejspath}); - const res = ejs.render(template, args, {cache, filename: ejspath}); + const res = template(args); exports.info.file_stack.pop(); exports.info.args.pop();