Merge branch 'develop' of github.com:ether/etherpad-lite into lint-pluginfw
commit
bc72cbe88a
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
a
|
||||
<% e.begin_block("bar"); %>
|
||||
A
|
||||
<% e.begin_block("foo"); %>
|
||||
XX
|
||||
<% e.end_block(); %>
|
||||
B
|
||||
<% e.end_block(); %>
|
||||
b
|
|
@ -1,7 +0,0 @@
|
|||
<% e.inherit("./bar.ejs"); %>
|
||||
|
||||
<% e.begin_define_block("foo"); %>
|
||||
YY
|
||||
<% e.super(); %>
|
||||
ZZ
|
||||
<% e.end_define_block(); %>
|
|
@ -1,3 +1,4 @@
|
|||
'use strict';
|
||||
/*
|
||||
* Copyright (c) 2011 RedHog (Egil Möller) <egil.moller@freecode.no>
|
||||
*
|
||||
|
@ -16,13 +17,13 @@
|
|||
|
||||
/* Basic usage:
|
||||
*
|
||||
* require("./index").require("./examples/foo.ejs")
|
||||
* require("./index").require("./path/to/template.ejs")
|
||||
*/
|
||||
|
||||
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,65 +36,36 @@ 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) {
|
||||
getCurrentFile().inherit.forEach((item) => {
|
||||
exports._require(item.name, item.args);
|
||||
});
|
||||
exports._exit = (b, recursive) => {
|
||||
exports.info.__output = exports.info.__output_stack.pop();
|
||||
};
|
||||
|
||||
exports.begin_capture = function () {
|
||||
exports.begin_block = (name) => {
|
||||
exports.info.block_stack.push(name);
|
||||
exports.info.__output_stack.push(exports.info.__output.concat());
|
||||
exports.info.__output.splice(0, exports.info.__output.length);
|
||||
};
|
||||
|
||||
exports.end_capture = function () {
|
||||
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()));
|
||||
return res;
|
||||
};
|
||||
|
||||
exports.begin_define_block = function (name) {
|
||||
exports.info.block_stack.push(name);
|
||||
exports.begin_capture();
|
||||
};
|
||||
|
||||
exports.end_define_block = function () {
|
||||
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};
|
||||
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);
|
||||
};
|
||||
|
||||
exports.begin_block = exports.begin_define_block;
|
||||
|
||||
exports.inherit = function (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 = [];
|
||||
|
@ -106,43 +78,22 @@ exports.require = function (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;
|
||||
|
||||
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) || 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, 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});
|
||||
}
|
||||
exports.info.file_stack.push({path: ejspath});
|
||||
const res = template(args);
|
||||
exports.info.file_stack.pop();
|
||||
exports.info.args.pop();
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
exports._require = function (name, args) {
|
||||
exports.info.__output.push(exports.require(name, args));
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue