aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2022-07-15 16:55:20 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2022-07-15 16:55:20 -0400
commit4ee2a8ea9efa633a16c7a7dc2e1f4591afbf540b (patch)
tree47edc1be85c793a12934ebfcffa5b6673ff28b4a
parentaf7af923366fe116019e50785e56def172a6a1ab (diff)
Handle case where gendocs is called from another directory
-rwxr-xr-xgendocs8
1 files changed, 5 insertions, 3 deletions
diff --git a/gendocs b/gendocs
index 9faefb68..09912d52 100755
--- a/gendocs
+++ b/gendocs
@@ -1,10 +1,12 @@
#! /usr/bin/env bqn
# Generate HTML files from markdown ones
-# •args gives a list of files if present; otherwise convert everything
-files ← { 0<≠•args ? •args ;
+At‿List‿Type ← •file
+files ← {
+ # •args gives a list of files, but if it's empty, convert everything
+ 0<≠•args ? (('/'=⊑)⊸↓•path∾⁼•wdpath⊸At)¨ •args
+;
# All markdown files in directories corresponding to ones in docs/
- At‿List‿Type ← •file
SubDirs ← { 𝕩 <⊸∾ ∾ 𝕊¨ ('d'=Type¨)⊸/ 𝕩⊸At¨ List 𝕩 }
∾ (<At¨·(".md"≡¯3⊸↑)¨⊸/List)¨ (≠↓¨SubDirs) "docs/"
}