From 19194dea3125e2827c00ff8e8142a2a791c25e7a Mon Sep 17 00:00:00 2001 From: daniel-j Date: Tue, 8 Oct 2019 11:26:52 +0200 Subject: [PATCH] some style fixes --- src/style/style.styl | 31 ++++++++----------------------- src/style/titlestyle.styl | 4 ++-- src/templates.js | 10 +++++++++- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/src/style/style.styl b/src/style/style.styl index fa63f3c..dd0650e 100644 --- a/src/style/style.styl +++ b/src/style/style.styl @@ -2,28 +2,15 @@ @require 'mixins' @require 'reset' -@page { - margin-top: 0.3em; - margin-bottom: 0.2em; -} - body { - background-color: white; - color: black; text-align: justify; - -epub-hyphens: auto; - -webkit-hyphens: auto; - -moz-hyphens: auto; - -ms-hyphens: auto; - hyphens: auto; - - font-kerning: normal; - font-variant: common-ligatures lining-nums; - -webkit-font-feature-settings: "kern", "liga", "clig", "lnum"; - font-feature-settings: "kern", "liga", "clig", "lnum"; + // Ligatures on Kobo + text-rendering: optimizeLegibility; + // Fix for Webkit ereaders with zero margins. Such as Foliate. + -webkit-line-box-contain: block glyphs replaced; } a, u { @@ -31,11 +18,9 @@ a, u { } p { - margin-top: 0; - margin-bottom: 0; + margin: 0; text-indent: 0; - -epub-hyphens: auto; -webkit-hyphens: auto; -moz-hyphens: auto; -ms-hyphens: auto; @@ -48,6 +33,9 @@ p { -webkit-hyphenate-limit-lines: 2; hyphenate-limit-lines: 2; + widows: 1; + orphans: 1; + &.double { margin-top: 1em; } @@ -66,7 +54,6 @@ div p { h1, h2, h3, h4, h5, h6, header { text-align: left !important; adobe-hyphenate: none; - -epub-hyphens: none; -webkit-hyphens: none; -moz-hyphens: none; -ms-hyphens: none; @@ -283,7 +270,6 @@ code { } pre { margin: 1em 0; - -epub-hyphens: none; -webkit-hyphens: none; -moz-hyphens: none; -ms-hyphens: none; @@ -416,4 +402,3 @@ a.chaptercomments { background: -webkit-linear-gradient(top, #7bb042 0%, #6fa03c 100%); background: linear-gradient(to bottom, #7bb042 0%, #6fa03c 100%); } - diff --git a/src/style/titlestyle.styl b/src/style/titlestyle.styl index a126516..a7cfc75 100644 --- a/src/style/titlestyle.styl +++ b/src/style/titlestyle.styl @@ -13,7 +13,7 @@ .story_name { font-size: 1.5em; - color: #222; + opacity: 0.85; font-weight: bold; font-style: italic; } @@ -21,7 +21,7 @@ .author { margin: 0; font-size: 0.97em; - color: #444; + opacity: 0.75; font-weight: normal; display: inline-block; diff --git a/src/templates.js b/src/templates.js index e6f60ad..6947235 100644 --- a/src/templates.js +++ b/src/templates.js @@ -16,12 +16,14 @@ function nth (d) { } } -function prettyDate (d) { +export function prettyDate (d) { // format: 27th Oct 2011 let months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] return d.getDate() + nth(d) + ' ' + months[d.getMonth()].substring(0, 3) + ' ' + d.getFullYear() } +const metaGenerator = () => m('meta', { name: 'generator', content: 'Generated by fimfic2epub v' + FIMFIC2EPUB_VERSION + ' at ' + prettyDate(new Date()) }) + function chapterBars (chapters, currentChapter = -1, highlightCurrent = false) { if (chapters.length <= 1) return null let windowSize = 50 @@ -87,6 +89,7 @@ export function createChapter (ffc, ch, isNotesChapter) { m('html', { xmlns: NS.XHTML, 'xmlns:epub': NS.OPS, lang: 'en' }, [ m('head', [ m('meta', { charset: 'utf-8' }), + metaGenerator(), m('link', { rel: 'stylesheet', type: 'text/css', href: '../Styles/style.css' }), m('title', title) ]), @@ -312,6 +315,7 @@ export function createNav (ffc) { m('html', { xmlns: NS.XHTML, 'xmlns:epub': NS.OPS, lang: 'en' }, [ m('head', [ m('meta', { charset: 'utf-8' }), + metaGenerator(), m('link', { rel: 'stylesheet', type: 'text/css', href: 'Styles/style.css' }), m('link', { rel: 'stylesheet', type: 'text/css', href: 'Styles/navstyle.css' }), m('title', 'Contents') @@ -339,6 +343,7 @@ export function createNotesNav (ffc) { m('html', { xmlns: NS.XHTML, 'xmlns:epub': NS.OPS, lang: 'en' }, [ m('head', [ m('meta', { charset: 'utf-8' }), + metaGenerator(), m('link', { rel: 'stylesheet', type: 'text/css', href: 'Styles/style.css' }), m('link', { rel: 'stylesheet', type: 'text/css', href: 'Styles/navstyle.css' }), m('title', 'Author\'s Notes') @@ -373,6 +378,8 @@ export function createCoverPage (ffc) { return render( m('html', { xmlns: NS.XHTML, 'xmlns:epub': NS.OPS, lang: 'en' }, [ m('head', [ + m('meta', { charset: 'utf-8' }), + metaGenerator(), ffc.coverImage ? m('meta', { name: 'viewport', content: 'width=' + width + ', height=' + height }) : null, m('title', 'Cover'), m('link', { rel: 'stylesheet', type: 'text/css', href: '../Styles/coverstyle.css' }) @@ -428,6 +435,7 @@ export function createTitlePage (ffc) { m('html', { xmlns: NS.XHTML, 'xmlns:epub': NS.OPS, lang: 'en' }, [ m('head', [ m('meta', { charset: 'utf-8' }), + metaGenerator(), m('link', { rel: 'stylesheet', type: 'text/css', href: '../Styles/style.css' }), m('link', { rel: 'stylesheet', type: 'text/css', href: '../Styles/titlestyle.css' }), m('title', ffc.storyInfo.title)