diff --git a/extension/manifest.json b/extension/manifest.json index 16cbf2f..15b3424 100644 --- a/extension/manifest.json +++ b/extension/manifest.json @@ -4,7 +4,7 @@ "name": "fimfic2epub", "short_name": "fimfic2epub", "description": "Improved EPUB exporter for Fimfiction", - "version": "1.4.9", + "version": "1.5.0", "icons": { "128": "icon-128.png" diff --git a/package.json b/package.json index f93b2ab..e2787cd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fimfic2epub", - "version": "1.4.9", + "version": "1.5.0", "description": "Tool to generate improved EPUB ebooks from Fimfiction stories", "author": "djazz", "repository": { diff --git a/src/cleanMarkup.js b/src/cleanMarkup.js index 032d3e9..43e5cd3 100644 --- a/src/cleanMarkup.js +++ b/src/cleanMarkup.js @@ -20,13 +20,8 @@ export function cleanMarkup (html) { } return new Promise((resolve, reject) => { - // replace HTML non-breaking spaces with normal spaces - html = html.replace(/ /g, ' ') - html = fixParagraphIndent(html) - html = fixDoubleSpacing(html) - // fix center tags html = html.replace(/
') html = html.replace(/<\/center>/g, '
') @@ -108,6 +103,12 @@ export function cleanMarkup (html) { function continueParsing () { html = tidy(html, tidyOptions).trim() + // replace HTML non-breaking spaces with normal spaces + html = html.replace(/ /g, ' ') + html = html.replace(/ /g, ' ') + + html = fixDoubleSpacing(html) + resolve(html) } }) diff --git a/src/constants.js b/src/constants.js index b502688..8529626 100644 --- a/src/constants.js +++ b/src/constants.js @@ -16,7 +16,6 @@ export const tidyOptions = { 'alt-text': 'Image', 'wrap': '0', 'quiet': 'yes', - 'show-warnings': 0, 'newline': 'LF', 'tidy-mark': 'no', 'show-body-only': 'auto' diff --git a/src/same.xhtml b/src/same.xhtml new file mode 100644 index 0000000..99d86bd --- /dev/null +++ b/src/same.xhtml @@ -0,0 +1,125 @@ +This chapter is designed to test the capabilities of various ePub extraction tools against each BBCode tag supported by FIMFiction.net. First of all, note that this paragraph begins with a tab indent—many tools will remove this. Next, here is the set of non-ANSI characters that I frequently use in my stories: “” ‘’ — … (smart double quotes, smart single quotes, em-dash, and ellipses).
+Next are the tags that should work in-line: [b]
+ bold[/b], [i]
+ italics[/i], [u]
+ underline[/u], [s]
+ strikethrough[/s], [smcaps]
+ small caps[/smcaps], [spoiler]
+ spoiler text[/spoiler], [url]
+ hyperlink[/url], [email]
+ user@server.com[/email], and finally an in-line image: [img]
+ [/img].
+
+ There's a known bug in translating FIMFiction stories where consecutive italicized paragraphs lose the italics after the first paragraph. Well, this paragraph is supposed to be italicized. +
++ And so is this one. +
++ And ending with this one. +
+Let’s quickly step through all of the named color tags: + red, + silver, + orange, + yellow, + brown, + green, + olive, + cornflowerblue, + cyan, + purple, + pink, + hotpink, + lime, + white (white), + lightgrey, + indigo, + darkblue, + lightblue, + blue, + gold, + navy, + chartreuse, and + teal. Here are some of the colors I use to code character's thoughts in my “Thought Experiments” series: + #0077D0 for Vinyl Scratch, + #60BB50 for Spike, + purple for Twilight Sparkle, + hotpink for Pinkie Pie, and + darkblue for Rainbow Dash. +
+Size can be indicated by either an absolute number, or in "ems", which is a percentage scaling:
+[size=24] + Size 24, which should be normal-size text for default settings[/size] +
+[size=12] + Size 12, which should be half-size text for default settings[/size] +
+[size=48] + Size 48, which should be double-size text for default settings[/size] +
+[size=1em] + 1 em text[/size] +
+[size=.5em] + 0.5 em text[/size] +
+[size=2em] + 2 em text[/size] +
++
Just above this paragraph should be a horizontal rule, or [hr] tag.
++
[center]Centered text[/center]
++
+
+[quote] This is a quote. + + ++One big problem I've found with ePub extractors is handling multiple-paragraph quotes. This paragraph should still be inside the above quote tag.
++
[center]Centered in the quote.[/center]
+[/quote]
+
+
Here's an image all by itself:
+
+
+
Here's a YouTube video:
++
+
+
+[left_insert]This creates left-aligned text that wraps at the center of the screen. Here's some + lorum ipsum to demonstrate line-wrapping: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + + ++Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.[/left_insert]
+
+
+[right_insert]This creates left-aligned text starting at the center of the screen. Here's some + lorum ipsum to demonstrate line-wrapping: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + + ++Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.[/right_insert]
+
+
This chapter is designed to test the capabilities of various ePub extraction tools against each BBCode tag supported by FIMFiction.net. First of all, note that this paragraph begins with a tab indent—many tools will remove this. Next, here is the set of non-ANSI characters that I frequently use in my stories: “” ‘’ — … (smart double quotes, smart single quotes, em-dash, and ellipses).
+Next are the tags that should work in-line: [b]
+ bold[/b], [i]
+ italics[/i], [u]
+ underline[/u], [s]
+ strikethrough[/s], [smcaps]
+ small caps[/smcaps], [spoiler]
+ spoiler text[/spoiler], [url]
+ hyperlink[/url], [email]
+ user@server.com[/email], and finally an in-line image: [img]
+ [/img].
+
+ There's a known bug in translating FIMFiction stories where consecutive italicized paragraphs lose the italics after the first paragraph. Well, this paragraph is supposed to be italicized. +
++ And so is this one. +
++ And ending with this one. +
+Let’s quickly step through all of the named color tags: + red, + silver, + orange, + yellow, + brown, + green, + olive, + cornflowerblue, + cyan, + purple, + pink, + hotpink, + lime, + white (white), + lightgrey, + indigo, + darkblue, + lightblue, + blue, + gold, + navy, + chartreuse, and + teal. Here are some of the colors I use to code character's thoughts in my “Thought Experiments” series: + #0077D0 for Vinyl Scratch, + #60BB50 for Spike, + purple for Twilight Sparkle, + hotpink for Pinkie Pie, and + darkblue for Rainbow Dash. +
+Size can be indicated by either an absolute number, or in "ems", which is a percentage scaling:
+[size=24] + Size 24, which should be normal-size text for default settings[/size] +
+[size=12] + Size 12, which should be half-size text for default settings[/size] +
+[size=48] + Size 48, which should be double-size text for default settings[/size] +
+[size=1em] + 1 em text[/size] +
+[size=.5em] + 0.5 em text[/size] +
+[size=2em] + 2 em text[/size] +
+ +Just above this paragraph should be a horizontal rule, or [hr] tag.
+ +[center]Centered text[/center]
+ ++[quote] This is a quote. + + ++ +One big problem I've found with ePub extractors is handling multiple-paragraph quotes. This paragraph should still be inside the above quote tag.
+ +[center]Centered in the quote.[/center]
+[/quote]
+
Here's an image all by itself:
+
+
+
Here's a YouTube video:
+ ++[left_insert]This creates left-aligned text that wraps at the center of the screen. Here's some + lorum ipsum to demonstrate line-wrapping: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + + ++ +Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.[/left_insert]
+
+[right_insert]This creates left-aligned text starting at the center of the screen. Here's some + lorum ipsum to demonstrate line-wrapping: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + + ++ +Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.[/right_insert]
+