@baravak/risloo-profile-cli 4.40.3 → 4.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/handlebars/helpers/lineWrap.js +41 -18
- package/src/publish/json/profiles/YMQ93.json +1278 -0
- package/src/samples/YMQ93.js +272 -0
- package/views/profiles/samples/YMQ93_1.hbs +134 -0
- package/views/profiles/samples/YMQ93_2.hbs +133 -0
- package/views/profiles/samples/YMQ93_3.hbs +132 -0
package/package.json
CHANGED
|
@@ -1,28 +1,51 @@
|
|
|
1
1
|
// lineWrap Helper
|
|
2
2
|
// Wrapping Words into Lines
|
|
3
3
|
|
|
4
|
-
function lineWrap(
|
|
5
|
-
let tokens =
|
|
6
|
-
let lines = [];
|
|
7
|
-
let i = 0;
|
|
4
|
+
function lineWrap(str, maxChar) {
|
|
5
|
+
let tokens = str.split(" ");
|
|
6
|
+
let lines = [];
|
|
7
|
+
let i = 0;
|
|
8
8
|
let L = 0;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
|
|
10
|
+
while (true) {
|
|
11
|
+
if (!tokens[i]) break;
|
|
12
|
+
|
|
13
|
+
let token = tokens[i];
|
|
14
|
+
let tokenLength = token.replace(//g, "").length;
|
|
15
|
+
|
|
16
|
+
if (tokenLength > maxChar) {
|
|
17
|
+
if (i > 0) {
|
|
18
|
+
lines.push(tokens.slice(0, i).join(" ").trim());
|
|
19
|
+
tokens = tokens.slice(i);
|
|
20
|
+
i = 0;
|
|
21
|
+
L = 0;
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
lines.push(token.slice(0, maxChar));
|
|
26
|
+
tokens[0] = token.slice(maxChar);
|
|
27
|
+
i = 0;
|
|
28
|
+
L = 0;
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
L += tokenLength + 1;
|
|
33
|
+
|
|
12
34
|
if (L - 1 > maxChar) {
|
|
13
|
-
lines.push(tokens.slice(0, i).join(" ").trim());
|
|
14
|
-
tokens = tokens.slice(i);
|
|
15
|
-
i = 0;
|
|
35
|
+
lines.push(tokens.slice(0, i).join(" ").trim());
|
|
36
|
+
tokens = tokens.slice(i);
|
|
37
|
+
i = 0;
|
|
16
38
|
L = 0;
|
|
17
39
|
continue;
|
|
18
|
-
} else if (i >= tokens.length - 1) {
|
|
19
|
-
lines.push(tokens.slice(0, i + 1).join(" "));
|
|
20
|
-
break;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
40
|
+
} else if (i >= tokens.length - 1) {
|
|
41
|
+
lines.push(tokens.slice(0, i + 1).join(" "));
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
i++;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return lines;
|
|
26
49
|
}
|
|
27
50
|
|
|
28
51
|
module.exports = lineWrap;
|