File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,7 +43,6 @@ const image_regex = /!\[[^\]]*]\(([^)]*)\)/;
4343const reference_definition_regex = / \s * \[ ( [ ^ \] ] * ) ] : ( .+ ) / ;
4444const reference_link_regex = / \[ ( [ ^ \] ] * ) ] \[ ( [ ^ \] ] * ) ] / g;
4545
46- export const wiki_path = "wiki/wiki" ;
4746export const wiki_articles_path = "wiki/bot-articles" ;
4847
4948type substitution_fun = ( str : string ) => string ;
@@ -408,24 +407,6 @@ export default class Wiki extends BotComponent {
408407 this . article_aliases . set ( alias , file_path . name ) ;
409408 }
410409 }
411- for await ( const file_path of globIterate ( `${ wiki_path } /**/*.md` , { withFileTypes : true } ) ) {
412- const file_content = await fs . promises . readFile ( file_path . fullpath ( ) , { encoding : "utf-8" } ) ;
413- const { data } = matter ( file_content ) ;
414- if ( data . preview ) {
415- let parsed ;
416- try {
417- parsed = parse_article ( file_path . name , data . preview , this . substitute_refs ) ;
418- } catch ( e : any ) {
419- M . error ( `Failed to parse article ${ file_path } : ${ e . message } ` ) ;
420- continue ;
421- }
422- const [ article , aliases ] = parsed ;
423- this . articles [ file_path . name ] = article ;
424- for ( const alias of [ ...aliases , ...( data . alias ? [ data . alias as string ] : [ ] ) ] ) {
425- this . article_aliases . set ( alias , file_path . name ) ;
426- }
427- }
428- }
429410 }
430411
431412 async send_wiki_article ( article : WikiArticle , command : TextBasedCommand , user : Discord . User | null ) {
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import * as fs from "fs";
44import matter from "gray-matter" ;
55import { globSync } from "glob" ;
66
7- import { parse_article , wiki_articles_path , wiki_path } from "../src/components/wiki.js" ;
7+ import { parse_article , wiki_articles_path } from "../src/components/wiki.js" ;
88
99describe ( "parse wiki articles" , ( ) => {
1010 for ( const file_path of globSync ( `${ wiki_articles_path } /articles/**/*.md` , { withFileTypes : true } ) ) {
@@ -13,13 +13,4 @@ describe("parse wiki articles", () => {
1313 parse_article ( null , content , str => str ) ;
1414 } ) ;
1515 }
16- for ( const file_path of globSync ( `${ wiki_path } /src/**/*.md` , { withFileTypes : true } ) ) {
17- test ( `${ file_path . name } article should parse` , async ( ) => {
18- const file_content = await fs . promises . readFile ( file_path . fullpath ( ) , { encoding : "utf-8" } ) ;
19- const { data } = matter ( file_content ) ;
20- if ( data . preview ) {
21- parse_article ( null , data . preview , str => str ) ;
22- }
23- } ) ;
24- }
2516} ) ;
You can’t perform that action at this time.
0 commit comments