Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
DaanV2 committed Mar 13, 2021
1 parent 2acff95 commit 60fc08c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v2

# Runs a single command using the runners shell
- uses: DaanV2/Markdown-Action-Create-Indexes@v1.5.3
- uses: DaanV2/Markdown-Action-Create-Indexes@v1.5.5
with:
folder: ${{github.workspace}}

Expand Down
8 changes: 4 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ function CreateFolder(folder) {
if (fs.statSync(subfolder).isDirectory()) {
//Create index page, if succesfull we create a reference
if (CreateFolder(subfolder)) {
SubFolders.push(`- [${child}](./${child}/index.md)`);
SubFolders.push(`- [${child}](./${encodeURI(child)}/index.md)`);
}
}
else {
Expand All @@ -538,8 +538,8 @@ function CreateFolder(folder) {
let Name = GetFolderName(folder);
console.log('writing: ' + filepath);
let Content = Template.replace(/\{\$HEADER\$\}/gi, Name);
Content = Content.replace(/\{\$CATEGORIES\$\}/gi, SubFolders.join('\n\r'));
Content = Content.replace(/\{\$DOCUMENTS\$\}/gi, Documents.join('\n\r'));
Content = Content.replace(/\{\$CATEGORIES\$\}/gi, SubFolders.join('\r\n'));
Content = Content.replace(/\{\$DOCUMENTS\$\}/gi, Documents.join('\r\n'));
fs.writeFileSync(filepath, Content, WriteOptions);
return true;
}
Expand All @@ -552,7 +552,7 @@ exports.CreateFolder = CreateFolder;
* @returns The name of the folder
*/
function GetFolderName(folderpath) {
let LastIndex = folderpath.lastIndexOf('\\');
let LastIndex = folderpath.lastIndexOf('/');
if (LastIndex >= 0) {
return folderpath.substring(LastIndex, folderpath.length);
}
Expand Down
8 changes: 4 additions & 4 deletions source/traverse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function CreateFolder(folder: string): boolean {
//Create index page, if succesfull we create a reference

if (CreateFolder(subfolder)) {
SubFolders.push(`- [${child}](./${child}/index.md)`);
SubFolders.push(`- [${child}](./${encodeURI(child)}/index.md)`);
}
}
else {
Expand All @@ -61,8 +61,8 @@ export function CreateFolder(folder: string): boolean {
console.log('writing: ' + filepath);

let Content = Template.replace(/\{\$HEADER\$\}/gi, Name);
Content = Content.replace(/\{\$CATEGORIES\$\}/gi, SubFolders.join('\n\r'));
Content = Content.replace(/\{\$DOCUMENTS\$\}/gi, Documents.join('\n\r'));
Content = Content.replace(/\{\$CATEGORIES\$\}/gi, SubFolders.join('\r\n'));
Content = Content.replace(/\{\$DOCUMENTS\$\}/gi, Documents.join('\r\n'));

fs.writeFileSync(filepath, Content, WriteOptions);
return true;
Expand All @@ -78,7 +78,7 @@ export function CreateFolder(folder: string): boolean {
* @returns The name of the folder
*/
function GetFolderName(folderpath: string): string {
let LastIndex = folderpath.lastIndexOf('\\');
let LastIndex = folderpath.lastIndexOf('/');

if (LastIndex >= 0) {
return folderpath.substring(LastIndex, folderpath.length);
Expand Down
9 changes: 9 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/ash

echo "==== testing files ===="
if cat $jsonfile | strip-json-comments | jq empty; then

else
echo "File not found $jsonfile"
exit 1
fi
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"esModuleInterop": true,
"target": "ES2020",
"moduleResolution": "node",
"sourceMap": true,
"sourceMap": true,
"outDir": "out"
},
"lib": ["es2015"]
Expand Down

0 comments on commit 60fc08c

Please sign in to comment.