This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* to install, EmEditor Macro menu, customize, add , select cnumber.jsee */ | |
if (!document.selection.IsEmpty) { | |
var lines=document.selection.Text.split(/\r?\n/); | |
var out=[]; | |
for (var line=0;line<lines.length;line++) { | |
var val=parseInt(lines[line] | |
.replace(/百([二三四五六七八九])十/,'$1十') | |
.replace(/百十$/,'10') | |
.replace(/百十/,'1') | |
.replace(/百$/,'00') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {openBasket,nodefs} from 'pitaka/cli'; | |
await nodefs ; //等 fs 準備好 | |
const zh= await openBasket('mzd'); //原文 | |
const en= await openBasket('mzd-en'); //英文版 | |
const [start,end]= zh.getPageRange('antho.1'); // 取得 第一篇文章 中國社會各階級的分析 的範圍, | |
await zh.prefetchLines(start,end); //預讀這個範圍 | |
await en.prefetchLines(start,end); //英版一致 | |
for (let i=start;i<end;i++) { //遍歷 | |
const zhline=zh.getLine(i); //抓取行 | |
const enline=en.getLine(i); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<style> | |
.c {background:rgba(255,64,64,0.3)} | |
</style> | |
<body> | |
00000<span class="c">11111<span class="c">22222<span class="c">33<span class="c">4444</span>3333</span>2222</span>11111</span>000000 | |
</body> | |
<html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
text file cannot contain surrogate due to bugs in node.js | |
*/ | |
var fs = require('fs'); | |
var total_size=0; | |
var filetoarraySync = function (filename, encoding) { //array | |
encoding = encoding || 'utf8'; | |
var data = fs.readFileSync(filename, encoding); |