From 9fafbd13c858e6db6248ae961aa4108d16bc4593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 30 Jan 2021 20:35:05 +0000 Subject: Support multiple numbers/letters in references (The letters are useful for hyperlink references.) --- emcollect | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'emcollect') diff --git a/emcollect b/emcollect index 55434ac..50f6a17 100755 --- a/emcollect +++ b/emcollect @@ -7,12 +7,12 @@ function collect(line) { right = $0 sub("^ \\[", "", left) sub("\\].*$", "", left) - sub("^ \\[[0-9a-z]\\]+ ", "", right) + sub("^ \\[[0-9a-z]+\\] ", "", right) printf "%s=%s\n", left, right } BEGIN { expectblock = 1 } /^$/ { expectblock = 1; getline } -expectblock && /^ \[[0-9a-z]\]+ / { block = "nl"; expectblock = 0 } -block = "nl" && /^ \[[0-9a-z]\]+ [^ ]+$/ { collect($0); next } +expectblock && /^ \[[0-9a-z]+\] / { block = "nl"; expectblock = 0 } +block = "nl" && /^ \[[0-9a-z]+\] [^ ]+$/ { collect($0); next } -- cgit v1.2.3