program protecthtml(input, output);
(* protecthtml: protect html file containing less than and greater than
Tom Schneider
permanent email: toms@alum.mit.edu
toms@alum.mit.edu
https://alum.mit.edu/www/toms/
*)
label 1; (* end of program *)
const
(* begin module version *)
version = 1.00; (* of protecthtml.p 1999 July 22
origin 1999 July 22 *)
(* end module version *)
(* begin module describe.protecthtml *)
(*
name
protecthtml: protect html file containing less than and greater than
synopsis
protecthtml(input: in, output: out)
files
input: a piece of text containing "<" or ">" that is
intended to be html.
bfile:
output: the same text as input but protected
description
The lister program describe module contains an example with "<" and ">"
that gets interpreted even under the protection of the html PRE, wrecking
the example on the web page. This program protects the page by using the
anpersand.
examples
documentation
see also
lister.p
author
Thomas Dana Schneider
bugs
technical notes
*)
(* end module describe.protecthtml *)
(* begin module halt *)
procedure halt;
(* stop the program. the procedure performs a goto to the end of the
program. you must have a label:
label 1;
declared, and also the end of the program must have this label:
1: end.
examples are in the module libraries.
this is the only goto in the delila system. *)
begin
writeln(output,' program halt.');
goto 1
end;
(* end module halt version = 'delmod 6.16 84 mar 12 tds/gds'; *)
(* begin module protecthtml.themain *)
procedure themain(var afile, bfile: text);
(* the main procedure of the program *)
var
c: char; (* a character in the a file to move to the bfile *)
begin
while not eof(afile) do begin
if eoln(afile) then begin
readln(afile);
writeln(bfile);
end
else begin
read(afile,c);
if c = '<' then write(bfile,'<')
else if c = '>' then write(bfile,'>')
else if c = '&' then write(bfile,'&')
else write(bfile,c)
end
end;
end;
(* end module protecthtml.themain *)
begin
themain(input, output);
1: end.