diff options
1 files changed, 8 insertions, 5 deletions
| -rw-r--r-- | awk-edits/MEL-parser.awk | 13 |
diff --git a/awk-edits/MEL-parser.awk b/awk-edits/MEL-parser.awk index 248eff2..6cf0514 100644 --- a/awk-edits/MEL-parser.awk +++ b/awk-edits/MEL-parser.awk @@ -35,6 +35,8 @@ BEGIN { function usesMEL() { MELOPEN = "o" MELCLOSE = "c" + MELLINEOPEN = "lo" + MELLINECLOSE = "lc" MELINSERT = "i" MELPARAGRAPH = "p" MELLINE = "l" @@ -52,6 +54,7 @@ melInsideCode == 0 && /^[ \t]*(<p>|<dt>)?&[{[()\]}:.]/ { newLine = "" lineCopy = $0 paragraphed = 0 + append = "" while (match(lineCopy, /&(((::|[[{(:.])[^[:space:].:;[{(<>)}\]&]+)|[\]})])/)) { RSTART += 5 RLENGTH -= 5 @@ -67,12 +70,12 @@ melInsideCode == 0 && /^[ \t]*(<p>|<dt>)?&[{[()\]}:.]/ { replaceWith = MEL[name, MELINSERT] } - # Inside one line TODO + # Inside one line else if (substr(lineCopy, RSTART, 2) == "::") { name = substr(lineCopy, RSTART + 2, RLENGTH - 2) - # RLENGTH = length(lineCopy) - replaceWith = MEL[name, MELLINE] + replaceWith = MEL[name, MELLINEOPEN] + append = append MEL[name, MELLINECLOSE] } # Inside paragraph else if (substr(lineCopy, RSTART, 1) == ":") { @@ -93,7 +96,7 @@ melInsideCode == 0 && /^[ \t]*(<p>|<dt>)?&[{[()\]}:.]/ { newLine = newLine substr(lineCopy, 0, RSTART - 6) replaceWith lineCopy = substr(lineCopy, RSTART + RLENGTH) } - $0 = newLine lineCopy - if (paragraphed == 0 && length(newLine) > 0) + $0 = newLine lineCopy append + if (paragraphed == 0 && newLine != "") gsub(/(<p>|<\/p>)/, "") } |