diff --git a/packages/better-write-languages/src/en-US/toast.ts b/packages/better-write-languages/src/en-US/toast.ts
index 184641c37..9a7d1df0a 100644
--- a/packages/better-write-languages/src/en-US/toast.ts
+++ b/packages/better-write-languages/src/en-US/toast.ts
@@ -52,6 +52,9 @@ export default {
txt: {
generate: 'Successfully Downloaded TXT!',
},
+ epub: {
+ generate: 'Successfully Downloaded EPUB!',
+ },
annotations: {
fileDelete: 'Are you sure you want to delete the file?',
folderDelete: 'Are you sure you want to delete the folder?',
diff --git a/packages/better-write-languages/src/pt-BR/toast.ts b/packages/better-write-languages/src/pt-BR/toast.ts
index 3d2b3a433..1a721b5f2 100644
--- a/packages/better-write-languages/src/pt-BR/toast.ts
+++ b/packages/better-write-languages/src/pt-BR/toast.ts
@@ -50,6 +50,9 @@ export default {
txt: {
generate: 'TXT Baixado com Sucesso!',
},
+ epub: {
+ generate: 'EPUB Baixado com Sucesso!',
+ },
html: {
generate: 'HTML Baixado com Sucesso!',
},
diff --git a/packages/better-write-plugin-exporter-epub/src/set.ts b/packages/better-write-plugin-exporter-epub/src/set.ts
index 3e53b7254..d5f889c6b 100644
--- a/packages/better-write-plugin-exporter-epub/src/set.ts
+++ b/packages/better-write-plugin-exporter-epub/src/set.ts
@@ -23,6 +23,31 @@ export const PluginEpubSet = (
return `
${hooks.substitution.purge(entity.raw)}
`
}
+ const image = (entity: Entity) => {
+ return ``
+ }
+
+ const svg = (entity: Entity) => {
+ console.log(entity.raw)
+
+ return `${entity.raw}
`
+ }
+
+ const checkbox = (entity: Entity) => {
+ const id = hooks.utils.id().uuidv4()
+
+ return `
+
`
+ }
+
+ const list = (entity: Entity) => {
+ return `- ${hooks.substitution.purge(
+ entity.raw
+ )}
`
+ }
+
const paragraph = (entity: Entity): string[] => {
if (
hooks.env.emptyLine() === entity.raw ||
@@ -35,17 +60,30 @@ export const PluginEpubSet = (
const target = parse(hooks.substitution.purge(row))
return target.reduce((acc, item) => {
+ // boldItalics
+ if (item.italic && item.bold)
+ return (acc += item.text.trim() ? `${item.text}` : '')
+
+ // italics
+ if (item.italic)
+ return (acc += item.text.trim() ? `${item.text}` : '')
+
+ // bold
+ if (item.bold)
+ return (acc += item.text.trim() ? `${item.text}` : '')
+
+ // common case
return (acc += item.text.trim() ? `${item.text}` : '')
}, '')
})
}
const pageBreak = () => {
- return ``
+ return ``
}
const lineBreak = () => {
- return ''
+ return ''
}
return {
@@ -53,6 +91,10 @@ export const PluginEpubSet = (
headingOne,
headingTwo,
headingThree,
+ image,
+ svg,
+ checkbox,
+ list,
pageBreak,
lineBreak,
}
@@ -67,11 +109,15 @@ export const PluginEpubSet = (
content: '',
}
- page.entities.forEach((entity: Entity) => {
+ for (const entity of page.entities) {
switch (entity.type) {
- case 'paragraph':
- case 'list':
case 'checkbox':
+ chapter.content += entities().checkbox(entity)
+ break
+ case 'list':
+ chapter.content += entities().list(entity)
+ break
+ case 'paragraph':
entities()
.paragraph(entity)
?.forEach(
@@ -93,8 +139,14 @@ export const PluginEpubSet = (
case 'line-break':
chapter.content += entities().lineBreak()
break
+ case 'image':
+ chapter.content += entities().image(entity)
+ break
+ case 'drau':
+ chapter.content += entities().svg(entity)
+ break
}
- })
+ }
chapters.push(chapter)
})
diff --git a/packages/better-write-plugin-exporter-epub/src/styles.ts b/packages/better-write-plugin-exporter-epub/src/styles.ts
index 56ea2f937..fcf567e0e 100644
--- a/packages/better-write-plugin-exporter-epub/src/styles.ts
+++ b/packages/better-write-plugin-exporter-epub/src/styles.ts
@@ -9,6 +9,7 @@ export const getStyles = (
outline: 0;
font-feature-settings: 'ss02' on, 'ss01' on;
-webkit-font-smoothing: antialiased;
+ color: black;
}
p {
@@ -24,4 +25,12 @@ p > a {
h1, h2, h3 {
text-align: center;
+}
+
+i {
+ font-style: italic;
+}
+
+b {
+ font-weight: 700;
}`