@t8/docsgen 0.2.30 → 0.2.31
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/dist/bin.js +24 -19
- package/package.json +1 -1
- package/src/bin/parsing/getParsedContent.ts +28 -18
- package/src/bin/setContent.ts +1 -1
package/dist/bin.js
CHANGED
|
@@ -616,22 +616,31 @@ async function getParsedContent(ctx) {
|
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
618
|
let { outerHTML } = element;
|
|
619
|
-
if (indexComplete)
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
if (installationCode) installation = installationCode;
|
|
627
|
-
else if (description.length === 0) description.push(outerHTML);
|
|
628
|
-
else intro.push(outerHTML);
|
|
629
|
-
}
|
|
630
|
-
} else {
|
|
631
|
-
let installationCode = getInstallationCode(element);
|
|
632
|
-
if (installationCode) installation = installationCode;
|
|
619
|
+
if (indexComplete) {
|
|
620
|
+
section.push(outerHTML);
|
|
621
|
+
continue;
|
|
622
|
+
}
|
|
623
|
+
if (hasFeatures) {
|
|
624
|
+
let installationCode2 = getInstallationCode(element);
|
|
625
|
+
if (installationCode2) installation = installationCode2;
|
|
633
626
|
else note.push(outerHTML);
|
|
627
|
+
continue;
|
|
628
|
+
}
|
|
629
|
+
if (element.matches("ul")) {
|
|
630
|
+
hasFeatures = true;
|
|
631
|
+
features.push(outerHTML);
|
|
632
|
+
continue;
|
|
634
633
|
}
|
|
634
|
+
let installationCode = getInstallationCode(element);
|
|
635
|
+
if (installationCode) {
|
|
636
|
+
installation = installationCode;
|
|
637
|
+
continue;
|
|
638
|
+
}
|
|
639
|
+
if (element.matches("p") && description.length === 0) {
|
|
640
|
+
description.push(outerHTML);
|
|
641
|
+
continue;
|
|
642
|
+
}
|
|
643
|
+
intro.push(outerHTML);
|
|
635
644
|
}
|
|
636
645
|
if (section.length !== 0) sections.push(joinLines(section));
|
|
637
646
|
let postprocess = getSectionPostprocess({
|
|
@@ -643,10 +652,6 @@ async function getParsedContent(ctx) {
|
|
|
643
652
|
description = [];
|
|
644
653
|
}
|
|
645
654
|
if (intro.at(-1) === "<hr>") intro.pop();
|
|
646
|
-
if (intro.length === 1) {
|
|
647
|
-
descriptionNote = intro;
|
|
648
|
-
intro = [];
|
|
649
|
-
}
|
|
650
655
|
for (let i = 0; i < intro.length; i++) {
|
|
651
656
|
if (intro[i].includes("<br>") && intro[i].startsWith("<p>") && intro[i].endsWith("</p>")) {
|
|
652
657
|
let s = intro[i].slice(3, -4).replace(/<br>(\r?\n)?(\s*)/g, '</span><br>$1$2<span class="li">');
|
|
@@ -693,7 +698,7 @@ function getDefaultCodeStyleContent(cssRoot) {
|
|
|
693
698
|
`.trim();
|
|
694
699
|
}
|
|
695
700
|
function tweakTypography(s = "") {
|
|
696
|
-
return s.replace(/\b(for|in|on|at|with|a|an|the)\s+/gi, "$1\xA0").replace(/\b(React)\s+(apps?)\b/gi, "$1\xA0$2");
|
|
701
|
+
return s.replace(/\b(for|in|on|at|to|with|a|an|the|its)\s+/gi, "$1\xA0").replace(/\b(React)\s+(apps?)\b/gi, "$1\xA0$2");
|
|
697
702
|
}
|
|
698
703
|
async function setContent(ctx) {
|
|
699
704
|
let {
|
package/package.json
CHANGED
|
@@ -61,24 +61,39 @@ export async function getParsedContent(ctx: Context) {
|
|
|
61
61
|
|
|
62
62
|
let { outerHTML } = element;
|
|
63
63
|
|
|
64
|
-
if (indexComplete)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
let installationCode = getInstallationCode(element);
|
|
71
|
-
|
|
72
|
-
if (installationCode) installation = installationCode;
|
|
73
|
-
else if (description.length === 0) description.push(outerHTML);
|
|
74
|
-
else intro.push(outerHTML);
|
|
75
|
-
}
|
|
76
|
-
} else {
|
|
64
|
+
if (indexComplete) {
|
|
65
|
+
section.push(outerHTML);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (hasFeatures) {
|
|
77
70
|
let installationCode = getInstallationCode(element);
|
|
78
71
|
|
|
79
72
|
if (installationCode) installation = installationCode;
|
|
80
73
|
else note.push(outerHTML);
|
|
74
|
+
|
|
75
|
+
continue;
|
|
81
76
|
}
|
|
77
|
+
|
|
78
|
+
if (element.matches("ul")) {
|
|
79
|
+
hasFeatures = true;
|
|
80
|
+
features.push(outerHTML);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
let installationCode = getInstallationCode(element);
|
|
85
|
+
|
|
86
|
+
if (installationCode) {
|
|
87
|
+
installation = installationCode;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (element.matches("p") && description.length === 0) {
|
|
92
|
+
description.push(outerHTML);
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
intro.push(outerHTML);
|
|
82
97
|
}
|
|
83
98
|
|
|
84
99
|
if (section.length !== 0) sections.push(joinLines(section));
|
|
@@ -99,11 +114,6 @@ export async function getParsedContent(ctx: Context) {
|
|
|
99
114
|
|
|
100
115
|
if (intro.at(-1) === "<hr>") intro.pop();
|
|
101
116
|
|
|
102
|
-
if (intro.length === 1) {
|
|
103
|
-
descriptionNote = intro;
|
|
104
|
-
intro = [];
|
|
105
|
-
}
|
|
106
|
-
|
|
107
117
|
for (let i = 0; i < intro.length; i++) {
|
|
108
118
|
if (
|
|
109
119
|
intro[i].includes("<br>") &&
|
package/src/bin/setContent.ts
CHANGED
|
@@ -30,7 +30,7 @@ function getDefaultCodeStyleContent(cssRoot: string) {
|
|
|
30
30
|
|
|
31
31
|
function tweakTypography(s = "") {
|
|
32
32
|
return s
|
|
33
|
-
.replace(/\b(for|in|on|at|with|a|an|the)\s+/gi, "$1\xa0")
|
|
33
|
+
.replace(/\b(for|in|on|at|to|with|a|an|the|its)\s+/gi, "$1\xa0")
|
|
34
34
|
.replace(/\b(React)\s+(apps?)\b/gi, "$1\xa0$2");
|
|
35
35
|
}
|
|
36
36
|
|