From 147e2923478959bc3cfa1cae37ada14a3b99fbe4 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 29 Sep 2022 10:16:47 +0300 Subject: [hooks/filelists] Made it more flexible and now there can be multiple ftags on a single line --- generate-hooks/create-file-lists.awk | 37 ++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/generate-hooks/create-file-lists.awk b/generate-hooks/create-file-lists.awk index 4a0f2f6..086d9dd 100644 --- a/generate-hooks/create-file-lists.awk +++ b/generate-hooks/create-file-lists.awk @@ -46,12 +46,37 @@ # &&nod no folder end (end file list, without having made a folder) # &&fod folder end +BEGIN { + nam[1] = "nos" + rep[1] = "" + nam[2] = "fos" + rep[2] = "
" + nam[3] = "fs0" + rep[3] = "
" + nam[4] = "fs" + rep[4] = "" + nam[5] = "nod" + rep[5] = "
" + nam[6] = "fod" + rep[6] = "" + + for (i = 1; i <= length(nam); i++) { + pat[i] = "&&" nam[i] + } +} + +function substitute(ind) { + gsub(/(

|<\/p>)/, "") + gsub(pat[ind], rep[ind]) +} + +/^[ \t]*(

|)&&/ { + for (i = 1; i <= length(nam); i++) { + if (index($0, nam[i]) != 0) + substitute(i) + } +} + { - gsub(/&&nos/, "") - gsub(/^

&&fos$/, "

") - gsub(/^&&fs0$/, "
") - gsub(/^&&fs$/, "") - gsub(/^&&nod<\/p>$/, "
") - gsub(/^&&fod<\/p>$/, "") print } -- cgit v1.3.1-26-gb76a