#!/usr/local/bin/perl # "Processing" of the prased sgml. We do three things: # 1) Turn the processing directives in a .asp file into SGML markup directives. # Specifically, HTML (thus showing what HTML is). Yuck. # 2) Turn titles in the body into STITLES so that sgmlsasp can deal with them # differently than titles in the HEAD. # 3) Numbers the SECTION and QUESTION sections. It was tempting to do this with # attributes, but the processing phase is a better place to do it. # 4) Turn &'s back int &'s. $print = 1 ; $question = 1 ; while (<>) { s#^\?/#)# ; s#^\?#(# ; $body = 1 if /^\(BODY$/ ; s/^([\(\)])TITLE/$1STITLE/ if $body ; if (/^\(SECTION$/) { $section += 1 ; $version = "$section: " ; $question = 1 ; } if ($section) { $version = "$section." . $question++ . ": " if /^\(Q$/ ; } else { $version = $question++ . ': ' if /^\(Q$/ ; } $version = "" if $version && s/^-/-$version/ ; # GF doesn't seem to like meta, so we'll strip it out for now # Doesn't come from here anyway. $print = 0 if /^\((ALT)?HDR/ ; s/\&/\&/ if /^-/ ; print if $print ; $print = 1 if /^\)(ALT)?HDR/ ; # turn printing back on for next time }