From 4c9e15e5462e2baf1bb392569539b6a0adca7369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Fri, 29 Jan 2021 20:28:15 +0000 Subject: Handle round parentheses in inline formatting --- aux/emparse | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'aux/emparse') diff --git a/aux/emparse b/aux/emparse index e7e1fb5..65644e9 100755 --- a/aux/emparse +++ b/aux/emparse @@ -89,8 +89,10 @@ function format(line) { if (match(w[i], "^\\[[0-9a-z]+\\]$")) w[i] = ref(substr(w[i], 2, RLENGTH-2)) - else if (match(w[i], "^\[[0-9a-z]+\][.,:;?!]$")) + else if (match(w[i], "^\\[[0-9a-z]+\\][.,:;?!)]$")) w[i] = ref(substr(w[i], 2, RLENGTH-3)) substr(w[i], RLENGTH) + else if (match(w[i], "^\\[[0-9a-z]+\\]\\)[.,:;?!]$")) + w[i] = ref(substr(w[i], 2, RLENGTH-4)) substr(w[i], RLENGTH-1) if (match(w[i], "^`")) w[i] = "" substr(w[i], 2) @@ -98,6 +100,12 @@ function format(line) { w[i] = "" substr(w[i], 2) else if (match(w[i], "^_")) w[i] = "" substr(w[i], 2) + else if (match(w[i], "^\\(`")) + w[i] = "(" substr(w[i], 3) + else if (match(w[i], "^\\(\\*")) + w[i] = "(" substr(w[i], 3) + else if (match(w[i], "^\\(_")) + w[i] = "(" substr(w[i], 3) if (match(w[i], "`$")) w[i] = substr(w[i], 1, RSTART-1) "" @@ -105,11 +113,17 @@ function format(line) { w[i] = substr(w[i], 1, RSTART-1) "" else if (match(w[i], "_$")) w[i] = substr(w[i], 1, RSTART-1) "" - else if (match(w[i], "`[.,:;?!]$")) + else if (match(w[i], "`[.,:;?!)]$")) w[i] = substr(w[i], 1, RSTART-1) "" substr(w[i], RSTART+1) - else if (match(w[i], "\\*\.$")) + else if (match(w[i], "\\*[.,:;?!)]$")) w[i] = substr(w[i], 1, RSTART-1) "" substr(w[i], RSTART+1) - else if (match(w[i], "_[.,:;?!]$")) + else if (match(w[i], "_[.,:;?!)]$")) + w[i] = substr(w[i], 1, RSTART-1) "" substr(w[i], RSTART+1) + else if (match(w[i], "`\\)[.,:;?!]$")) + w[i] = substr(w[i], 1, RSTART-1) "" substr(w[i], RSTART+1) + else if (match(w[i], "\\*\\)[.,:;?!]$")) + w[i] = substr(w[i], 1, RSTART-1) "" substr(w[i], RSTART+1) + else if (match(w[i], "_\\)[.,:;?!]$")) w[i] = substr(w[i], 1, RSTART-1) "" substr(w[i], RSTART+1) printf "%s", w[i] -- cgit v1.2.3