diff options
(awk-edits/MEL) Fixed logic for underline
1 files changed, 8 insertions, 8 deletions
| -rw-r--r-- | awk-edits/MEL-parser.awk | 16 |
diff --git a/awk-edits/MEL-parser.awk b/awk-edits/MEL-parser.awk index 90234d4..f0a8f84 100644 --- a/awk-edits/MEL-parser.awk +++ b/awk-edits/MEL-parser.awk @@ -43,13 +43,13 @@ function usesMEL() { } function printErr(message, column, columnPointer) { - column = RSTART + length(newLine) - 5 + column = length($0) - length(lineCopy) + RSTART - 5 print "ERROR by MEL-parser.awk: " message " | Found in " FILENAME " at line " FNR " & column " column ":" > "/dev/stderr" columnPointer = "" - for (i = -5; i < RLENGTH; i++) - columnPointer = "^" columnPointer for (i = 1; i < column; i++) - columnPointer = " " columnPointer + columnPointer = columnPointer " " + for (i = -5; i < RLENGTH; i++) + columnPointer = columnPointer "^" print $0 "\n" columnPointer "\n" > "/dev/stderr" } @@ -95,7 +95,6 @@ melInsideCode == 0 && /^[ \t]*(<p>|<dt>)?&[{[()\]}:.]/ { replaceWith = MEL[name, MELLINEOPEN] append = append MEL[name, MELLINECLOSE] - if (replaceWith == "" && append == "") printErr("Unknown single line tag \"" name "\"") else if (replaceWith == "") @@ -108,12 +107,13 @@ melInsideCode == 0 && /^[ \t]*(<p>|<dt>)?&[{[()\]}:.]/ { name = substr(lineCopy, RSTART + 1, RLENGTH - 1) replaceWith = " " MEL[name, MELPARAGRAPH] + + if (replaceWith == " ") + printErr("Unknown paragraph tag \"" name "\"") + RSTART -= 1 RLENGTH += 1 paragraphed = 1 - - if (replaceWith == "") - printErr("Unknown paragraph tag \"" name "\"") } # Inside opening tag else { |