Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc923983

Browse files
committed
main
1 parentdc11430 commitc923983

File tree

1 file changed

+40
-15
lines changed

1 file changed

+40
-15
lines changed

‎docs/services/DocumentService.ts‎

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ export const skillDocMap = {
1111
'Modern CSharp':{icon:'🦖',description:''},
1212
Articles:{icon:'📰',description:'Regular articles'},
1313
Avalonia:{icon:'😱',description:'AvaloniaUI'},
14-
Docker:{icon:'🐳',description:'Ultimate Docker'},
14+
Docker:{icon:'🐳',description:''},
1515
Git:{icon:'😸',description:'Git mastery'},
16-
JavaScript:{icon:'😅',description:''},
16+
JavaScript:{icon:'😅',description:'Not funny'},
1717
// SQL: { icon: '🦭', description: '' },
18-
TypeScript:{icon:'🤯',description:''},
18+
TypeScript:{icon:'🤯',description:'Type wizard I will become...'},
1919
// VBA: { icon: '💩', description: 'VBA for excel' },
2020
// Vue3: { icon: '⚡', description: '' },
2121
'Unsafe CSharp':{icon:'😎',description:'Entering the danger zone...'},
@@ -24,15 +24,17 @@ export const skillDocMap = {
2424
// description: 'Make your own nvim color scheme using lua.',
2525
// },
2626
Bash:{icon:'🐢',description:'Shebang!'},
27-
'Regular Expression':{icon:'🐫',description:'Memory lossssforevery 6 months'},
27+
'Regular Expression':{icon:'🐫',description:"Can't remember itfor2 days"},
2828
Nix:{icon:'❄',description:'Reproduce freedom'},
2929
'Entity Framework Core':{icon:'🗿',description:''},
3030
'HTML & CSS':{icon:'😬',description:''},
31-
PowerShell:{icon:'🐚',description:''},
32-
Lua:{icon:'🌝',description:''},
31+
PowerShell:{icon:'🐚',description:'A pretty solid shell'},
32+
Lua:{icon:'🌝',description:'I wish lua could have JavaScript syntax'},
3333
}asconstsatisfiesDocumentInfo;
3434

35-
constreadingDocMap={}asconstsatisfiesDocumentInfo;
35+
constreadingDocMap={
36+
Test:{icon:'🚗',description:'this is a test'},
37+
}asconstsatisfiesDocumentInfo;
3638

3739
exporttypeDocumentName=keyoftypeofskillDocMap|keyoftypeofreadingDocMap;
3840

@@ -80,21 +82,32 @@ class DocumentService implements IDocumentService {
8082
}
8183
}
8284

85+
/**
86+
*@param name - nameof document
87+
*@returns the very parent folder of the document
88+
*/
8389
getDocumentEntryFolder(name:DocumentName):FileSystem.DirectoryInfo{
8490
if(name==='Articles'){
8591
returnthis.articleDocParent;
8692
}
87-
constret=this.registeredDocumentFolders().find(x=>x.name===name);
93+
94+
letsrc:FileSystem.DirectoryInfo;
95+
96+
if(Object.keys(skillDocMap).includes(name)){
97+
src=this.skillDocParent;
98+
}elseif(Object.keys(readingDocMap).includes(name)){
99+
src=this.readingDocParent;
100+
}
101+
102+
constret=src.getDirectories().find(x=>x.name===name);
88103
if(!ret)thrownewError(`Document entry of "${name}" not found.`);
89104
returnret;
90105
}
91106

92-
registeredDocumentFolders():FileSystem.DirectoryInfo[]{
93-
returnthis.skillDocParent
94-
.getDirectories()
95-
.filter(x=>Object.keys(skillDocMap).includes(x.name));
96-
}
97-
107+
/**
108+
*@param name - nameof the document
109+
*@returns docs folder of the document
110+
*/
98111
getMarkdownEntryFolder(name:DocumentName):FileSystem.DirectoryInfo{
99112
constret=this.getDocumentEntryFolder(name)
100113
.getDirectories()
@@ -103,6 +116,11 @@ class DocumentService implements IDocumentService {
103116
returnret;
104117
}
105118

119+
/**
120+
* find a entry file location for given document name
121+
*@param name - nameof document
122+
*@returns relative path to the document file
123+
*/
106124
tryGetIndexLinkOfDocument(name:DocumentName):string{
107125
if(this.isEmptyDocument(name))return'/';
108126

@@ -112,8 +130,15 @@ class DocumentService implements IDocumentService {
112130
};
113131

114132
constshouldSolveSharpSign=(name:DocumentName)=>name.includes('#');
133+
134+
letsrc:FileSystem.DirectoryInfo;
135+
if(Object.keys(skillDocMap).includes(name)){
136+
src=this.skillDocParent;
137+
}elseif(Object.keys(readingDocMap).includes(name)){
138+
src=this.readingDocParent;
139+
}
115140
constmarkdownEntry=this.getMarkdownEntryFolder(name);
116-
letlinkContext=`${this.skillDocParent.name}/${name}/`;
141+
letlinkContext=`document/${src.name}/${name}/`;
117142

118143
if(markdownEntry.getFiles().length){
119144
constfile=Enumerable.from(markdownEntry.getFiles())

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp