From 0ea280a430b11ad60ad91e7363eed9eda18e1906 Mon Sep 17 00:00:00 2001
From: Mike Gerwitz
Date: Tue, 9 Oct 2012 23:31:40 -0400
Subject: [PATCH] References in text are now converted into hyperlinks
References are bracketed---they are converted into superscripts. If text
immediately preceeding the reference is bracketed, it is also hyperlinked.
---
msgfmt | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/msgfmt b/msgfmt
index 1ac4619..a21f740 100755
--- a/msgfmt
+++ b/msgfmt
@@ -34,8 +34,14 @@ awk '/^diff --git/ { exit } { print }' \
# happen
s#[fh]ttps\?://[^]\n )]\+#&#g;
+ # reference definitions (footnotes)
+ s#\n\[\([0-9]\+\)\]#
g;
+
+ # references in text
+ s|\[\([^]]\+\)\]\[\([0-9]\+\)\]|\1\[\2\]|g
+ s|\[\([0-9]\+\)\]|&|g
+
# paragraphs
- s#\n\[[0-9]\+\]#
g;
s#\n\n#
&#g;
# basic formatting