") {
isCode = 1;
printf("");
# set the field separator before we read the next line
# so we can read char by char
FS = "";
next;
}
if ($0 == "
") {
isCode = 0;
print "";
# reset field separator to default before reading next line
FS = " ";
next;
}
#if the thing we're in is a code block
if (isCode == 1) {
if ($0 == "") {
print "";
next;
}
# convert special html chars to web safe versions
field = 1;
while (field <= NF) {
if ($field == "&") {
printf "&";
} else if ($field == "<") {
printf "<";
} else if ($field == ">") {
printf ">";
} else if ($field == "\"") {
printf """;
} else if ($field == "'") {
printf "'";
} else {
printf $field;
}
field++;
if (field > NF) {
print "";
}
}
}
if (isCode == 0) {
# if the line is empty, make it a