@@ -47,27 +47,21 @@ class DocumentService implements IDocumentService {
4747 readonly readingDocInfo : DocumentInfo = readingDocMap ;
4848
4949 get skillDocParent ( ) : FileSystem . DirectoryInfo {
50- const doc = FileSystem . projectRoot ( )
51- . getDirectories ( )
52- . find ( x => x . name === 'document' ) ;
50+ const doc = FileSystem . documentRoot ( ) ;
5351 const ret = doc . getDirectories ( ) . find ( x => x . name === 'Skill' ) ;
5452 if ( ! ret ) throw new Error ( 'Skill Document source not found.' ) ;
5553 return ret ;
5654 }
5755
5856 get readingDocParent ( ) : FileSystem . DirectoryInfo {
59- const doc = FileSystem . projectRoot ( )
60- . getDirectories ( )
61- . find ( x => x . name === 'document' ) ;
57+ const doc = FileSystem . documentRoot ( ) ;
6258 const ret = doc . getDirectories ( ) . find ( x => x . name === 'Reading' ) ;
6359 if ( ! ret ) throw new Error ( 'Reading Document source not found.' ) ;
6460 return ret ;
6561 }
6662
6763 get articleDocParent ( ) : FileSystem . DirectoryInfo {
68- const doc = FileSystem . projectRoot ( )
69- . getDirectories ( )
70- . find ( x => x . name === 'document' ) ;
64+ const doc = FileSystem . documentRoot ( ) ;
7165 const ret = doc . getDirectories ( ) . find ( x => x . name === 'Articles' ) ;
7266 if ( ! ret ) throw new Error ( 'Articles Document source not found.' ) ;
7367 return ret ;
@@ -93,9 +87,9 @@ class DocumentService implements IDocumentService {
9387
9488 let src : FileSystem . DirectoryInfo ;
9589
96- if ( Object . keys ( skillDocMap ) . includes ( name ) ) {
90+ if ( Object . prototype . hasOwnProperty . call ( skillDocMap , name ) ) {
9791 src = this . skillDocParent ;
98- } else if ( Object . keys ( readingDocMap ) . includes ( name ) ) {
92+ } else if ( Object . prototype . hasOwnProperty . call ( readingDocMap , name ) ) {
9993 src = this . readingDocParent ;
10094 }
10195
@@ -132,14 +126,18 @@ class DocumentService implements IDocumentService {
132126 const shouldSolveSharpSign = ( name : DocumentName ) => name . includes ( '#' ) ;
133127
134128 let src : FileSystem . DirectoryInfo ;
135- if ( Object . keys ( skillDocMap ) . includes ( name ) ) {
129+ if ( name === 'Articles' ) src = this . articleDocParent ;
130+ else if ( Object . prototype . hasOwnProperty . call ( skillDocMap , name ) ) {
136131 src = this . skillDocParent ;
137- } else if ( Object . keys ( readingDocMap ) . includes ( name ) ) {
132+ } else if ( Object . prototype . hasOwnProperty . call ( readingDocMap , name ) ) {
138133 src = this . readingDocParent ;
139134 }
135+
140136 const markdownEntry = this . getMarkdownEntryFolder ( name ) ;
141- let linkContext = `document/${ src . name } /${ name } /` ;
137+ let linkContext =
138+ name === 'Articles' ? `document/${ src . name } ` : `document/${ src . name } /${ name } /` ;
142139
140+ // any md presented at first level
143141 if ( markdownEntry . getFiles ( ) . length ) {
144142 const file = Enumerable . from ( markdownEntry . getFiles ( ) )
145143 . orderBy ( x => x . name )
0 commit comments