Summary Files Commits Branches @commit @diff @stats
path: root / generate-hooks / create-pagenav.awk
diff options
context:
space:
mode:
Commit0187e255a811bebb0dad3624f2c6d78b829d15c5 (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-01-17 16:15:28 +0200
Committer
 Syndamia <kamen@syndamia.com>
2023-01-17 16:15:28 +0200
Files68efd3520e72c8c8c553fdda7b9391d9ec4e9feb /generate-hooks/create-pagenav.awk
syndamia.com-0187e255a811bebb0dad3624f2c6d78b829d15c5.tar
syndamia.com-0187e255a811bebb0dad3624f2c6d78b829d15c5.tar.gz
syndamia.com-0187e255a811bebb0dad3624f2c6d78b829d15c5.zip
Parentda000c477625bb533688df84bd95ba3a3aff3246 (diff)
[awk] Reworked generation to happen via a combined script, updated scripts and added info in scripts readme
1 files changed, 0 insertions, 48 deletions
-rw-r--r--generate-hooks/create-pagenav.awk48
diff --git a/generate-hooks/create-pagenav.awk b/generate-hooks/create-pagenav.awk
deleted file mode 100644
index d539837..0000000
--- a/generate-hooks/create-pagenav.awk
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# == 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 the generate-hooks.
-# Creation and last edited dates are taken from git commits, and getting the correct info
-# by file name can easily only be done with git log, which unfortunately is 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.
-
-BEGIN {
- fileCheck = ARGV[1] # FILENAME isn't available in BEGIN
-
- if (match(fileCheck, /(blog|tutorials)\/.*\//) == 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 \
-"<div id=\"pagenav\">" ORS \
-" <strong>Created: " dateCreate "</strong> || <strong>Edited: " dateEdited "</strong>" ORS \
-" || <a href=\"https://gitlab.com/Syndamia/syndamiadotcom/-/blob/master/src/" fileCheck "\"><strong>GitLab source</strong></a>" ORS \
-"</div>"
- }
-}
-
-{
- print
-}
-
-found == 0 && /<h1.*/ {
- print elem
- found = 1
-}