Skip to content

Commit

Permalink
Create site with documentation #164
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Mar 5, 2024
1 parent e4b8f78 commit 52277d3
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions mdbooker.awk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ BEGIN {
/^### / { handleTitle(3); next }
/^#### / { handleTitle(4); next }
/^#####/ { print "error: #####"; exit 1 }
{ Content = Content $0 "\n"; next }
{ Content = Content "\n" $0; next }

function handleTitle(h, md,indent,dir,i,path) {
if (Title) {
Expand All @@ -19,14 +19,12 @@ function handleTitle(h, md,indent,dir,i,path) {
print "generating: " (path = dir (dir ? "/" : "") (md = fname(Title) ".md")) "..."
if (dir)
system("mkdir -p '" BOOK dir "'")
print "# " Title > BOOK path
print Content >> BOOK path
print Content > BOOK path
if ((indent = H - 2) < 0)
indent = 0
printf "%" (indent * 4) "s%s[%s](%s)\n", "", 1 == H ? "" : "- ", Title, path >> SUMMARY
}
PathElements[H = h] = Title = trim(substr($0, h + 1))
Content = ""
Content = "# " (Title = PathElements[H = h] = trim(substr($0, h + 1)))
}

END { handleTitle(-1) }
Expand Down

0 comments on commit 52277d3

Please sign in to comment.