Skip to content

Commit f835517

Browse files
committed
update docs example
1 parent 727e052 commit f835517

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

docs/_source/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ function onChange () {
2121
var lastToken
2222
tokens.forEach((function(v, i) {
2323
if (v.type === 2) {
24-
pinyin += (pinyin && lastToken.target !== ' ') ? (' ' + format(v.target)) : format(v.target)
24+
pinyin += (pinyin && !/\n|\s/.test(lastToken.target)) ? (' ' + format(v.target)) : format(v.target)
2525
} else {
26-
pinyin += v.target
26+
pinyin += ((lastToken && lastToken.type === 2) ? ' ' : '') + v.target
2727
}
2828
lastToken = v
2929
}))

docs/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ function onChange() {
106106
var lastToken;
107107
tokens.forEach(function (v, i) {
108108
if (v.type === 2) {
109-
pinyin += pinyin && lastToken.target !== ' ' ? ' ' + format(v.target) : format(v.target);
109+
pinyin += pinyin && !/\n|\s/.test(lastToken.target) ? ' ' + format(v.target) : format(v.target);
110110
} else {
111-
pinyin += v.target;
111+
pinyin += (lastToken && lastToken.type === 2 ? ' ' : '') + v.target;
112112
}
113113
lastToken = v;
114114
});

0 commit comments

Comments
 (0)