Difference between pages "Oberon/S3.HTML.Mod" and "Oberon/A2/Oberon.HTML.Mod"

(Difference between pages)
Jump to navigation Jump to search
[checked revision][checked revision]
m (Corrected characters in statement IF ch = "ü" THEN S("ü") ... END.)
 
(Initialized from Oberon.HTML.Mod in LinuxAos rev.6661.)
 
Line 1: Line 1:
<span style="font-size: 74%"><span style="color: #000000">(* ETH Oberon, Copyright 1990-2003 Computer Systems Institute, ETH Zurich, CH-8092 Zurich.
+
<span style="font-size: 74%"><span style="color: #000000">(* ETH Oberon, Copyright 2001 ETH Zuerich Institut fuer Computersysteme, ETH Zentrum, CH-8092 Zuerich.
  +
Refer to the "General ETH Oberon System Source License" contract available at: http://www.oberon.ethz.ch/ *)
Refer to the license.txt file provided with this distribution. *)
 
 
 
MODULE HTML; (** portable *) (* jm 26.8.94 *)
+
MODULE HTML IN Oberon; (** portable *) (* jm 26.8.94 *)
 
 
 
IMPORT
 
IMPORT
Line 18: Line 18:
 
 
 
tab = 09X;
 
tab = 09X;
  +
 
 
DocHeader = TRUE; (* include document header comment *)
 
DocHeader = TRUE; (* include document header comment *)
 
BodyColor = TRUE; (* set body color - HTML 4-specific *)
 
BodyColor = TRUE; (* set body color - HTML 4-specific *)
Line 58: Line 58:
 
BEGIN
 
BEGIN
 
beg := Texts.Pos(R); end := beg; lastnl := beg;
 
beg := Texts.Pos(R); end := beg; lastnl := beg;
  +
 
 
(* skip empty lines *)
 
(* skip empty lines *)
 
Texts.Read(R, ch);
 
Texts.Read(R, ch);
Line 66: Line 66:
 
Texts.Read(R, ch)
 
Texts.Read(R, ch)
 
END;
 
END;
  +
 
 
IF ~R.eot THEN
 
IF ~R.eot THEN
 
firstch := ch; firstfnt := R.lib; firstcol := R.col;
 
firstch := ch; firstfnt := R.lib; firstcol := R.col;
Line 93: Line 93:
 
VAR R: Texts.Reader; ch: CHAR; lastlib: Objects.Library;
 
VAR R: Texts.Reader; ch: CHAR; lastlib: Objects.Library;
 
BEGIN
 
BEGIN
IF end &#62; beg THEN
+
IF end &#62; beg THEN
 
Texts.OpenReader(R, T, beg);
 
Texts.OpenReader(R, T, beg);
 
Texts.Read(R, ch); lastlib := R.lib;
 
Texts.Read(R, ch); lastlib := R.lib;
Line 105: Line 105:
 
lastlib := R.lib
 
lastlib := R.lib
 
END;
 
END;
IF ch = "&uuml;" THEN S("&#38;uuml;")
+
</span><span style="color: #FF0000"> IF ch = 085X THEN S("&#38;uuml;")
ELSIF ch = "&Uuml;" THEN S("&#38;Uuml;")
+
ELSIF ch = 082X THEN S("&#38;Uuml;")
ELSIF ch = "&ugrave;" THEN S("&#38;ugrave;")
+
ELSIF ch = 08FX THEN S("&#38;ugrave;")
ELSIF ch = "&auml;" THEN S("&#38;auml;")
+
ELSIF ch = 083X THEN S("&#38;auml;")
ELSIF ch = "&Auml;" THEN S("&#38;Auml;")
+
ELSIF ch = 080X THEN S("&#38;Auml;")
ELSIF ch = "&aacute;" THEN S("&#38;aacute;")
+
ELSIF ch = 094X THEN S("&#38;aacute;")
ELSIF ch = "&agrave;" THEN S("&#38;agrave;")
+
ELSIF ch = 08BX THEN S("&#38;agrave;")
ELSIF ch = "&euml;" THEN S("&#38;euml;")
+
ELSIF ch = 091X THEN S("&#38;euml;")
ELSIF ch = "&eacute;" THEN S("&#38;eacute;")
+
ELSIF ch = 090X THEN S("&#38;eacute;")
ELSIF ch = "&egrave;" THEN S("&#38;egrave;")
+
ELSIF ch = 08CX THEN S("&#38;egrave;")
ELSIF ch = "&ouml;" THEN S("&#38;ouml;")
+
ELSIF ch = 084X THEN S("&#38;ouml;")
ELSIF ch = "&Ouml;" THEN S("&#38;Ouml;")
+
ELSIF ch = 081X THEN S("&#38;Ouml;")
ELSIF ch = "&ograve;" THEN S("&#38;ograve;")
+
ELSIF ch = 08EX THEN S("&#38;ograve;")
ELSIF ch = "&iuml;" THEN S("&#38;iuml;")
+
ELSIF ch = 092X THEN S("&#38;iuml;")
ELSIF ch = "&igrave;" THEN S("&#38;igrave;")
+
ELSIF ch = 08DX THEN S("&#38;igrave;")
ELSIF ch = 0DX THEN C(" "); C(sep)
+
ELS</span><span style="color: #000000">IF ch = 0DX THEN C(" "); C(sep)
 
ELSIF ch = tab THEN S("&#38;nbsp; &#38;nbsp; &#38;nbsp;")
 
ELSIF ch = tab THEN S("&#38;nbsp; &#38;nbsp; &#38;nbsp;")
 
ELSIF (ch &#62;= " ") OR (ch = "-") THEN
 
ELSIF (ch &#62;= " ") OR (ch = "-") THEN
Line 136: Line 136:
 
BEGIN col := -1; pos := beg; anchor := "";
 
BEGIN col := -1; pos := beg; anchor := "";
 
Texts.OpenReader(R, T, beg);
 
Texts.OpenReader(R, T, beg);
Texts.Read(R, ch);
+
Texts.Read(R, ch);
 
WHILE pos &#60; end DO
 
WHILE pos &#60; end DO
 
IF (R.col = 3) &#38; (col # 3) THEN (* start link *)
 
IF (R.col = 3) &#38; (col # 3) THEN (* start link *)
Line 142: Line 142:
 
END;
 
END;
 
col := R.col;
 
col := R.col;
  +
 
 
IF (col = 3) &#38; (ch = "{") THEN (* reading an anchor *)
 
IF (col = 3) &#38; (ch = "{") THEN (* reading an anchor *)
 
lstart := pos;
 
lstart := pos;
Line 191: Line 191:
 
body := TRUE
 
body := TRUE
 
END StartBody;
 
END StartBody;
</span><span style="color: #000000">
+
</span><span style="color: #000000">
 
BEGIN
 
BEGIN
 
italic := FALSE; </span><span style="color: #0000FF">body := FALSE;
 
italic := FALSE; </span><span style="color: #0000FF">body := FALSE;
Line 227: Line 227:
 
IF typ = heading THEN S("&#60;/h2&#62;") END;
 
IF typ = heading THEN S("&#60;/h2&#62;") END;
 
</span><span style="color: #0000FF">IF beg # end THEN</span><span style="color: #000000"> L </span><span style="color: #0000FF">END</span><span style="color: #000000">;
 
</span><span style="color: #0000FF">IF beg # end THEN</span><span style="color: #000000"> L </span><span style="color: #0000FF">END</span><span style="color: #000000">;
  +
 
 
(* List *)
 
(* List *)
 
IF (ntyp = bullet) &#38; (typ # bullet) THEN (* open list *)
 
IF (ntyp = bullet) &#38; (typ # bullet) THEN (* open list *)
Line 234: Line 234:
 
</span><span style="color: #FF0000"> </span><span style="color: #000000">S("&#60;/ul&#62;"); L</span><span style="color: #FF0000">
 
</span><span style="color: #FF0000"> </span><span style="color: #000000">S("&#60;/ul&#62;"); L</span><span style="color: #FF0000">
 
</span><span style="color: #000000"> END;
 
</span><span style="color: #000000"> END;
  +
 
 
(* Pre-formatted text *)
 
(* Pre-formatted text *)
 
IF (ntyp = pre) &#38; (typ # pre) THEN (* start pre-formatted text *)
 
IF (ntyp = pre) &#38; (typ # pre) THEN (* start pre-formatted text *)
</span><span style="color: #0000FF"> IF ~body THEN StartBody END;
+
</span><span style="color: #FF0000"> IF ~body THEN StartBody END;
 
</span><span style="color: #000000"> S("&#60;pre&#62;")
 
</span><span style="color: #000000"> S("&#60;pre&#62;")
 
ELSIF (ntyp # pre) &#38; (typ = pre) THEN
 
ELSIF (ntyp # pre) &#38; (typ = pre) THEN
 
S("&#60;/pre&#62;"); L
 
S("&#60;/pre&#62;"); L
 
END;
 
END;
  +
 
 
(* Separate 2 consecutive "normal" paragraphs with a paragraph break, except two preformatteds *)
 
(* Separate 2 consecutive "normal" paragraphs with a paragraph break, except two preformatteds *)
 
IF (ntyp = para) &#38; (typ = para) THEN S("&#60;p&#62;"); L END;
 
IF (ntyp = para) &#38; (typ = para) THEN S("&#60;p&#62;"); L END;
  +
 
 
end := nend; beg := nbeg; typ := ntyp
 
end := nend; beg := nbeg; typ := ntyp
 
END;
 
END;
Line 260: Line 260:
 
END ConvertText;
 
END ConvertText;
 
 
(** Show a preview of the HTML text in a text viewer - Processes ONLY one text! *)
+
(** Show a preview of the HTML text in a text viewer - Processes ONLY one text! *)
 
PROCEDURE Show*;
 
PROCEDURE Show*;
 
VAR S: Texts.Scanner; T, t: Texts.Text; time, beg, end: LONGINT;
 
VAR S: Texts.Scanner; T, t: Texts.Text; time, beg, end: LONGINT;
Line 299: Line 299:
 
VAR S: Texts.Scanner; T: Texts.Text; filename: ARRAY 64 OF CHAR; f: Files.File; beg, end, time: LONGINT;
 
VAR S: Texts.Scanner; T: Texts.Text; filename: ARRAY 64 OF CHAR; f: Files.File; beg, end, time: LONGINT;
 
 
PROCEDURE CompileT();
+
PROCEDURE CompileT;
 
VAR R: Texts.Reader; beg, end: LONGINT; typ: SHORTINT;
 
VAR R: Texts.Reader; beg, end: LONGINT; typ: SHORTINT;
 
res, i: INTEGER; bak: ARRAY 64 OF CHAR;
 
res, i: INTEGER; bak: ARRAY 64 OF CHAR;
Line 329: Line 329:
 
Out.Ln
 
Out.Ln
 
END CompileT;
 
END CompileT;
  +
 
 
BEGIN
 
BEGIN
 
sep := 0AX;
 
sep := 0AX;