feat: support double quotation marks #62
This commit is contained in:
parent
45d0d17aae
commit
4592a8dc02
7 changed files with 231 additions and 137 deletions
|
@ -680,6 +680,9 @@
|
|||
const REG_BD_CLOSE = `」』)》〉】〗〕]}`;
|
||||
const REG_BD_START = `${REG_BD_OPEN}${REG_BD_CLOSE}`;
|
||||
const REG_BD_END = `${REG_BD_STOP}${REG_BD_OPEN}${REG_BD_CLOSE}`;
|
||||
const REG_BD_HALF_OPEN = `“‘`;
|
||||
const REG_BD_HALF_CLOSE = `”’`;
|
||||
const REG_BD_HALF_START = `${REG_BD_HALF_OPEN}${REG_BD_HALF_CLOSE}`;
|
||||
|
||||
class Heti {
|
||||
constructor (rootSelector) {
|
||||
|
@ -754,6 +757,13 @@
|
|||
replace: portion => getWrapper('heti-adjacent', 'heti-adjacent-quarter', portion.text),
|
||||
offset: this.offsetWidth,
|
||||
}));
|
||||
|
||||
// 使用弯引号的情况下,在停顿符号接弯引号(如「。“」)或弯引号接全角开引号(如“《」)时,间距缩进调整到四分之一
|
||||
findAndReplaceDOMText($$elm, Object.assign({}, commonConfig, {
|
||||
find: new RegExp(`([${REG_BD_STOP}])(?=[${REG_BD_HALF_START}])|([${REG_BD_HALF_OPEN}])(?=[${REG_BD_OPEN}])`,'g'),
|
||||
replace: portion => getWrapper('heti-adjacent', 'heti-adjacent-quarter', portion.text),
|
||||
offset: this.offsetWidth,
|
||||
}));
|
||||
}
|
||||
|
||||
autoSpacing () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue