diff --git a/fiduswriter/book/static/js/modules/books/exporter/dom_export.js b/fiduswriter/book/static/js/modules/books/exporter/epub/dom_export.js similarity index 96% rename from fiduswriter/book/static/js/modules/books/exporter/dom_export.js rename to fiduswriter/book/static/js/modules/books/exporter/epub/dom_export.js index a790e2a..0098ce5 100644 --- a/fiduswriter/book/static/js/modules/books/exporter/dom_export.js +++ b/fiduswriter/book/static/js/modules/books/exporter/epub/dom_export.js @@ -1,18 +1,18 @@ import {DOMSerializer} from "prosemirror-model" -import {RenderCitations} from "../../citations/render" -import {get} from "../../common" -import {BIBLIOGRAPHY_HEADERS, CATS} from "../../schema/i18n" +import {RenderCitations} from "../../../citations/render" +import {get} from "../../../common" +import {BIBLIOGRAPHY_HEADERS, CATS} from "../../../schema/i18n" /* WARNING: DEPRECATED! Base exporter class for dom-based exports. This is the deprecated way of creating exports. -The epub and html book export filters go over a DOM of a document which they change little -by little, and they are all based on the BaseDOMExporter class. +The epub book export filter goes over a DOM of a document which they change little +by little, and it is based on the DOMExporter class. New exporters should instead by walking the doc.content tree. - This is how all document exporters work, including the new HTML/EPUB exporter. + This is how all document exporters work, including the new EPUB exporter. */ export class DOMExporter { diff --git a/fiduswriter/book/static/js/modules/books/exporter/epub/index.js b/fiduswriter/book/static/js/modules/books/exporter/epub/index.js index 4e4bd27..d4c06a0 100644 --- a/fiduswriter/book/static/js/modules/books/exporter/epub/index.js +++ b/fiduswriter/book/static/js/modules/books/exporter/epub/index.js @@ -6,8 +6,8 @@ import {getTimestamp} from "../../../exporter/epub/tools" import {mathliveOpfIncludes} from "../../../mathlive/opf_includes" import {BIBLIOGRAPHY_HEADERS} from "../../../schema/i18n" import {bookTerm} from "../../i18n" -import {DOMExporter} from "../dom_export" -import {getMissingChapterData, uniqueObjects} from "../tools" +import {getMissingChapterData} from "../tools" +import {DOMExporter} from "./dom_export" import { epubBookCopyrightTemplate, epubBookCoverTemplate, @@ -22,7 +22,8 @@ import { modifyImages, orderLinks, setLinks, - styleEpubFootnotes + styleEpubFootnotes, + uniqueObjects } from "./tools" import {RenderCitations} from "../../../citations/render" diff --git a/fiduswriter/book/static/js/modules/books/exporter/epub/tools.js b/fiduswriter/book/static/js/modules/books/exporter/epub/tools.js index 968ed2f..6b6b809 100644 --- a/fiduswriter/book/static/js/modules/books/exporter/epub/tools.js +++ b/fiduswriter/book/static/js/modules/books/exporter/epub/tools.js @@ -165,3 +165,22 @@ export const modifyImages = htmlEl => { return images } + +export const uniqueObjects = array => { + const results = [] + + for (let i = 0; i < array.length; i++) { + let willCopy = true + for (let j = 0; j < i; j++) { + if (JSON.stringify(array[i]) === JSON.stringify(array[j])) { + willCopy = false + break + } + } + if (willCopy) { + results.push(array[i]) + } + } + + return results +} diff --git a/fiduswriter/book/static/js/modules/books/exporter/tools.js b/fiduswriter/book/static/js/modules/books/exporter/tools.js index 2ff1a8f..3ba0e37 100644 --- a/fiduswriter/book/static/js/modules/books/exporter/tools.js +++ b/fiduswriter/book/static/js/modules/books/exporter/tools.js @@ -34,22 +34,3 @@ export const getMissingChapterData = ( ) return returnData } - -export const uniqueObjects = array => { - const results = [] - - for (let i = 0; i < array.length; i++) { - let willCopy = true - for (let j = 0; j < i; j++) { - if (JSON.stringify(array[i]) === JSON.stringify(array[j])) { - willCopy = false - break - } - } - if (willCopy) { - results.push(array[i]) - } - } - - return results -}