mirror of
https://github.com/daniel-j/fimfic2epub.git
synced 2024-09-30 00:56:13 +13:00
make small caps more backwards-compatible
This commit is contained in:
parent
c2e11b3f6d
commit
0e3553c44e
2 changed files with 28 additions and 9 deletions
|
@ -18,18 +18,19 @@ export async function cleanMarkup (html) {
|
||||||
html = twemoji.parse(html, {ext: '.svg', folder: 'svg'})
|
html = twemoji.parse(html, {ext: '.svg', folder: 'svg'})
|
||||||
|
|
||||||
// replace HTML entities with decimal entities
|
// replace HTML entities with decimal entities
|
||||||
html = html.replace(/\xA0/g, ' ')
|
html = html.replace(/\xA0/ig, ' ')
|
||||||
html = html.replace(/ /g, ' ')
|
html = html.replace(/ /ig, ' ')
|
||||||
html = html.replace(/ /g, ' ')
|
html = html.replace(/ /ig, ' ')
|
||||||
|
|
||||||
// fix some tags
|
// fix some tags
|
||||||
html = html.replace(/<u>/g, '<span style="text-decoration: underline">')
|
html = html.replace(/<u>/ig, '<span style="text-decoration: underline">')
|
||||||
html = html.replace(/<\/u>/g, '</span>')
|
html = html.replace(/<\/u>/ig, '</span>')
|
||||||
html = html.replace(/<s>/g, '<span style="text-decoration: line-through">')
|
html = html.replace(/<s>/ig, '<span style="text-decoration: line-through">')
|
||||||
html = html.replace(/<\/s>/g, '</span>')
|
html = html.replace(/<\/s>/ig, '</span>')
|
||||||
|
html = html.replace(/<span style="font-variant-caps:small-caps">/ig, '<span class="smcp">')
|
||||||
|
|
||||||
html = html.replace(/<p>\s*/g, '<p>')
|
html = html.replace(/<p>\s*/ig, '<p>')
|
||||||
html = html.replace(/\s*<\/p>/g, '</p>')
|
html = html.replace(/\s*<\/p>/ig, '</p>')
|
||||||
|
|
||||||
// html = fixParagraphIndent(html)
|
// html = fixParagraphIndent(html)
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,24 @@ em em {
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.smcp {
|
||||||
|
font-variant: small-caps;
|
||||||
|
}
|
||||||
|
@supports not (font-variant-caps: small-caps) {
|
||||||
|
.smcp {
|
||||||
|
font-variant: normal;
|
||||||
|
-webkit-font-feature-settings: 'smcp', 'onum';
|
||||||
|
font-feature-settings: 'smcp', 'onum';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@supports (font-variant-caps: small-caps) {
|
||||||
|
.smcp {
|
||||||
|
font-variant: normal;
|
||||||
|
font-variant-caps: small-caps;
|
||||||
|
font-variant-numeric: oldstyle-nums;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.chapter-title {
|
.chapter-title {
|
||||||
padding-top: 0.5em;
|
padding-top: 0.5em;
|
||||||
margin-bottom: 1.5em;
|
margin-bottom: 1.5em;
|
||||||
|
|
Loading…
Reference in a new issue