Skip to content

Commit 287dd5a

Browse files
committed
Try to remove all excess data from create-docs script
1 parent 8046c01 commit 287dd5a

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

web/libs/editor/scripts/create-docs.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fetch(currentTagsUrl)
8181
function processTemplate(t, dir, supertag) {
8282
// all tags are with this kind and leading capital letter
8383
if (t.kind !== "member" || !t.name.match(/^[A-Z]/)) return;
84-
if (!supertag && t.customTags && t.customTags.find((desc) => desc.tag === "subtag")) return;
84+
// if (!supertag && t.customTags && t.customTags.find((desc) => desc.tag === "subtag")) return;
8585
const name = t.name.toLowerCase();
8686
// there are no new tags if we didn't get the list
8787
const isNew = tags ? !tags.includes(name) : false;
@@ -145,15 +145,15 @@ fetch(currentTagsUrl)
145145
.renderSync({ data: [t], "example-lang": "html" })
146146
// add header with info instead of header for github
147147
// don't add any header to subtags as they'll be inserted into supertag's doc
148-
.replace(/^(.*?\n){3}/, header)
148+
// .replace(/^(.*?\n){3}/, header)
149149
// remove useless Kind: member
150-
.replace(/\*\*Kind\*\*.*?\n/, "### Parameters\n")
151-
.replace(/(\*\*Example\*\*\s*\n)/, `${results}$1`)
152-
.replace(/\*\*Example\*\*\s*\n/g, "### Example\n")
150+
.replace(/^.*?\*\*Kind\*\*.*?\n/ms, "### Parameters\n")
151+
.replace(/\*\*Example\*\*\s*\n.*/ms, results)
152+
// .replace(/\*\*Example\*\*\s*\n/g, "### Example\n")
153153
// move comments from examples to description
154-
.replace(/```html[\n\s]*<!--[\n\s]*([\w\W]*?)[\n\s]*-->[\n\s]*/g, "\n$1\n\n```html\n")
154+
// .replace(/```html[\n\s]*<!--[\n\s]*([\w\W]*?)[\n\s]*-->[\n\s]*/g, "\n$1\n\n```html\n")
155155
// change example language if it looks like JSON
156-
.replace(/```html[\n\s]*([[{])/g, "```json\n$1")
156+
// .replace(/```html[\n\s]*([[{])/g, "```json\n$1")
157157
// normalize footnotes to be numbers (e.g. `[^FF_LSDV_0000]` => `[^1]`)
158158
.replace(
159159
/\[\^([^\]]+)\]/g,
@@ -172,19 +172,19 @@ fetch(currentTagsUrl)
172172
// force adding new lines before footnote definitions
173173
.replace(/(?<![\r\n])([\r\n])(\[\^[^\[]+\]:)/gm, "$1$1$2");
174174

175-
if (supertags.includes(t.name)) {
176-
console.log(`Fetching subtags of ${t.name}`);
177-
const templates = jsdoc2md.getTemplateDataSync({ files: `${t.meta.path}/${t.name}/*.${EXT}` });
178-
const subtags = templates
179-
.map((t) => processTemplate(t, dir, t.name))
180-
.filter(Boolean)
181-
.join("\n\n");
182-
183-
if (subtags) {
184-
// insert before the first example or just at the end of doc
185-
str = str.replace(/(### Example)|$/, `${subtags}\n$1`);
186-
}
187-
}
175+
// if (supertags.includes(t.name)) {
176+
// console.log(`Fetching subtags of ${t.name}`);
177+
// const templates = jsdoc2md.getTemplateDataSync({ files: `${t.meta.path}/${t.name}/*.${EXT}` });
178+
// const subtags = templates
179+
// .map((t) => processTemplate(t, dir, t.name))
180+
// .filter(Boolean)
181+
// .join("\n\n");
182+
183+
// if (subtags) {
184+
// // insert before the first example or just at the end of doc
185+
// str = str.replace(/(### Example)|$/, `${subtags}\n$1`);
186+
// }
187+
// }
188188

189189
return str;
190190
}

0 commit comments

Comments
 (0)