From 62ba4e49e152f3f29e92b650eec6d06845bb1b86 Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Sat, 24 Aug 2019 19:58:13 +0200 Subject: Add uid-gid.txt → wiki conversion script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- bin/uidgid2wiki.awk | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100755 bin/uidgid2wiki.awk (limited to 'bin') diff --git a/bin/uidgid2wiki.awk b/bin/uidgid2wiki.awk new file mode 100755 index 0000000..3c3e22f --- /dev/null +++ b/bin/uidgid2wiki.awk @@ -0,0 +1,60 @@ +#!/usr/bin/awk -f + +BEGIN { + print "{|class=\"wikitable sortable\"" + print "! Name" + print "! data-sort-type=\"number\" | UID" + print "! data-sort-type=\"number\" | GID" + print "! Provider" + print "! class=unsortable | Notes" +} + +function md2wiki(str) { + return gensub(/\[([^\]]+)\]\(([^)]+)\)/, "[\\2 \\1]", "g", str) +} + +/^[^#]/ { + print "|-" + # name + print "| " $1 + # uid + print "| " $2 + # gid + print "| " $3 + # provider + switch ($4) { + case "baselayout": + print "| style=\"background: #cff;\" | baselayout (linux)" + break + case "baselayout-fbsd": + print "| style=\"background: #ccf;\" | baselayout (fbsd)" + break + case "acct": + printf "%s", "| style=\"background: #9fc;\" |" + if ($2 != "-") printf " %s", "[https://gitweb.gentoo.org/repo/gentoo.git/tree/acct-user/" $1 " u:" $1 "]" + if ($3 != "-") printf " %s", "[https://gitweb.gentoo.org/repo/gentoo.git/tree/acct-group/" $1 " g:" $1 "]" + print "" + break + case "requested": + print "| style=\"background: #ffe;\" | requested" + break + case "reserved": + print "| style=\"background: #fcf;\" | reserved" + break + case "user.eclass": + print "| style=\"background: #dca;\" | user.eclass" + break + case "historical": + print "| style=\"background: #fee;\" | historical" + break + default: + print "| " $4 + } + # notes + $1=$2=$3=$4="" + print "| " md2wiki(substr($0, 5)) +} + +END { + print "|}" +} -- cgit v1.2.3-65-gdbad