Skip to content

Commit

Permalink
feat: vertical reader mode, enhance parsing for 5G, and English words…
Browse files Browse the repository at this point in the history
… surrounded by other

English words.
  • Loading branch information
plateaukao committed Dec 8, 2024
1 parent b96e8e5 commit f533a4f
Showing 1 changed file with 2 additions and 2 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 @@ -60,8 +60,8 @@ traverseAndConvertDates(document.body);
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]\.|\b[a-zA-Z]{1,3}(?![a-zA-Z])(?!\S))/g;
// 1.1 | 1. | 5G | 2024 | a. | 這是 ABC 的測試
const regex = /(\b\d\.\d\b|\d{1}\.(?=\s|\b)|\b\d[a-zA-Z]{1}|\d{1,4}|\b[a-zA-Z]{1}\.(?!\s+[a-zA-Z])|(?<![a-zA-Z]+\s+)\b[a-zA-Z]{1,4}(?![a-zA-Z])(?!\s+[a-zA-Z]))/g;
let match;
let lastIndex = 0;
const fragment = document.createDocumentFragment();
Expand Down

0 comments on commit f533a4f

Please sign in to comment.