diff options
author | John Ankarström <john@ankarstrom.se> | 2021-01-29 20:01:12 +0000 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-01-29 20:01:12 +0000 |
commit | 67a5d6cb71ccde36ffa31335d307fd82cda92861 (patch) | |
tree | 04786470bfd5cb34d99bd650f301bbe1d1861c5c /aux/emcollect | |
parent | eb8d329d93efa56c8afa4106932b0dfe62eef50e (diff) | |
download | em-67a5d6cb71ccde36ffa31335d307fd82cda92861.tar.gz |
Add hyperlink references
This requires two passes, the first done by aux/emcollect,
the second by aux/emparse (the main awk script).
Diffstat (limited to 'aux/emcollect')
-rwxr-xr-x | aux/emcollect | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/aux/emcollect b/aux/emcollect new file mode 100755 index 0000000..55434ac --- /dev/null +++ b/aux/emcollect @@ -0,0 +1,18 @@ +#!/bin/awk -f + +# aux/emcollect -- collect hyperlink references in em source + +function collect(line) { + left = $0 + right = $0 + sub("^ \\[", "", left) + sub("\\].*$", "", left) + 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 } |