From 1e27f3bdea197617c7c214a88c7a9c264f2da64f Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Sun, 27 Jun 2021 21:12:59 +0200 Subject: [PATCH] feat: Mask doc if its ancestor name starts with '_' --- scripts/update-toc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/update-toc b/scripts/update-toc index df37363..554a355 100755 --- a/scripts/update-toc +++ b/scripts/update-toc @@ -28,6 +28,14 @@ class TocBuilder: f1.close() return None + def is_masked(self, rel_path): + parts = rel_path.split('/')[::-1] + for part in parts: + if part[0] == '_': + return True + + return False + def lookup(self): md_files = [] for root, dirs, files in os.walk(self.root_path): @@ -47,7 +55,8 @@ class TocBuilder: continue # skip files starting with '_' - if bname_split[0][0] == '_': + #if bname_split[0][0] == '_': + if self.is_masked(rel_path): continue # skip index files