-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
register importers in app, allow both text and binary import formats, f…
- Loading branch information
1 parent
cc622a0
commit 4ece30f
Showing
7 changed files
with
86 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import {getJson} from "../common" | ||
|
||
import {formats} from "./constants" | ||
import {PandocConversionImporter} from "./importer" | ||
|
||
import {registerImporter} from "../importer/register" | ||
|
||
export class AppPandoc { | ||
constructor(app) { | ||
this.app = app | ||
|
||
this.pandocAvailable = null | ||
} | ||
|
||
init() { | ||
this.checkPandoc().then(() => { | ||
if (this.pandocAvailable) { | ||
registerImporter( | ||
formats.map(format => [format[0], format[1]]), | ||
PandocConversionImporter | ||
) | ||
} | ||
}) | ||
} | ||
|
||
checkPandoc() { | ||
if (this.pandocAvailable !== null) { | ||
return Promise.resolve(this.pandocAvailable) | ||
} | ||
|
||
return getJson("/api/pandoc/available/").then(({available}) => { | ||
this.pandocAvailable = available | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
export const formats = [ | ||
"docx", | ||
"odt", | ||
"doc", | ||
"latex", | ||
"markdown", | ||
"mediawiki", | ||
"org", | ||
"rst", | ||
"textile", | ||
"html", | ||
"json", | ||
"zip" | ||
// file formats that can be converted by pandoc | ||
// see https://pandoc.org/MANUAL.html#general-options | ||
// for a list of supported formats. | ||
// The first element is the format as presented to the user, | ||
// the second element is the file extensions. | ||
// the third element is the format as used by pandoc, | ||
// the fourth element is whether it is a binary format. | ||
["DOCX", ["docx"], "docx", true], | ||
["LaTeX", ["tex"], "latex", false], | ||
["Markdown", ["md"], "markdown", false], | ||
["JATS XML", ["xml"], "jats", false], | ||
["Emacs Org Mode", ["org"], "org", false], | ||
["reStructuredText", ["rst"], "rst", false], | ||
["Textile", ["textile"], "textile", false], | ||
["HTML", ["html", "htm"], "html", false], | ||
["EPUB", ["epub"], "epub", true] | ||
] |
55 changes: 0 additions & 55 deletions
55
fiduswriter/pandoc/static/js/modules/pandoc/document_overview.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {AppPandoc} from "../../modules/pandoc/app" |
1 change: 0 additions & 1 deletion
1
fiduswriter/pandoc/static/js/plugins/documents_overview/pandoc.js
This file was deleted.
Oops, something went wrong.