Skip to content

Commit

Permalink
fix two annoying bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
sky-is-winning committed Aug 5, 2024
1 parent d7f1350 commit f0c03a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/generate-page-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ function hideNav() {
<div class="mw-parser-output">
<meta property="mw:PageProp/toc">
`;
contentContainer += await this.getContentFromWikiText(wt, pageName);
contentContainer += pageName.startsWith("templates/") ? await this.getTemplate(pageName.split("templates/")[1], pageName, true) : await this.getContentFromWikiText(wt, pageName);
contentContainer += `</div></main>`;
contentContainer += this.getFooter();
contentContainer += `</div></div></div>`;
Expand Down Expand Up @@ -409,10 +409,10 @@ function hideNav() {
return body;
}

async getTemplate(template, pageName) {
async getTemplate(template, pageName, bypassNoInclude = false) {
if (template == "BASEPAGENAME") {
return pageName;
}
return await this.templateGenerator.generateTemplate(template, true);
return await this.templateGenerator.generateTemplate(template, bypassNoInclude);
}
}
3 changes: 2 additions & 1 deletion src/generate-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export default class GenerateTemplate {
let listContent = boxData[list];
navbox += `<td style="text-align:left;border-left-width:2px;border-left-style:solid;width:100%;padding:0px;;;" class="navbox-list navbox-${id % 2 == 0 ? "even" : "odd"}"><div style="padding:0em 0.25em">${listContent}</div></td>`;
}
navbox += `</tbody></table></td></tr></tbody></table>`;

return navbox;
}
Expand Down Expand Up @@ -353,7 +354,7 @@ export default class GenerateTemplate {
}

async generateTemplateFromWikitext(wikitext, data, bypassNoInclude) {
if (!bypassNoInclude) wikitext = wikitext.replace(/<noinclude>[\s\S]*?<\/noinclude>|<noinclude>[\s\S]*?(?=<noinclude>|$)/g, "");
if (!bypassNoInclude) wikitext = wikitext.replace(/<noinclude>[\s\S]*?<\/noinclude>|<noinclude>[\s\S]*?(?=<\/noinclude>|$)/g, "");

var dataSwappers = {};
data.forEach((item, index) => {
Expand Down

0 comments on commit f0c03a2

Please sign in to comment.