aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-01-29 20:28:15 +0000
committerJohn Ankarström <john@ankarstrom.se>2021-01-29 20:28:15 +0000
commit4c9e15e5462e2baf1bb392569539b6a0adca7369 (patch)
tree1cbb17ad2d1fecb0c25e3337c0439bf3aecc6f1c
parent5c4dcffa4c0b206f985087ed0d2cd469f81c9cb0 (diff)
downloadem-4c9e15e5462e2baf1bb392569539b6a0adca7369.tar.gz
Handle round parentheses in inline formatting
-rwxr-xr-xaux/emparse22
1 files changed, 18 insertions, 4 deletions
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] = "<tt>" substr(w[i], 2)
@@ -98,6 +100,12 @@ function format(line) {
w[i] = "<i>" substr(w[i], 2)
else if (match(w[i], "^_"))
w[i] = "<b>" substr(w[i], 2)
+ else if (match(w[i], "^\\(`"))
+ w[i] = "(<tt>" substr(w[i], 3)
+ else if (match(w[i], "^\\(\\*"))
+ w[i] = "(<i>" substr(w[i], 3)
+ else if (match(w[i], "^\\(_"))
+ w[i] = "(<b>" substr(w[i], 3)
if (match(w[i], "`$"))
w[i] = substr(w[i], 1, RSTART-1) "</tt>"
@@ -105,11 +113,17 @@ function format(line) {
w[i] = substr(w[i], 1, RSTART-1) "</i>"
else if (match(w[i], "_$"))
w[i] = substr(w[i], 1, RSTART-1) "</b>"
- else if (match(w[i], "`[.,:;?!]$"))
+ else if (match(w[i], "`[.,:;?!)]$"))
w[i] = substr(w[i], 1, RSTART-1) "</tt>" substr(w[i], RSTART+1)
- else if (match(w[i], "\\*\.$"))
+ else if (match(w[i], "\\*[.,:;?!)]$"))
w[i] = substr(w[i], 1, RSTART-1) "</i>" substr(w[i], RSTART+1)
- else if (match(w[i], "_[.,:;?!]$"))
+ else if (match(w[i], "_[.,:;?!)]$"))
+ w[i] = substr(w[i], 1, RSTART-1) "</b>" substr(w[i], RSTART+1)
+ else if (match(w[i], "`\\)[.,:;?!]$"))
+ w[i] = substr(w[i], 1, RSTART-1) "</tt>" substr(w[i], RSTART+1)
+ else if (match(w[i], "\\*\\)[.,:;?!]$"))
+ w[i] = substr(w[i], 1, RSTART-1) "</i>" substr(w[i], RSTART+1)
+ else if (match(w[i], "_\\)[.,:;?!]$"))
w[i] = substr(w[i], 1, RSTART-1) "</b>" substr(w[i], RSTART+1)
printf "%s", w[i]