<[\/]A> */, "", gz_title);
gsub(/ *<[\/][Hh][123]>/, "", gz_title);
if (gz_title ~ /[.]/) { data_error("oops - input uses \".\""); }
gsub(/ *[:][:] *$/, ".", gz_title);
printf "\n";
printf "@sec{1}{chapter}{%d}\n", chnum;
printf "@sec{2}{chaptertitle}{0}\n";
printf "@text{gtit}\n\n";
printf " %s\n\n", gz_title;
printf "@sec{2}{chapterbody}{1}\n";
printf "@text{g}\n\n";
next;
}
/^/ {
next;
}
/^forms a part of / {
next;
}
/^Texts<[\/]A>/ {
next;
}
// {
lin = $0;
# Normalize internal spaces:
gsub(/ *[:][|][:] */, " :|: ", lin);
gsub(/ *[:][:] */, ":: ", lin);
gsub(/[ ]+$/, "", lin);
gsub(/[ ][ ]+/, " ", lin);
gsub(/^[ ]*/, " ", lin);
# Insert blank lines between apparent paragraphs:
gsub(/ *<[\/]*[Pp]> */, "\n\n ", lin);
# Replace SERA full stop "::" by ".":
# But first make sure that there is no "." already!
if (lin ~ /[.]/) { data_error("oops - input uses \".\""); }
gsub(/[:][:]/, ".", lin);
# Replace SERA parag mark ":|:" by "=" and a blank line:
# But first make sure that there is no "=" already!
if (lin ~ /[=]/) { data_error("oops - input uses \"=\""); }
gsub(/ *[:][|][:] */, "\n =\n\n ", lin);
print lin;
next;
}
function data_error(msg){
printf "%d: error: %s\n", FNR, msg > "/dev/stderr";
abort = 1;
exit abort;
}