[master] 17b878b Recoding doxygen in awk is fun

Guillaume Quintard guillaume at varnish-software.com
Mon Jun 6 11:01:08 CEST 2016


commit 17b878b34b981df821ca3589524cc9824db2a3f4
Author: Guillaume Quintard <guillaume at varnish-software.com>
Date:   Mon May 30 12:53:31 2016 +0200

    Recoding doxygen in awk is fun

diff --git a/doc/sphinx/vtc-syntax.vtc b/doc/sphinx/vtc-syntax.vtc
new file mode 100644
index 0000000..ef67591
--- /dev/null
+++ b/doc/sphinx/vtc-syntax.vtc
@@ -0,0 +1,41 @@
+# end of paragraph if we hit '*/'
+$0 ~ "*/" {
+	p = 0;
+}
+
+# if in paragraph and no section is announced,
+# concatenate
+p && $0 !~ "[ /]* SECTION: " {
+	cl[section] = cl[section]  gensub(/ \* ?/, "", "1", $0) "\n";
+}
+
+# section announcement
+$0 ~ "[ /]* SECTION: " {
+	section = $3;
+	sl[len++] = section;
+	tl[section] = gensub(/[\t ]*\/?\* SECTION: [^ ]+ +/, "", "1", $0);
+	p = 1;
+}
+
+# sort sections, underline titles, print
+END {
+	asort(sl);
+	for (i in sl) {
+		section = sl[i]
+		print(tl[section]);
+		a = section
+		c = gsub(/\./, "", a);
+		if (c == 0)
+			r = "=";
+		else if (c == 1)
+			r = "*"
+		else if (c == 2)
+			r = "+"
+		else if (c == 3)
+			r = "-"
+		else
+			r = "."
+		print(gensub(/./, r, "g", tl[section]));
+		print(cl[section]);
+	}
+}



More information about the varnish-commit mailing list