Skip to content

Commit

Permalink
Fix Exclusion not working as intended.
Browse files Browse the repository at this point in the history
  • Loading branch information
turulix committed Jul 31, 2023
1 parent 4ff2192 commit 7aa8f37
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "obsidian-folder-index",
"name": "Folder Index",
"version": "1.0.20",
"version": "1.0.21",
"minAppVersion": "1.1.16",
"description": "This Plugin will automatically generate a TOC for the current Folder.",
"author": "turulix",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-sample-plugin",
"version": "1.0.20",
"version": "1.0.21",
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
"main": "main.js",
"scripts": {
Expand Down
5 changes: 4 additions & 1 deletion src/types/MarkdownTextRenderer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {App, HeadingCache, TAbstractFile, TFile, TFolder} from "obsidian";
import FolderIndexPlugin from "../main";
import {isIndexFile} from "./Utilities";
import {isExcludedPath, isIndexFile} from "./Utilities";

type FileTree = (TFile | TFolder)[]
type HeaderWrapper = {
Expand All @@ -24,6 +24,9 @@ export class MarkdownTextRenderer {
let markdownText = ""

for (const file of fileTree) {
if(isExcludedPath(file.path)){
continue
}
if (file instanceof TFolder && this.plugin.settings.recursiveIndexFiles) {
// Create a deep copy of the children array
let children = file.children;
Expand Down
7 changes: 1 addition & 6 deletions src/types/Utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,10 @@ export function isIndexFile(path: string) {
}

export function isExcludedPath(path: string) {
const pathParts = path.split(/\//)
for (const excludedFolder of FolderIndexPlugin.PLUGIN.settings.excludeFolders) {
if (excludedFolder == "")
continue
let folder = pathParts.slice(0, pathParts.length - 1).join("/")
if (!folder.endsWith("/"))
folder += "/"

if (RegExp(`^${excludedFolder}/?$`).test(folder))
if (RegExp(`^${excludedFolder}$`).test(path))
return true;
}
return false
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"1.0.17": "1.1.16",
"1.0.18": "1.1.16",
"1.0.19": "1.1.16",
"1.0.20": "1.1.16"
"1.0.20": "1.1.16",
"1.0.21": "1.1.16"
}

0 comments on commit 7aa8f37

Please sign in to comment.