mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-27 10:56:16 -04:00
LibreOffice: use filter XHTML Writer File during import
ImportHandler: remove self-closing title element
This commit is contained in:
parent
d075daf166
commit
2d01f4cd8b
3 changed files with 11 additions and 4 deletions
|
@ -211,9 +211,15 @@ async function doImport(req, res, padId)
|
|||
* Moreover, when using LibreOffice to convert the file, some classes are
|
||||
* added to the <title> tag. This is a quick & dirty way of matching the
|
||||
* title and comment it out independently on the classes that are set on it.
|
||||
*
|
||||
* @todo what happens if <title is used somewhere in the pad? need proper XML parser
|
||||
*/
|
||||
text = text.replace("<title", "<!-- <title");
|
||||
text = text.replace("</title>","</title>-->");
|
||||
if (text.match(/<\/title>/)){
|
||||
text = text.replace("<title", "<!-- <title");
|
||||
text = text.replace("</title>","</title>-->");
|
||||
} else {
|
||||
text = text.replace(/<title[^>]*\/>/,'');
|
||||
}
|
||||
|
||||
// node on windows has a delay on releasing of the file lock.
|
||||
// We add a 100ms delay to work around this
|
||||
|
|
|
@ -85,7 +85,8 @@ function doConvertTask(task, callback) {
|
|||
'--nologo',
|
||||
'--nolockcheck',
|
||||
'--writer',
|
||||
'--convert-to', task.type,
|
||||
'--convert-to',
|
||||
`${task.type}:XHTML Writer File:UTF8`,
|
||||
task.srcFile,
|
||||
'--outdir', tmpDir
|
||||
]);
|
||||
|
|
|
@ -108,7 +108,7 @@ describe('getText', function(){
|
|||
setTimeout(function(){
|
||||
api.get(endPoint('getText')+"&padID="+testPadId)
|
||||
.expect(function(res){
|
||||
if(res.body.data.text.indexOf("RichardC. Hay" !== -1)){
|
||||
if(res.body.data.text.indexOf("RichardC. Hay") !== -1) {
|
||||
console.warn(res.body.data.text);
|
||||
throw new Error("Error with doc keeping spaces", res.body.data.text);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue