Skip to content

Commit

Permalink
fix: vertical read, more format fine tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
plateaukao committed Nov 30, 2024
1 parent 2f6bad8 commit 4680e94
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/src/main/assets/process_text_nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/verticalReaderview.css
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4680e94

Please sign in to comment.