mirror of
https://github.com/daniel-j/fimfic2epub.git
synced 2024-06-28 19:10:17 +12:00
replace smartypants with typogr, disable typogrify by default
This commit is contained in:
parent
37f320ca26
commit
a0bd04a323
|
@ -39,9 +39,9 @@
|
||||||
"pretty-data": "^0.40.0",
|
"pretty-data": "^0.40.0",
|
||||||
"request": "^2.85.0",
|
"request": "^2.85.0",
|
||||||
"sanitize-filename": "^1.6.0",
|
"sanitize-filename": "^1.6.0",
|
||||||
"smartypants": "0.0.5",
|
|
||||||
"syllable": "^3.0.0",
|
"syllable": "^3.0.0",
|
||||||
"twemoji": "^2.5.0",
|
"twemoji": "^2.5.0",
|
||||||
|
"typogr": "^0.6.7",
|
||||||
"url-regex": "^4.1.1",
|
"url-regex": "^4.1.1",
|
||||||
"zero-fill": "^2.2.3"
|
"zero-fill": "^2.2.3"
|
||||||
},
|
},
|
||||||
|
|
|
@ -10,7 +10,7 @@ import fileType from 'file-type'
|
||||||
import isSvg from 'is-svg'
|
import isSvg from 'is-svg'
|
||||||
import sizeOf from 'image-size'
|
import sizeOf from 'image-size'
|
||||||
import EventEmitter from 'events'
|
import EventEmitter from 'events'
|
||||||
import { smartypantsu } from 'smartypants'
|
import typogr from 'typogr'
|
||||||
|
|
||||||
import { cleanMarkup } from './cleanMarkup'
|
import { cleanMarkup } from './cleanMarkup'
|
||||||
import fetch from './fetch'
|
import fetch from './fetch'
|
||||||
|
@ -90,7 +90,7 @@ class FimFic2Epub extends EventEmitter {
|
||||||
this.storyId = FimFic2Epub.getStoryId(storyId)
|
this.storyId = FimFic2Epub.getStoryId(storyId)
|
||||||
|
|
||||||
this.defaultOptions = {
|
this.defaultOptions = {
|
||||||
typogrify: true,
|
typogrify: false,
|
||||||
addCommentsLink: true,
|
addCommentsLink: true,
|
||||||
includeAuthorNotes: true,
|
includeAuthorNotes: true,
|
||||||
useAuthorNotesIndex: false,
|
useAuthorNotesIndex: false,
|
||||||
|
@ -374,7 +374,7 @@ class FimFic2Epub extends EventEmitter {
|
||||||
let chapter = this.chapters[i]
|
let chapter = this.chapters[i]
|
||||||
let content = chapter.content
|
let content = chapter.content
|
||||||
if (this.options.typogrify) {
|
if (this.options.typogrify) {
|
||||||
content = smartypantsu(content.replace(/"|”|“/g, '"').replace(/\.\.+/g, '...'), 'qde')
|
content = typogr(content.replace(/"/ig, '"').replace(/\.\.\.+/ig, '...')).chain().widont().smartypants().ord().value()
|
||||||
}
|
}
|
||||||
|
|
||||||
chain = chain.then(template.createChapter.bind(null, this, {
|
chain = chain.then(template.createChapter.bind(null, this, {
|
||||||
|
|
|
@ -6,7 +6,7 @@ const args = require('commander')
|
||||||
.option('-d, --dir <path>', 'Directory to store ebook in. Is prepended to filename')
|
.option('-d, --dir <path>', 'Directory to store ebook in. Is prepended to filename')
|
||||||
.option('-t, --title <value>', 'Set the title of the story')
|
.option('-t, --title <value>', 'Set the title of the story')
|
||||||
.option('-a, --author <value>', 'Set the author of the story')
|
.option('-a, --author <value>', 'Set the author of the story')
|
||||||
.option('-T, --no-typogrify', 'Disable typographic fixes (smartypants)')
|
.option('-T, --typogrify', 'Enable typographic fixes (smart quotes, dashes, ellipsis, ordinal)')
|
||||||
.option('-c, --no-comments-link', 'Don\'t add link to online comments')
|
.option('-c, --no-comments-link', 'Don\'t add link to online comments')
|
||||||
.option('-H, --no-headings', 'Don\'t add headings to chapters')
|
.option('-H, --no-headings', 'Don\'t add headings to chapters')
|
||||||
.option('-b, --no-bars', 'Don\'t add chapter bars to show reading progress')
|
.option('-b, --no-bars', 'Don\'t add chapter bars to show reading progress')
|
||||||
|
|
|
@ -253,7 +253,7 @@ let dialog = {
|
||||||
], ctrl.paragraphStyle()))
|
], ctrl.paragraphStyle()))
|
||||||
)),
|
)),
|
||||||
m('tr', m('td.label', ''), m('td', {colspan: 2},
|
m('tr', m('td.label', ''), m('td', {colspan: 2},
|
||||||
m(checkbox, {checked: ctrl.typogrify(), onchange: m.withAttr('checked', ctrl.typogrify)}, 'Apply typographic fixes (smartypants)'),
|
m(checkbox, {checked: ctrl.typogrify(), onchange: m.withAttr('checked', ctrl.typogrify)}, 'Apply typographic fixes (smart quotes, dashes etc.)'),
|
||||||
m(checkbox, {checked: ctrl.addChapterHeadings(), onchange: m.withAttr('checked', ctrl.addChapterHeadings)}, 'Add chapter headings, with chapter word count and time to read'),
|
m(checkbox, {checked: ctrl.addChapterHeadings(), onchange: m.withAttr('checked', ctrl.addChapterHeadings)}, 'Add chapter headings, with chapter word count and time to read'),
|
||||||
m(checkbox, {checked: ctrl.addCommentsLink(), onchange: m.withAttr('checked', ctrl.addCommentsLink)}, 'Add link to online comments (at the end of chapters)'),
|
m(checkbox, {checked: ctrl.addCommentsLink(), onchange: m.withAttr('checked', ctrl.addCommentsLink)}, 'Add link to online comments (at the end of chapters)'),
|
||||||
m(checkbox, {checked: ctrl.includeAuthorNotes(), onchange: m.withAttr('checked', ctrl.includeAuthorNotes)}, 'Include author\'s notes'),
|
m(checkbox, {checked: ctrl.includeAuthorNotes(), onchange: m.withAttr('checked', ctrl.includeAuthorNotes)}, 'Include author\'s notes'),
|
||||||
|
|
|
@ -219,7 +219,7 @@ sub {
|
||||||
vertical-align: sub;
|
vertical-align: sub;
|
||||||
vertical-align: -20%;
|
vertical-align: -20%;
|
||||||
}
|
}
|
||||||
sup {
|
sup, span.ord {
|
||||||
font-size: 0.675em;
|
font-size: 0.675em;
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
vertical-align: super;
|
vertical-align: super;
|
||||||
|
|
Loading…
Reference in a new issue