# # == About == # # I call pagenav the stuff directly below the first h1. These include file dates # and GitLab source link. # Currently it only works for blog and tutorial pages. # # This is by far the most hard-coded and inefficient awk script in awk-edits. # Creation and last edited dates are taken from git commits, and getting the correct info # by file name can only be done (easily) with git log, which is unfortunately very slow. # Another issue is that it depends on the build directories in build scripts, meaning # it won't work without modification if you try to build it somewhere else. # # Split into Pagenav.awk and post-pagenav.awk BEGIN { fileCheck = ARGV[1] # FILENAME isn't available in BEGIN if (match(fileCheck, /(blog|tutorials|talks)\/.*\//) == 0) { found = 1 } else { found = 0 gsub(/^.*\/(synd|tiny.synd|website|tiny.website)\//, "", fileCheck); gsub(/\.html/, ".md", fileCheck) system("git log --follow --pretty=format:%ad --date=\"format:%d %B %Y\" -- src/" fileCheck " > /tmp/syndamiadotcom-pagenav") dateCreate = "" dateEdited = "" while ((getline < "/tmp/syndamiadotcom-pagenav") > 0) { if (dateEdited == "") dateEdited = $0 dateCreate = $0 } elem = ORS \ "
" } }