/usr/bin/apertium-utils-fixlatex is in apertium 3.4.2~r68466-4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | #!/bin/bash
INPUT_FILE=/dev/stdin
OUTPUT_FILE=/dev/stdout
cat $INPUT_FILE | \
gawk '
function is_inline_tag(str, aux, val)
{
for(val in INLINETAGS)
{
aux = INLINETAGS[val] "<CONTENTS>";
if(gsub(aux, aux, str) == 1)
{
return 1;
}
}
return 0;
}
BEGIN{
RS="</CONTENTS>";
INLINETAGS[1]="<textit/>";
INLINETAGS[2]="<textbf/>";
INLINETAGS[3]="<emph/>";
}
{
MYRECORD[++nline] = $0;
}
END{
for(i=1; i < nline; i++)
{
if(gsub("<CONTENTS>", "<CONTENTS>", MYRECORD[i]) == 1)
{
if(is_inline_tag(MYRECORD[i]))
{
printf("%s</CONTENTS-noeos>", MYRECORD[i]);
}
else
{
printf("%s</CONTENTS>", MYRECORD[i]);
}
}
else
{
printf("%s</CONTENTS>", MYRECORD[i]);
}
}
printf("%s", MYRECORD[nline]);
}' > $OUTPUT_FILE
|