Skip to content

Commit

Permalink
Create site with documentation #164 : fix #links
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Mar 6, 2024
1 parent 40fc413 commit e819df8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mdbooker.awk
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ function handleTitle(h,pass, md,indent,dir,i,path) {

END { handleTitle(-1, 1); pass2() }

function pass2( l) {
function pass2( l,f,t) {
Title = Content = ""
while (getline < FILENAME > 0) {
if (match($0, /^#+/))
handleTitle(RLENGTH, 2)
else {
if (match(l = $0, /]\(#[^)]+\)/))
l = substr(l, 1, RSTART - 1) "](" Link2Path[substr(l, RSTART + 3, RLENGTH - 4)] ")" substr(l, RSTART + RLENGTH)
if (match(l = $0, /]\(#[^)]+\)/)) {
print " fix link: #" (f=substr(l, RSTART + 3, RLENGTH - 4)) " -> " (t = Link2Path[f])
l = substr(l, 1, RSTART - 1) "](" t ")" substr(l, RSTART + RLENGTH)
}
Content = Content "\n" l
}
}
Expand Down

0 comments on commit e819df8

Please sign in to comment.