summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McLear <john@mclear.co.uk>2015-05-19 16:44:57 +0100
committerJohn McLear <john@mclear.co.uk>2015-05-19 16:44:57 +0100
commit41d24a8c8f1ab2953811192fdc12c1f1aee18d11 (patch)
treecef25616f9e78b6221c01170f434ccd255ff9962
parentb662d5c61802d42ee4214799520e7c3ed95a3ef5 (diff)
parent5615bab0d9e7cd62867991335dbf176055cc2332 (diff)
downloadetherpad-lite-41d24a8c8f1ab2953811192fdc12c1f1aee18d11.zip
Merge branch 'develop' of github.com:ether/etherpad-lite into develop
-rw-r--r--doc/api/hooks_client-side.md14
-rw-r--r--settings.json.template42
-rw-r--r--src/locales/be-tarask.json3
-rw-r--r--src/locales/de.json3
-rw-r--r--src/locales/es.json7
-rw-r--r--src/locales/fa.json3
-rw-r--r--src/locales/fr.json3
-rw-r--r--src/locales/gl.json3
-rw-r--r--src/locales/he.json3
-rw-r--r--src/locales/ja.json3
-rw-r--r--src/locales/ksh.json3
-rw-r--r--src/locales/ku-latn.json77
-rw-r--r--src/locales/mk.json3
-rw-r--r--src/locales/ms.json5
-rw-r--r--src/locales/nb.json59
-rw-r--r--src/locales/ps.json10
-rw-r--r--src/locales/ro.json82
-rw-r--r--src/locales/sv.json3
-rw-r--r--src/locales/zh-hans.json3
-rw-r--r--src/node/handler/ExportHandler.js36
-rw-r--r--src/node/utils/Settings.js9
-rw-r--r--src/node/utils/TidyHtml.js41
-rw-r--r--tests/backend/specs/api/tidy.js63
23 files changed, 409 insertions, 69 deletions
diff --git a/doc/api/hooks_client-side.md b/doc/api/hooks_client-side.md
index aa027337..fccdaf46 100644
--- a/doc/api/hooks_client-side.md
+++ b/doc/api/hooks_client-side.md
@@ -203,10 +203,10 @@ Things in context:
This hook is called before the content of a node is collected by the usual methods. The cc object can be used to do a bunch of things that modify the content of the pad. See, for example, the heading1 plugin for etherpad original.
-E.g. if you need to apply an attribute to newly inserted characters,
+E.g. if you need to apply an attribute to newly inserted characters,
call cc.doAttrib(state, "attributeName") which results in an attribute attributeName=true.
-If you want to specify also a value, call cc.doAttrib(state, "attributeName:value")
+If you want to specify also a value, call cc.doAttrib(state, "attributeName::value")
which results in an attribute attributeName=value.
@@ -257,7 +257,7 @@ This hook gets called every time the client receives a message of type `name`. T
`collab_client.js` has a pretty extensive list of message types, if you want to take a look.
-##aceStartLineAndCharForPoint-aceEndLineAndCharForPoint
+##aceStartLineAndCharForPoint-aceEndLineAndCharForPoint
Called from: src/static/js/ace2_inner.js
Things in context:
@@ -272,7 +272,7 @@ Things in context:
This hook is provided to allow a plugin to turn DOM node selection into [line,char] selection.
The return value should be an array of [line,char]
-##aceKeyEvent
+##aceKeyEvent
Called from: src/static/js/ace2_inner.js
Things in context:
@@ -286,7 +286,7 @@ Things in context:
This hook is provided to allow a plugin to handle key events.
The return value should be true if you have handled the event.
-##collectContentLineText
+##collectContentLineText
Called from: src/static/js/contentcollector.js
Things in context:
@@ -299,7 +299,7 @@ Things in context:
This hook allows you to validate/manipulate the text before it's sent to the server side.
The return value should be the validated/manipulated text.
-##collectContentLineBreak
+##collectContentLineBreak
Called from: src/static/js/contentcollector.js
Things in context:
@@ -311,7 +311,7 @@ Things in context:
This hook is provided to allow whether the br tag should induce a new magic domline or not.
The return value should be either true(break the line) or false.
-##disableAuthorColorsForThisLine
+##disableAuthorColorsForThisLine
Called from: src/static/js/linestylefilter.js
Things in context:
diff --git a/settings.json.template b/settings.json.template
index 7d9c62cc..310e0791 100644
--- a/settings.json.template
+++ b/settings.json.template
@@ -10,12 +10,12 @@
// favicon default name
// alternatively, set up a fully specified Url to your own favicon
"favicon": "favicon.ico",
-
+
//IP and port which etherpad should bind at
"ip": "0.0.0.0",
"port" : 9001,
- /*
+ /*
// Node native SSL support
// this is disabled by default
//
@@ -37,17 +37,17 @@
"dbSettings" : {
"filename" : "var/dirty.db"
},
-
+
/* An Example of MySQL Configuration
"dbType" : "mysql",
"dbSettings" : {
- "user" : "root",
- "host" : "localhost",
- "password": "",
+ "user" : "root",
+ "host" : "localhost",
+ "password": "",
"database": "store"
},
*/
-
+
//the default text of a pad
"defaultPadText" : "Welcome to Etherpad!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\n\nGet involved with Etherpad at http:\/\/etherpad.org\n",
@@ -65,7 +65,7 @@
"chatAndUsers": false,
"lang": "en-gb"
},
-
+
/* Shoud we suppress errors from being visible in the default Pad Text? */
"suppressErrorsInPadText" : false,
@@ -77,35 +77,39 @@
/* Users, who have a valid session, automatically get granted access to password protected pads */
"sessionNoPassword" : false,
-
- /* if true, all css & js will be minified before sending to the client. This will improve the loading performance massivly,
+
+ /* if true, all css & js will be minified before sending to the client. This will improve the loading performance massivly,
but makes it impossible to debug the javascript/css */
"minify" : true,
/* How long may clients use served javascript code (in seconds)? Without versioning this
may cause problems during deployment. Set to 0 to disable caching */
"maxAge" : 21600, // 60 * 60 * 6 = 6 hours
-
+
/* This is the path to the Abiword executable. Setting it to null, disables abiword.
- Abiword is needed to advanced import/export features of pads*/
+ Abiword is needed to advanced import/export features of pads*/
"abiword" : null,
+ /* This is the path to the Tidy executable. Setting it to null, disables Tidy.
+ Tidy is used to improve the quality of exported pads*/
+ "tidyHtml" : null,
+
/* Allow import of file types other than the supported types: txt, doc, docx, rtf, odt, html & htm */
"allowUnknownFileEnds" : true,
-
+
/* This setting is used if you require authentication of all users.
Note: /admin always requires authentication. */
"requireAuthentication" : false,
/* Require authorization by a module, or a user with is_admin set, see below. */
"requireAuthorization" : false,
-
+
/*when you use NginX or another proxy/ load-balancer set this to true*/
"trustProxy" : false,
-
+
/* Privacy: disable IP logging */
- "disableIPlogging" : false,
-
+ "disableIPlogging" : false,
+
/* Users for basic authentication. is_admin = true gives access to /admin.
If you do not uncomment this, /admin will not be available! */
/*
@@ -126,7 +130,7 @@
// Allow Load Testing tools to hit the Etherpad Instance. Warning this will disable security on the instance.
"loadTest": false,
-
+
/* The toolbar buttons configuration.
"toolbar": {
"left": [
@@ -148,7 +152,7 @@
/* The log level we are using, can be: DEBUG, INFO, WARN, ERROR */
"loglevel": "INFO",
-
+
//Logging configuration. See log4js documentation for further information
// https://github.com/nomiddlename/log4js-node
// You can add as many appenders as you want here:
diff --git a/src/locales/be-tarask.json b/src/locales/be-tarask.json
index 3c789858..2d8c26e8 100644
--- a/src/locales/be-tarask.json
+++ b/src/locales/be-tarask.json
@@ -94,6 +94,9 @@
"timeslider.exportCurrent": "Экспартаваць актуальную вэрсію як:",
"timeslider.version": "Вэрсія {{version}}",
"timeslider.saved": "Захавана {{day}}.{{month}}.{{year}}",
+ "timeslider.playPause": "Прайграць / спыніць зьмест дакумэнту",
+ "timeslider.backRevision": "Вярнуць рэдагаваньне гэтага дакумэнту",
+ "timeslider.forwardRevision": "Перайсьці да наступнага рэдагаваньня гэтага дакумэнту",
"timeslider.dateformat": "{{day}}/{{month}}/{{year}} {{hours}}:{{minutes}}:{{seconds}}",
"timeslider.month.january": "студзень",
"timeslider.month.february": "люты",
diff --git a/src/locales/de.json b/src/locales/de.json
index 2fd31c12..1600fc74 100644
--- a/src/locales/de.json
+++ b/src/locales/de.json
@@ -96,6 +96,9 @@
"timeslider.exportCurrent": "Exportiere diese Version als:",
"timeslider.version": "Version {{version}}",
"timeslider.saved": "gespeichert am {{day}}. {{month}} {{year}}",
+ "timeslider.playPause": "Padinhalte abspielen/pausieren",
+ "timeslider.backRevision": "Eine Version in diesem Pad zurück gehen",
+ "timeslider.forwardRevision": "Eine Version in diesem Pad vorwärts gehen",
"timeslider.dateformat": "{{day}}.{{month}}.{{year}} {{hours}}:{{minutes}}:{{seconds}}",
"timeslider.month.january": "Januar",
"timeslider.month.february": "Februar",
diff --git a/src/locales/es.json b/src/locales/es.json
index 21eb60a7..98227182 100644
--- a/src/locales/es.json
+++ b/src/locales/es.json
@@ -36,7 +36,7 @@
"pad.colorpicker.save": "Guardar",
"pad.colorpicker.cancel": "Cancelar",
"pad.loading": "Cargando...",
- "pad.noCookie": "La cookie no se pudo encontrar. ¡Por favor, habilita las cookies en tu navegador!",
+ "pad.noCookie": "La cookie no se pudo encontrar. ¡Habilita las cookies en tu navegador!",
"pad.passwordRequired": "Necesitas una contraseña para acceder a este pad",
"pad.permissionDenied": "No tienes permiso para acceder a este pad",
"pad.wrongPassword": "La contraseña era incorrecta",
@@ -102,6 +102,9 @@
"timeslider.exportCurrent": "Exportar la versión actual como:",
"timeslider.version": "Versión {{version}}",
"timeslider.saved": "Guardado el {{day}} de {{month}} de {{year}}",
+ "timeslider.playPause": "Reproducir/pausar los contenidos del pad",
+ "timeslider.backRevision": "Ir a la revisión anterior en este pad",
+ "timeslider.forwardRevision": "Ir a la revisión posterior en este pad",
"timeslider.dateformat": "{{day}}/{{month}}/{{year}} {{hours}}:{{minutes}}:{{seconds}}",
"timeslider.month.january": "enero",
"timeslider.month.february": "febrero",
@@ -128,7 +131,7 @@
"pad.impexp.importing": "Importando...",
"pad.impexp.confirmimport": "Al importar un archivo se borrará el contenido actual del pad. ¿Estás seguro de que quieres continuar?",
"pad.impexp.convertFailed": "No pudimos importar este archivo. Inténtalo con un formato diferente o copia y pega manualmente.",
- "pad.impexp.padHasData": "No hemos podido importar este archivo porque esta almohadilla ya ha tenido cambios, por favor, importa a una nueva almohadilla",
+ "pad.impexp.padHasData": "No hemos podido importar este archivo porque este pad ya ha tenido cambios. Importa a un nuevo pad.",
"pad.impexp.uploadFailed": "El envío falló. Intentalo de nuevo.",
"pad.impexp.importfailed": "Fallo al importar",
"pad.impexp.copypaste": "Intenta copiar y pegar",
diff --git a/src/locales/fa.json b/src/locales/fa.json
index cd42c871..0bdb4c56 100644
--- a/src/locales/fa.json
+++ b/src/locales/fa.json
@@ -98,6 +98,9 @@
"timeslider.exportCurrent": "برون‌ریزی نگارش کنونی به عنوان:",
"timeslider.version": "نگارش {{version}}",
"timeslider.saved": "{{month}} {{day}}، {{year}} ذخیره شد",
+ "timeslider.playPause": "اجرای مجدد/متوقف کردن پخش",
+ "timeslider.backRevision": "رفتن به نسخهٔ پیشین در این دفترچه",
+ "timeslider.forwardRevision": "رفتن به نسخهٔ بعدی در این دفترچه",
"timeslider.dateformat": "{{month}}/{{day}}/{{year}} {{hours}}:{{minutes}}:{{seconds}}",
"timeslider.month.january": "ژانویه",
"timeslider.month.february": "فوریه",
diff --git a/src/locales/fr.json b/src/locales/fr.json
index ba289e3b..166bd3bf 100644
--- a/src/locales/fr.json
+++ b/src/locales/fr.json
@@ -109,6 +109,9 @@
"timeslider.exportCurrent": "Exporter la version actuelle sous :",
"timeslider.version": "Version {{version}}",
"timeslider.saved": "Enregistré le {{day}} {{month}} {{year}}",
+ "timeslider.playPause": "Lecture / Pause des contenus du bloc",
+ "timeslider.backRevision": "Reculer d’une révision dans ce bloc",
+ "timeslider.forwardRevision": "Avancer d’une révision dans ce bloc",
"timeslider.dateformat": "{{day}}/{{month}}/{{year}} {{hours}}:{{minutes}}:{{seconds}}",
"timeslider.month.january": "janvier",
"timeslider.month.february": "février",
diff --git a/src/locales/gl.json b/src/locales/gl.json
index 381296aa..ff1e9305 100644
--- a/src/locales/gl.json
+++ b/src/locales/gl.json
@@ -93,6 +93,9 @@
"timeslider.exportCurrent": "Exportar a versión actual en formato:",
"timeslider.version": "Versión {{version}}",
"timeslider.saved": "Gardado o {{day}} de {{month}} de {{year}}",
+ "timeslider.playPause": "Reproducir/pausar os contidos do pad",
+ "timeslider.backRevision": "Ir á revisión anterior neste pad",
+ "timeslider.forwardRevision": "Ir á revisión posterior neste pad",
"timeslider.dateformat": "{{day}}/{{month}}/{{year}} {{hours}}:{{minutes}}:{{seconds}}",
"timeslider.month.january": "xaneiro",
"timeslider.month.february": "febreiro",
diff --git a/src/locales/he.json b/src/locales/he.json
index 4222e153..3a6672b2 100644
--- a/src/locales/he.json
+++ b/src/locales/he.json
@@ -95,6 +95,9 @@
"timeslider.exportCurrent": "ייצוא הגרסה הנוכחית בתור:",
"timeslider.version": "גרסה {{version}}",
"timeslider.saved": "נשמרה ב־{{day}} ב{{month}} {{year}}",
+ "timeslider.playPause": "לנגן / לעצור את תוכן הפנקס",
+ "timeslider.backRevision": "לחזור לגרסה של הפנקס הזה",
+ "timeslider.forwardRevision": "ללכת לגרסה חדשה יותר בפנקס הזה",
"timeslider.dateformat": "{{year}}-{{month}}-{{day}} {{hours}}:{{minutes}}:{{seconds}}",
"timeslider.month.january": "ינואר",
"timeslider.month.february": "פברואר",
diff --git a/src/locales/ja.json b/src/locales/ja.json
index b6cc4e34..f223a8c4 100644
--- a/src/locales/ja.json
+++ b/src/locales/ja.json
@@ -93,6 +93,9 @@
"timeslider.exportCurrent": "現在の版をエクスポートする形式:",
"timeslider.version": "バージョン {{version}}",
"timeslider.saved": "| {{year}}年{{month}}{{day}}日に保存",
+ "timeslider.playPause": "パッドの過去の内容を再生/一時停止",
+ "timeslider.backRevision": "前の版に戻る",
+ "timeslider.forwardRevision": "次の版に進む",
"timeslider.dateformat": "{{year}}年{{month}}月{{day}}日 {{hours}}:{{minutes}}:{{seconds}}",
"timeslider.month.january": "1月",
"timeslider.month.february": "2月",
diff --git a/src/locales/ksh.json b/src/locales/ksh.json
index 5d5230d3..5ed5b410 100644
--- a/src/locales/ksh.json
+++ b/src/locales/ksh.json
@@ -92,6 +92,9 @@
"timeslider.exportCurrent": "Donn de neußte Väsjohn äxpotteere alß:",
"timeslider.version": "Väsjohn {{version}}",
"timeslider.saved": "Faßjehallde aam {{day}}. {{month}} {{year}}",
+ "timeslider.playPause": "Donn der Enhalld vum Päd afschpelle udder aanhallde",
+ "timeslider.backRevision": "Jangk ein Väsjohn retuhr en dämm Pahdt",
+ "timeslider.forwardRevision": "Jangg en Väsjohn vörwääz en heh däm Pahdt.",
"timeslider.dateformat": "aam {{day}}. {{month}} {{year}} öm {{hours}}:{{minutes}}:{{seconds}}",
"timeslider.month.january": "Jannewaa",
"timeslider.month.february": "Fääbrowaa",
diff --git a/src/locales/ku-latn.json b/src/locales/ku-latn.json
new file mode 100644
index 00000000..16fc1538
--- /dev/null
+++ b/src/locales/ku-latn.json
@@ -0,0 +1,77 @@
+{
+ "@metadata": {
+ "authors": [
+ "Bikarhêner",
+ "Dilyaramude",
+ "George Animal",
+ "Gomada"
+ ]
+ },
+ "index.newPad": "Bloknota nû",
+ "index.createOpenPad": "Yan Padekê li gel navê biafirîne/veke:",
+ "pad.toolbar.bold.title": "Stûr (Ctrl-B)",
+ "pad.toolbar.italic.title": "Xwar (Ctrl-I)",
+ "pad.toolbar.underline.title": "Binxet (Ctrl-U)",
+ "pad.toolbar.strikethrough.title": "Serxêzkirî (Ctrl+5)",
+ "pad.toolbar.ol.title": "Lîsteya rêzkirî (Ctrl+Shift+N)",
+ "pad.toolbar.ul.title": "Lîsteya tevlîhev (Ctrl+Shift+L)",
+ "pad.toolbar.undo.title": "Vegerîne (Ctrl-Z)",
+ "pad.toolbar.redo.title": "Dîsa bike (Ctrl-Y)",
+ "pad.toolbar.clearAuthorship.title": "Rengên nivîskariyê jê bibe (Ctrl+Shift+C)",
+ "pad.toolbar.savedRevision.title": "Sererastkirinê tomar bike",
+ "pad.toolbar.settings.title": "Eyar",
+ "pad.colorpicker.save": "Tomar bike",
+ "pad.colorpicker.cancel": "Beta bike",
+ "pad.loading": "Tê barkirin...",
+ "pad.settings.padSettings": "Eyarên bloknotê",
+ "pad.settings.myView": "Dîmena min",
+ "pad.settings.stickychat": "Di ekranê de hertim çet bike",
+ "pad.settings.chatandusers": "Çeta û Bikarhênera Nîşan bide",
+ "pad.settings.colorcheck": "Rengên nivîskarîye",
+ "pad.settings.linenocheck": "Hejmarên rêze",
+ "pad.settings.rtlcheck": "Bila naverok ji raste ber bi çepe be xwendin?",
+ "pad.settings.fontType": "Tîpa nivîsê:",
+ "pad.settings.language": "Ziman:",
+ "pad.importExport.importSuccessful": "Biserketî!",
+ "pad.importExport.exportetherpad": "Etherpad",
+ "pad.importExport.exporthtml": "HTML",
+ "pad.importExport.exportword": "Microsoft Word",
+ "pad.importExport.exportpdf": "PDF",
+ "pad.modals.connected": "Hate girêdan.",
+ "pad.modals.reconnecting": "Ji bloknota te re dîsa tê girêdan...",
+ "pad.modals.userdup": "Di pencereyek din de vebû",
+ "pad.modals.userdup.advice": "Ji bo di vê pencereye de bikarbînîy dîsa giredanek çeke.",
+ "pad.modals.unauth": "Desthilatdar nîne",
+ "pad.modals.deleted": "Hate jêbirin.",
+ "pad.modals.deleted.explanation": "Ev bloknot hatiye rakirin.",
+ "pad.modals.disconnected": "Pêwendîya te qut bû.",
+ "pad.modals.disconnected.explanation": "Pêwendîya rajeker qut bû",
+ "pad.share": "Vê bloknotê parve bike",
+ "pad.share.link": "Girêdan",
+ "pad.chat": "Çet",
+ "pad.chat.title": "Ji bo vê bloknotê çet veke.",
+ "pad.chat.loadmessages": "Peyamên bêhtir barbike",
+ "timeslider.toolbar.returnbutton": "Vegere bloknotê",
+ "timeslider.toolbar.authors": "Nivîser:",
+ "timeslider.toolbar.authorsList": "Nivîser Tine",
+ "timeslider.version": "Guhertoya {{version}}",
+ "timeslider.saved": "Di dîroka {{day}} {{month}} {{year}} de hate tomarkirin",
+ "timeslider.month.january": "rêbendan",
+ "timeslider.month.february": "reşemî",
+ "timeslider.month.march": "adar",
+ "timeslider.month.april": "avrêl",
+ "timeslider.month.may": "gulan",
+ "timeslider.month.june": "pûşper",
+ "timeslider.month.july": "tîrmeh",
+ "timeslider.month.august": "gelawêj",
+ "timeslider.month.september": "rezber",
+ "timeslider.month.october": "kewçêr",
+ "timeslider.month.november": "sermawez",
+ "timeslider.month.december": "berfanbar",
+ "pad.userlist.entername": "Navê xwe têkeve",
+ "pad.userlist.unnamed": "nenavkirî",
+ "pad.userlist.guest": "Mêvan",
+ "pad.userlist.deny": "Red bike",
+ "pad.userlist.approve": "Bipejirîne",
+ "pad.impexp.copypaste": "Ji kerema xwe re jê bigre û pê ve deyne (Ctrl+c, Ctrl+v)"
+}
diff --git a/src/locales/mk.json b/src/locales/mk.json
index a924875a..e00d47d8 100644
--- a/src/locales/mk.json
+++ b/src/locales/mk.json
@@ -93,6 +93,9 @@
"timeslider.exportCurrent": "Извези ја тековната верзија како:",
"timeslider.version": "Верзија {{version}}",
"timeslider.saved": "Зачувано на {{day}} {{month}} {{year}} г.",
+ "timeslider.playPause": "Пушти/запри содржина на тетратката",
+ "timeslider.backRevision": "Назад за една преработка на тетратката",
+ "timeslider.forwardRevision": "Напред за една преработка на тетратката",
"timeslider.dateformat": "{{day}}/{{month}}/{{year}} {{hours}}:{{minutes}}:{{seconds}}",
"timeslider.month.january": "јануари",
"timeslider.month.february": "февруари",
diff --git a/src/locales/ms.json b/src/locales/ms.json
index d099de06..93b421fa 100644
--- a/src/locales/ms.json
+++ b/src/locales/ms.json
@@ -33,6 +33,7 @@
"pad.settings.padSettings": "Tetapan Pad",
"pad.settings.myView": "Paparan Saya",
"pad.settings.stickychat": "Sentiasa bersembang pada skrin",
+ "pad.settings.chatandusers": "Paparkan Ruang Sembang dan Pengguna-Pengguna",
"pad.settings.colorcheck": "Warna pengarang",
"pad.settings.linenocheck": "Nombor baris",
"pad.settings.rtlcheck": "Membaca dari kanan ke kiri?",
@@ -91,6 +92,9 @@
"timeslider.exportCurrent": "Eksport versi semasa sebagai:",
"timeslider.version": "Versi {{version}}",
"timeslider.saved": "Disimpan pada {{day}} {{month}} {{year}}",
+ "timeslider.playPause": "Mainkan / Pausekan Kandungan Pad",
+ "timeslider.backRevision": "Undur satu semakan di Pad ini",
+ "timeslider.forwardRevision": "Maju satu semakan dalam Pad ini",
"timeslider.dateformat": "{{day}}/{{month}}/{{year}} {{hours}}:{{minutes}}:{{seconds}}",
"timeslider.month.january": "Januari",
"timeslider.month.february": "Februari",
@@ -106,6 +110,7 @@
"timeslider.month.december": "Disember",
"timeslider.unnamedauthors": "{{num}} orang {[plural(num) other: pengarang]} awanama",
"pad.savedrevs.marked": "Semakan ini telah ditandai sebagai semakan tersimpan",
+ "pad.savedrevs.timeslider": "Anda boleh melihat semakan yang tersimpan dengan melawat gelangsar masa",
"pad.userlist.entername": "Taipkan nama anda",
"pad.userlist.unnamed": "tanpa nama",
"pad.userlist.guest": "Tetamu",
diff --git a/src/locales/nb.json b/src/locales/nb.json
index a1b3a5ca..48c96521 100644
--- a/src/locales/nb.json
+++ b/src/locales/nb.json
@@ -2,37 +2,40 @@
"@metadata": {
"authors": [
"Laaknor",
- "Cocu"
+ "Cocu",
+ "Chameleon222"
]
},
- "index.newPad": "Ny Pad",
- "index.createOpenPad": "eller opprette/åpne en ny Pad med dette navnet:",
- "pad.toolbar.bold.title": "Fet (Ctrl-B)",
- "pad.toolbar.italic.title": "Kursiv (Ctrl-I)",
- "pad.toolbar.underline.title": "Understreking (Ctrl-U)",
+ "index.newPad": "Ny blokk",
+ "index.createOpenPad": "eller opprette/åpne en ny blokk med dette navnet:",
+ "pad.toolbar.bold.title": "Fet (Ctrl+B)",
+ "pad.toolbar.italic.title": "Kursiv (Ctrl+I)",
+ "pad.toolbar.underline.title": "Understreking (Ctrl+U)",
"pad.toolbar.strikethrough.title": "Gjennomstreking (Ctrl+5)",
"pad.toolbar.ol.title": "Nummerert liste (Ctrl+Shift+N)",
"pad.toolbar.ul.title": "Punktliste (Ctrl+Shift+L)",
"pad.toolbar.indent.title": "Innrykk (TAB)",
"pad.toolbar.unindent.title": "Rykk ut (Shift+TAB)",
- "pad.toolbar.undo.title": "Angre (Ctrl-Z)",
- "pad.toolbar.redo.title": "Gjør omigjen (Ctrl-Y)",
+ "pad.toolbar.undo.title": "Angre (Ctrl+Z)",
+ "pad.toolbar.redo.title": "Gjør omigjen (Ctrl+Y)",
"pad.toolbar.clearAuthorship.title": "Fjern forfatterfarger (Ctrl+Shift+C)",
"pad.toolbar.import_export.title": "Importer/eksporter fra/til forskjellige filformater",
"pad.toolbar.timeslider.title": "Tidslinje",
"pad.toolbar.savedRevision.title": "Lagre revisjoner",
"pad.toolbar.settings.title": "Innstillinger",
- "pad.toolbar.embed.title": "Bygg inn denne padden",
- "pad.toolbar.showusers.title": "Vis brukerne av denne padden",
+ "pad.toolbar.embed.title": "Del og sett inn denne blokken",
+ "pad.toolbar.showusers.title": "Vis brukerne av denne blokken",
"pad.colorpicker.save": "Lagre",
"pad.colorpicker.cancel": "Avbryt",
- "pad.loading": "Laster inn...",
- "pad.passwordRequired": "Du trenger et passord for å få tilgang til denne padden",
- "pad.permissionDenied": "Du har ikke tilgang til denne padden",
+ "pad.loading": "Laster...",
+ "pad.noCookie": "Kunne ikke finne informasjonskapselen. Vennligst tillat informasjonskapsler (cookies) i din webleser!",
+ "pad.passwordRequired": "Du trenger et passord for å få tilgang til denne blokken",
+ "pad.permissionDenied": "Du har ikke tilgang til denne blokken",
"pad.wrongPassword": "Feil passord",
- "pad.settings.padSettings": "Padinnstillinger",
+ "pad.settings.padSettings": "Blokkinnstillinger",
"pad.settings.myView": "Min visning",
"pad.settings.stickychat": "Chat alltid synlig",
+ "pad.settings.chatandusers": "Vis chat og brukere",
"pad.settings.colorcheck": "Forfatterfarger",
"pad.settings.linenocheck": "Linjenummer",
"pad.settings.rtlcheck": "Les innhold fra høyre til venstre?",
@@ -44,7 +47,8 @@
"pad.importExport.import_export": "Importer/eksporter",
"pad.importExport.import": "Last opp tekstfil eller dokument",
"pad.importExport.importSuccessful": "Vellykket!",
- "pad.importExport.export": "Eksporter padden som:",
+ "pad.importExport.export": "Eksporter blokken som:",
+ "pad.importExport.exportetherpad": "Etherpad",
"pad.importExport.exporthtml": "HTML",
"pad.importExport.exportplain": "Ren tekst",
"pad.importExport.exportword": "Microsoft Word",
@@ -52,10 +56,10 @@
"pad.importExport.exportopen": "ODF (Open Document Format)",
"pad.importExport.abiword.innerHTML": "Du kan bare importere fra ren tekst eller HTML-formater. For mer avanserte importfunksjoner, <a href=\"https://github.com/ether/etherpad-lite/wiki/How-to-enable-importing-and-exporting-different-file-formats-in-Ubuntu-or-OpenSuse-or-SLES-with-AbiWord\">installer abiword</a>.",
"pad.modals.connected": "Tilkoblet.",
- "pad.modals.reconnecting": "Kobler til din pad på nytt...",
+ "pad.modals.reconnecting": "Kobler til din blokk på nytt...",
"pad.modals.forcereconnect": "Tving gjenoppkobling",
"pad.modals.userdup": "Åpnet i nytt vindu",
- "pad.modals.userdup.explanation": "Denne padden ser ut til å være åpnet i mer enn et nettleservindu på denne maskinen.",
+ "pad.modals.userdup.explanation": "Denne blokken ser ut til å være åpnet i mer enn et nettleservindu på denne maskinen.",
"pad.modals.userdup.advice": "Koble til igjen for å bruke dette vinduet i stedenfor.",
"pad.modals.unauth": "Ikke tillatt",
"pad.modals.unauth.explanation": "Dine rettigheter har blitt endret mens du så på denne siden. Prøv å koble til på nytt",
@@ -71,26 +75,29 @@
"pad.modals.corruptPad.explanation": "Blokken du forsøker å få tilgang til er skadet.",
"pad.modals.corruptPad.cause": "Dette kan komme av feil serverkonfigurasjon eller en annen uventet adferd. Vennligst kontakt serviceadministratoren hvis du anser dette å være feil.",
"pad.modals.deleted": "Slettet.",
- "pad.modals.deleted.explanation": "Denne padden har blitt fjernet",
+ "pad.modals.deleted.explanation": "Denne blokken har blitt fjernet",
"pad.modals.disconnected": "Du har blitt frakoblet.",
"pad.modals.disconnected.explanation": "Mistet tilkobling til serveren.",
- "pad.modals.disconnected.cause": "Serveren kan være utilgjengelig. Vennligst si i fra til oss hvis dette fortsetter å skje",
- "pad.share": "Del denne padden",
+ "pad.modals.disconnected.cause": "Serveren kan være utilgjengelig. Vennligst si i fra til oss hvis dette fortsetter å skje.",
+ "pad.share": "Del denne blokken",
"pad.share.readonly": "Skrivebeskyttet",
"pad.share.link": "Lenke",
"pad.share.emebdcode": "URL for innbygging",
"pad.chat": "Chat",
- "pad.chat.title": "Åpne chatten for denne padden.",
+ "pad.chat.title": "Åpne chatten for denne blokken.",
"pad.chat.loadmessages": "Last flere beskjeder",
"timeslider.pageTitle": "{{appTitle}} Tidslinje",
- "timeslider.toolbar.returnbutton": "Gå tilbake til pad",
+ "timeslider.toolbar.returnbutton": "Gå tilbake til blokk",
"timeslider.toolbar.authors": "Forfattere:",
"timeslider.toolbar.authorsList": "Ingen forfattere",
"timeslider.toolbar.exportlink.title": "Eksporter",
"timeslider.exportCurrent": "Eksporter nåværende versjon som:",
"timeslider.version": "Versjon {{version}}",
- "timeslider.saved": "Lagret {{day}} {{month}} {{year}}",
- "timeslider.dateformat": "{{day}}/{{month}}/{{year}} {{hours}}:{{minutes}}:{{seconds}}",
+ "timeslider.saved": "Lagret {{day}}. {{month}} {{year}}",
+ "timeslider.playPause": "Spill av/Pause blokkinnholdet",
+ "timeslider.backRevision": "Gå tilbake en revisjon i denne blokken",
+ "timeslider.forwardRevision": "Gå fremover en revisjon i denne blokken",
+ "timeslider.dateformat": "{{day}}. {{month}} {{year}} {{hours}}:{{minutes}}:{{seconds}}",
"timeslider.month.january": "januar",
"timeslider.month.february": "februar",
"timeslider.month.march": "mars",
@@ -105,6 +112,7 @@
"timeslider.month.december": "desember",
"timeslider.unnamedauthors": "{{num}} navnløse {[plural(num) one: forfatter, other: forfattere ]}",
"pad.savedrevs.marked": "Denne revisjonen er nå markert som en lagret revisjon",
+ "pad.savedrevs.timeslider": "Du kan se lagrede revisjoner med tidslinjen",
"pad.userlist.entername": "Skriv inn ditt navn",
"pad.userlist.unnamed": "navnløs",
"pad.userlist.guest": "Gjest",
@@ -113,8 +121,9 @@
"pad.editbar.clearcolors": "Fjern forfatterfarger på hele dokumentet?",
"pad.impexp.importbutton": "Importer nå",
"pad.impexp.importing": "Importerer...",
- "pad.impexp.confirmimport": "Importering av en fil vil overskrive den nåværende teksten på padden. Er du sikker på at du vil fortsette?",
+ "pad.impexp.confirmimport": "Importering av en fil vil overskrive den nåværende teksten på blokken. Er du sikker på at du vil fortsette?",
"pad.impexp.convertFailed": "Vi greide ikke å importere denne filen. Bruk et annet dokumentformat eller kopier og lim inn teksten manuelt",
+ "pad.impexp.padHasData": "Vi kunne ikke importere denne filen fordi blokken allerede hadde endringer. Importer til en ny blokk.",
"pad.impexp.uploadFailed": "Opplastning feilet. Prøv igjen",
"pad.impexp.importfailed": "Import feilet",
"pad.impexp.copypaste": "Vennligst kopier og lim inn",
diff --git a/src/locales/ps.json b/src/locales/ps.json
index 2c23d1c3..1a877128 100644
--- a/src/locales/ps.json
+++ b/src/locales/ps.json
@@ -8,6 +8,10 @@
"index.createOpenPad": "يا په همدې نوم يوه نوې ليکچه جوړول/پرانيستل:",
"pad.toolbar.bold.title": "زغرد (Ctrl-B)",
"pad.toolbar.italic.title": "رېوند (Ctrl-I)",
+ "pad.toolbar.underline.title": "لرکرښن (Ctrl+U)",
+ "pad.toolbar.strikethrough.title": "کرښکاږلی (Ctrl+5)",
+ "pad.toolbar.ol.title": "ترتيب شوی لړليک (Ctrl+Shift+N)",
+ "pad.toolbar.ul.title": "ناترتيب شوی لړليک (Ctrl+Shift+L)",
"pad.toolbar.undo.title": "ناکړل (Ctrl-Z)",
"pad.toolbar.redo.title": "بياکړل (Ctrl-Y)",
"pad.toolbar.clearAuthorship.title": "د ليکوالۍ رنگونه سپينول (Ctrl+Shift+C)",
@@ -20,13 +24,17 @@
"pad.wrongPassword": "پټنوم مو سم نه و",
"pad.settings.padSettings": "د ليکچې امستنې",
"pad.settings.myView": "زما کتنه",
+ "pad.settings.stickychat": "تل په پردې بانډار کول",
+ "pad.settings.chatandusers": "کارنان او بانډار ښکاره کول",
"pad.settings.colorcheck": "د ليکوالۍ رنگونه",
+ "pad.settings.linenocheck": "د کرښو شمېرې",
"pad.settings.fontType": "ليکبڼې ډول:",
"pad.settings.fontType.normal": "نورمال",
"pad.settings.fontType.monospaced": "مونوسپېس",
"pad.settings.globalView": "نړېواله ښکارېدنه",
"pad.settings.language": "ژبه:",
"pad.importExport.importSuccessful": "بريالی شو!",
+ "pad.importExport.exportetherpad": "اېترپډ",
"pad.importExport.exporthtml": "اچ ټي ام اېل",
"pad.importExport.exportplain": "ساده متن",
"pad.importExport.exportword": "مايکروسافټ ورډ",
@@ -66,5 +74,7 @@
"pad.userlist.guest": "مېلمه",
"pad.userlist.deny": "ردول",
"pad.userlist.approve": "منل",
+ "pad.impexp.importbutton": "اوس واردول",
+ "pad.impexp.importing": "په واردولو کې دی...",
"pad.impexp.copypaste": "لطفاً لمېسل لېښل ترسره کړئ"
}
diff --git a/src/locales/ro.json b/src/locales/ro.json
new file mode 100644
index 00000000..85436dd0
--- /dev/null
+++ b/src/locales/ro.json
@@ -0,0 +1,82 @@
+{
+ "@metadata": {
+ "authors": [
+ "Hedwig",
+ "ImGelu",
+ "Minisarm"
+ ]
+ },
+ "index.newPad": "Pad nou",
+ "index.createOpenPad": "sau creează/deschide un Pad cu numele:",
+ "pad.toolbar.bold.title": "Aldin (Ctrl + B)",
+ "pad.toolbar.italic.title": "Cursiv (Ctrl + I)",
+ "pad.toolbar.underline.title": "Subliniază (Ctrl+U)",
+ "pad.toolbar.strikethrough.title": "Taie (Ctrl+5)",
+ "pad.toolbar.ol.title": "Listă ordonată (Ctrl+Shift+N)",
+ "pad.toolbar.ul.title": "Listă neordonată (Ctrl+Shift+L)",
+ "pad.toolbar.undo.title": "Anulează (Ctrl+Z)",
+ "pad.toolbar.savedRevision.title": "Salvează revizia",
+ "pad.toolbar.settings.title": "Setări",
+ "pad.colorpicker.save": "Salvează",
+ "pad.colorpicker.cancel": "Anulează",
+ "pad.loading": "Se încarcă...",
+ "pad.passwordRequired": "Ai nevoie de o parolă pentru a accesa acest pad",
+ "pad.permissionDenied": "Nu ai permisiunea să accesezi acest pad",
+ "pad.wrongPassword": "Parola ta este greșită",
+ "pad.settings.padSettings": "Setări pentru Pad",
+ "pad.settings.stickychat": "Chat-ul întotdeauna pe ecran",
+ "pad.settings.chatandusers": "Afișează Chat-ul și Utilizatorii",
+ "pad.settings.fontType": "Tipul fontului:",
+ "pad.settings.globalView": "Vedere generală",
+ "pad.settings.language": "Limbă:",
+ "pad.importExport.import": "Încarcă orice fișier text sau document",
+ "pad.importExport.importSuccessful": "Succes!",
+ "pad.importExport.export": "Exportă pad-ul curent ca:",
+ "pad.importExport.exportetherpad": "Etherpad",
+ "pad.importExport.exporthtml": "HTML",
+ "pad.importExport.exportplain": "Text brut",
+ "pad.importExport.exportword": "Microsoft Word",
+ "pad.importExport.exportpdf": "PDF",
+ "pad.importExport.exportopen": "ODF (Open Document Format)",
+ "pad.modals.connected": "Conectat.",
+ "pad.modals.reconnecting": "Se reconectează la pad-ul tău..",
+ "pad.modals.forcereconnect": "Forțează reconectarea",
+ "pad.modals.userdup.advice": "Reconectează pentru a folosi această fereastră în schimb",
+ "pad.modals.unauth": "Nu ești autorizat",
+ "pad.modals.initsocketfail": "Serverul nu este disponibil.",
+ "pad.modals.initsocketfail.explanation": "Nu s-a putut conecta la serverul de sincronizare.",
+ "pad.modals.slowcommit.explanation": "Serverul nu răspunde.",
+ "pad.modals.slowcommit.cause": "Aceasta poate fi cauzată de probleme cu conexiunea la rețea.",
+ "pad.modals.deleted": "Șters.",
+ "pad.modals.deleted.explanation": "Acest pad a fost șters.",
+ "pad.modals.disconnected": "Ai fost deconectat.",
+ "pad.share": "Distribuie acest pad",
+ "pad.share.readonly": "Doar în citire",
+ "pad.share.link": "Legătură",
+ "pad.share.emebdcode": "Încorporează URL-ul",
+ "pad.chat": "Chat",
+ "pad.chat.title": "Deschide chat-ul pentru acest pad.",
+ "pad.chat.loadmessages": "Încarcă mai multe mesaje",
+ "timeslider.toolbar.returnbutton": "Înapoi la pad",
+ "timeslider.toolbar.authors": "Aurori:",
+ "timeslider.toolbar.authorsList": "Niciun autor",
+ "timeslider.toolbar.exportlink.title": "Exportă",
+ "timeslider.exportCurrent": "Exportă versiunea curentă ca:",
+ "timeslider.version": "Versiunea {{version}}",
+ "timeslider.saved": "Salvat pe {{day}} {{month}} {{year}}",
+ "timeslider.dateformat": "{{day}}/{{month}}/{{year}} {{hours}}:{{minutes}}:{{seconds}}",
+ "timeslider.month.january": "ianuarie",
+ "timeslider.month.february": "februarie",
+ "timeslider.month.march": "martie",
+ "timeslider.month.april": "aprilie",
+ "timeslider.month.may": "mai",
+ "timeslider.month.june": "iunie",
+ "timeslider.month.july": "iulie",
+ "timeslider.month.august": "august",
+ "timeslider.month.september": "septembrie",
+ "timeslider.month.october": "octombrie",
+ "timeslider.month.november": "noiembrie",
+ "timeslider.month.december": "decembrie",
+ "pad.userlist.entername": "Introdu numele tău",
+ "pad.userlist.unnamed": "fără nume"
+}
diff --git a/src/locales/sv.json b/src/locales/sv.json
index ae9b1f9a..44df4506 100644
--- a/src/locales/sv.json
+++ b/src/locales/sv.json
@@ -94,6 +94,9 @@
"timeslider.exportCurrent": "Exportera aktuell version som:",
"timeslider.version": "Version {{version}}",
"timeslider.saved": "Sparades den {{day}} {{month}} {{year}}",
+ "timeslider.playPause": "Spela upp/pausa blockets innehåll",
+ "timeslider.backRevision": "Gå tillbaka en version av detta block",
+ "timeslider.forwardRevision": "Gå framåt en version av detta block",
"timeslider.dateformat": "{{day}}/{{month}}/{{year}} {{hours}}:{{minutes}}:{{seconds}}",
"timeslider.month.january": "januari",
"timeslider.month.february": "februari",
diff --git a/src/locales/zh-hans.json b/src/locales/zh-hans.json
index 31b7f7f3..eaa03520 100644
--- a/src/locales/zh-hans.json
+++ b/src/locales/zh-hans.json
@@ -102,6 +102,9 @@
"timeslider.exportCurrent": "当前版本导出为:",
"timeslider.version": "版本 {{version}}",
"timeslider.saved": "在{{year}}年{{month}}{{day}}日保存",
+ "timeslider.playPause": "回放 / 暂停Pad内容",
+ "timeslider.backRevision": "返回此Pad的一次修订",
+ "timeslider.forwardRevision": "前往此Pad的一次修订",
"timeslider.dateformat": "{{year}}年{{month}}月{{day}}日 {{hours}}{{minutes}}{{seconds}}",
"timeslider.month.january": "1月",
"timeslider.month.february": "2月",
diff --git a/src/node/handler/ExportHandler.js b/src/node/handler/ExportHandler.js
index f20e8715..f861c82e 100644
--- a/src/node/handler/ExportHandler.js
+++ b/src/node/handler/ExportHandler.js
@@ -28,6 +28,7 @@ var fs = require("fs");
var settings = require('../utils/Settings');
var os = require('os');
var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks");
+var TidyHtml = require('../utils/TidyHtml');
//load abiword only if its enabled
if(settings.abiword != null)
@@ -35,28 +36,28 @@ if(settings.abiword != null)
var tempDirectory = "/tmp";
-//tempDirectory changes if the operating system is windows
+//tempDirectory changes if the operating system is windows
if(os.type().indexOf("Windows") > -1)
{
tempDirectory = process.env.TEMP;
}
-
+
/**
* do a requested export
- */
+ */
exports.doExport = function(req, res, padId, type)
{
var fileName = padId;
// allow fileName to be overwritten by a hook, the type type is kept static for security reasons
- hooks.aCallFirst("exportFileName", padId,
+ hooks.aCallFirst("exportFileName", padId,
function(err, hookFileName){
// if fileName is set then set it to the padId, note that fileName is returned as an array.
if(hookFileName.length) fileName = hookFileName;
//tell the browser that this is a downloadable file
res.attachment(fileName + "." + type);
-
+
//if this is a plain text export, we can do this directly
// We have to over engineer this because tabs are stored as attributes and not plain text
if(type == "etherpad"){
@@ -72,7 +73,7 @@ exports.doExport = function(req, res, padId, type)
var txt;
var randNum;
var srcFile, destFile;
-
+
async.series([
//render the txt document
function(callback)
@@ -96,7 +97,7 @@ exports.doExport = function(req, res, padId, type)
{
//ensure html can be collected by the garbage collector
txt = null;
-
+
destFile = tempDirectory + "/etherpad_export_" + randNum + "." + type;
abiword.convertFile(srcFile, destFile, type, callback);
},
@@ -140,7 +141,7 @@ exports.doExport = function(req, res, padId, type)
var html;
var randNum;
var srcFile, destFile;
-
+
async.series([
//render the html document
function(callback)
@@ -150,7 +151,7 @@ exports.doExport = function(req, res, padId, type)
if(ERR(err, callback)) return;
html = _html;
callback();
- });
+ });
},
//decide what to do with the html export
function(callback)
@@ -162,22 +163,29 @@ exports.doExport = function(req, res, padId, type)
hooks.aCallFirst("exportHTMLSend", html, function(err, newHTML){
if(newHTML.length) html = newHTML;
res.send(html);
- callback("stop");
+ callback("stop");
});
}
else //write the html export to a file
{
randNum = Math.floor(Math.random()*0xFFFFFFFF);
srcFile = tempDirectory + "/etherpad_export_" + randNum + ".html";
- fs.writeFile(srcFile, html, callback);
+ fs.writeFile(srcFile, html, callback);
}
},
- //send the convert job to abiword
+
+ // Tidy up the exported HTML
function(callback)
{
//ensure html can be collected by the garbage collector
html = null;
-
+
+ TidyHtml.tidy(srcFile, callback);
+ },
+
+ //send the convert job to abiword
+ function(callback)
+ {
destFile = tempDirectory + "/etherpad_export_" + randNum + "." + type;
abiword.convertFile(srcFile, destFile, type, callback);
},
@@ -199,7 +207,7 @@ exports.doExport = function(req, res, padId, type)
//100ms delay to accomidate for slow windows fs
if(os.type().indexOf("Windows") > -1)
{
- setTimeout(function()
+ setTimeout(function()
{
fs.unlink(destFile, callback);
}, 100);
diff --git a/src/node/utils/Settings.js b/src/node/utils/Settings.js
index b7d1f0bc..2cc6a926 100644
--- a/src/node/utils/Settings.js
+++ b/src/node/utils/Settings.js
@@ -153,6 +153,11 @@ exports.minify = true;
exports.abiword = null;
/**
+ * The path of the tidy executable
+ */
+exports.tidyHtml = null;
+
+/**
* Should we support none natively supported file types on import?
*/
exports.allowUnknownFileEnds = true;
@@ -167,7 +172,7 @@ exports.loglevel = "INFO";
*/
exports.disableIPlogging = false;
-/**
+/**
* Disable Load Testing
*/
exports.loadTest = false;
@@ -239,7 +244,7 @@ exports.reloadSettings = function reloadSettings() {
} else {
settingsFilename = path.resolve(path.join(exports.root, settingsFilename));
}
-
+
var settingsStr;
try{
//read the settings sync
diff --git a/src/node/utils/TidyHtml.js b/src/node/utils/TidyHtml.js
new file mode 100644
index 00000000..5d4e6ed7
--- /dev/null
+++ b/src/node/utils/TidyHtml.js
@@ -0,0 +1,41 @@
+/**
+ * Tidy up the HTML in a given file
+ */
+
+var log4js = require('log4js');
+var settings = require('./Settings');
+var spawn = require('child_process').spawn;
+
+exports.tidy = function(srcFile, callback) {
+ var logger = log4js.getLogger('TidyHtml');
+
+ // Don't do anything if Tidy hasn't been enabled
+ if (!settings.tidyHtml) {
+ logger.debug('tidyHtml has not been configured yet, ignoring tidy request');
+ return callback(null);
+ }
+
+ var errMessage = '';
+
+ // Spawn a new tidy instance that cleans up the file inline
+ logger.debug('Tidying ' + srcFile);
+ var tidy = spawn(settings.tidyHtml, ['-modify', srcFile]);
+
+ // Keep track of any error messages
+ tidy.stderr.on('data', function (data) {
+ errMessage += data.toString();
+ });
+
+ // Wait until Tidy is done
+ tidy.on('close', function(code) {
+ // Tidy returns a 0 when no errors occur and a 1 exit code when
+ // the file could be tidied but a few warnings were generated
+ if (code === 0 || code === 1) {
+ logger.debug('Tidied ' + srcFile + ' successfully');
+ return callback(null);
+ } else {
+ logger.error('Failed to tidy ' + srcFile + '\n' + errMessage);
+ return callback('Tidy died with exit code ' + code);
+ }
+ });
+};
diff --git a/tests/backend/specs/api/tidy.js b/tests/backend/specs/api/tidy.js
new file mode 100644
index 00000000..47cb49f6
--- /dev/null
+++ b/tests/backend/specs/api/tidy.js
@@ -0,0 +1,63 @@
+var assert = require('assert')
+ fs = require('fs'),
+ path = require('path'),
+ TidyHtml = null,
+ Settings = null;
+
+var npm = require("../../../../src/node_modules/npm/lib/npm.js");
+
+describe('tidyHtml', function() {
+ before(function(done) {
+ npm.load({}, function(err) {
+ assert.ok(!err);
+ TidyHtml = require('../../../../src/node/utils/TidyHtml');
+ Settings = require('../../../../src/node/utils/Settings');
+ return done()
+ });
+ });
+
+ it('Tidies HTML', function(done) {
+ // If the user hasn't configured Tidy, we skip this tests as it's required for this test
+ if (!Settings.tidyHtml) {
+ this.skip();
+ }
+
+ // Try to tidy up a bad HTML file
+ var tmpDir = process.env.TEMP || "/tmp";
+ var tmpFile = path.join(tmpDir, 'tmp_' + (Math.floor(Math.random() * 1000000)) + '.html')
+ fs.writeFileSync(tmpFile, '<html><body><p>a paragraph</p><li>List without outer UL</li>trailing closing p</p></body></html>');
+ TidyHtml.tidy(tmpFile, function(err){
+ assert.ok(!err);
+
+ // Read the file again
+ var cleanedHtml = fs.readFileSync(tmpFile).toString();
+
+ var expectedHtml = [
+ '<title></title>',
+ '</head>',
+ '<body>',
+ '<p>a paragraph</p>',
+ '<ul>',
+ '<li>List without outer UL</li>',
+ '<li style="list-style: none">trailing closing p</li>',
+ '</ul>',
+ '</body>',
+ '</html>',
+ ].join('\n');
+ assert.notStrictEqual(cleanedHtml.indexOf(expectedHtml), -1);
+ return done();
+ });
+ });
+
+ it('can deal with errors', function(done) {
+ // If the user hasn't configured Tidy, we skip this tests as it's required for this test
+ if (!Settings.tidyHtml) {
+ this.skip();
+ }
+
+ TidyHtml.tidy('/some/none/existing/file.html', function(err) {
+ assert.ok(err);
+ return done();
+ });
+ });
+});