# paragraph.awk # # Enclose nonblank, nontagged paragraphs in

...

# Only process paragraphs in the of the HTML page, not the # to avoid messing up any embedded styles or other header information # Add blank

between consecutive zed or mixed paragraphs # # 17-Jan-2000 J. Jacky Add space paragraph between consecutive formal paras. BEGIN { blank = 0; tagged = 1; informal = 2; formal = 3; # mnemonics curr = blank; para = informal; body = 0; } { prev = curr; prev_para = para; if (!body && ($0 ~ /^[ ]*/)) body = 1; # entered page body curr = informal; if ($0 ~ /^[ ]*$/) curr = blank; # empty lines, also spaces and tabs if ($0 ~ /^[ ]*/) curr = informal; if ($0 ~ /^[ ]*/) curr = informal; if ($0 ~ /^[ ]*/) curr = informal; if ($0 ~ /^[ ]*"; if (prev == informal && curr != informal && body) print "

"; # Assign para just to determine when we need spacer between formal paras. if (informal == curr) para = informal; if ($0 ~ /^[ ]* etc. # Do not assign para at blank line - retain previous para through blank lines # New formal paragraph if (($0 ~ /
/) || ($0 ~ /
/)) { para = formal; if (prev_para == formal) print "

\n"; } print $0; } END { if (curr == informal) print "

"; # informal last line, no blank after }