From 4680e94ee1d4b8d954d100ad2cccedc5d52244ca Mon Sep 17 00:00:00 2001 From: Daniel Kao Date: Sat, 30 Nov 2024 16:55:06 +0800 Subject: [PATCH] fix: vertical read, more format fine tuning --- app/src/main/assets/process_text_nodes.js | 4 ++-- app/src/main/assets/verticalReaderview.css | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/assets/process_text_nodes.js b/app/src/main/assets/process_text_nodes.js index 6c3349b9..08e46a27 100644 --- a/app/src/main/assets/process_text_nodes.js +++ b/app/src/main/assets/process_text_nodes.js @@ -2,7 +2,7 @@ function convertToVerticalStyle(node) { if (node.nodeType === Node.TEXT_NODE) { let text = convertToFullWidth(node.nodeValue); // 1.1 | 1. | 2024 | a. - const regex = /(\b\d\.\d\b|\d{1}\.(?=\s|\b)|\d{1,4}|\b[a-zA-Z]\.)/g; + const regex = /(\b\d\.\d\b|\d{1}\.(?=\s|\b)|\d{1,4}|\b[a-zA-Z]\.|\b[a-zA-Z]{1,3}(?![a-zA-Z]))/g; let match; let lastIndex = 0; const fragment = document.createDocumentFragment(); @@ -67,7 +67,7 @@ function convertToVerticalStyle(node) { } function convertToFullWidth(str) { - return str.replace(/%/g, '%'); + return str.replace(/%/g, '%').replace(/\,/g, ',').replace(/\?/g, '?').replace(/\!/g, '!').replace(/:/g, ':').replace(/\//g, '/'); } function isLetter(char) { diff --git a/app/src/main/assets/verticalReaderview.css b/app/src/main/assets/verticalReaderview.css index 22c1f8e6..0f2d8272 100644 --- a/app/src/main/assets/verticalReaderview.css +++ b/app/src/main/assets/verticalReaderview.css @@ -282,7 +282,7 @@ ol.cjk li:before { display: inline-block; width: 2em; text-align: center; - margin: 0 -0.1em 0.8em 0; + margin: 0 -0.1em 0.7em 0; font-size: 0.8em; -moz-transform:rotate(-90deg); -webkit-transform:rotate(-90deg);