mirror of
https://github.com/daniel-j/fimfic2epub.git
synced 2024-06-25 01:21:15 +12:00
make small caps more backwards-compatible
This commit is contained in:
parent
c2e11b3f6d
commit
0e3553c44e
|
@ -18,18 +18,19 @@ export async function cleanMarkup (html) {
|
|||
html = twemoji.parse(html, {ext: '.svg', folder: 'svg'})
|
||||
|
||||
// replace HTML entities with decimal entities
|
||||
html = html.replace(/\xA0/g, ' ')
|
||||
html = html.replace(/ /g, ' ')
|
||||
html = html.replace(/ /g, ' ')
|
||||
html = html.replace(/\xA0/ig, ' ')
|
||||
html = html.replace(/ /ig, ' ')
|
||||
html = html.replace(/ /ig, ' ')
|
||||
|
||||
// fix some tags
|
||||
html = html.replace(/<u>/g, '<span style="text-decoration: underline">')
|
||||
html = html.replace(/<\/u>/g, '</span>')
|
||||
html = html.replace(/<s>/g, '<span style="text-decoration: line-through">')
|
||||
html = html.replace(/<\/s>/g, '</span>')
|
||||
html = html.replace(/<u>/ig, '<span style="text-decoration: underline">')
|
||||
html = html.replace(/<\/u>/ig, '</span>')
|
||||
html = html.replace(/<s>/ig, '<span style="text-decoration: line-through">')
|
||||
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(/\s*<\/p>/g, '</p>')
|
||||
html = html.replace(/<p>\s*/ig, '<p>')
|
||||
html = html.replace(/\s*<\/p>/ig, '</p>')
|
||||
|
||||
// html = fixParagraphIndent(html)
|
||||
|
||||
|
|
|
@ -53,6 +53,24 @@ em em {
|
|||
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 {
|
||||
padding-top: 0.5em;
|
||||
margin-bottom: 1.5em;
|
||||
|
|
Loading…
Reference in a new issue