From adf0b96c8b74ba87dbacb8a7835b3c8414f577e2 Mon Sep 17 00:00:00 2001 From: Kirk Lin Date: Fri, 22 Sep 2023 12:14:00 +0800 Subject: [PATCH] refactor: css rules for non-CJK blocks using a new function --- src/typography/css/other.ts | 9 +++++---- src/typography/preflights/base.ts | 4 ---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/typography/css/other.ts b/src/typography/css/other.ts index 20f8ac0..34ac012 100644 --- a/src/typography/css/other.ts +++ b/src/typography/css/other.ts @@ -1,4 +1,5 @@ import { getVariables } from "./variables"; +import { getNonCjkBlockCss } from "./nonCjkBlock"; export const generateOtherCss = (selectorName: string) => { return ` @@ -79,10 +80,10 @@ export const generateOtherCss = (selectorName: string) => { text-emphasis: filled circle; text-emphasis-position: under right; } -.${selectorName} .${selectorName}-em:not(:lang(zh)):not(:lang(ja)):not(:lang(ko)), .${selectorName} .${selectorName}-em:not(:lang(zh)) { - -webkit-text-emphasis: none; - text-emphasis: none; -} +${getNonCjkBlockCss(`${selectorName}-em`, { + "-webkit-text-emphasis": "start", + "text-emphasis": "none", +})} .${selectorName} .${selectorName}-ruby--inline { display: inline-flex; flex-direction: column-reverse; diff --git a/src/typography/preflights/base.ts b/src/typography/preflights/base.ts index f124794..879217d 100644 --- a/src/typography/preflights/base.ts +++ b/src/typography/preflights/base.ts @@ -40,10 +40,6 @@ export const ChineseBase = { "text-align": "justify", }, - "p:not(:lang(zh)):not(:lang(ja)):not(:lang(ko))": { - "text-align": "start", - }, - "pre": { "margin-block-start": `calc(${getVariables.stdBlockUnit} * 0.5)`, "margin-block-end": `calc(${getVariables.stdBlockUnit} * 0.5)`,