diff options
author | John Ankarström <john@ankarstrom.se> | 2021-01-30 20:35:05 +0000 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-01-30 20:35:05 +0000 |
commit | 9fafbd13c858e6db6248ae961aa4108d16bc4593 (patch) | |
tree | 7e0f4a2de8219c5e01f6f8a87d2e393e51e9ab1d /emcollect | |
parent | 78791fdc6a351726aa536ef23e332cce2ff19737 (diff) | |
download | em-9fafbd13c858e6db6248ae961aa4108d16bc4593.tar.gz |
Support multiple numbers/letters in references
(The letters are useful for hyperlink references.)
Diffstat (limited to 'emcollect')
-rwxr-xr-x | emcollect | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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 } |