-
Notifications
You must be signed in to change notification settings - Fork 2
/
test3.pas
65 lines (57 loc) · 1.69 KB
/
test3.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
program webTest;
uses SysUtils;
const
Po = '<p>'; // buka paragraf
Pc = '</p>'; // tutup paragraf
BR = '<br/>'; // baris baru
// menulis kepala html
procedure writeHeader(const aTitle: string; const loadCSS: string = '');
begin
writeln('content-type: text/html;');
writeln; // penting!
writeln('<!DOCTYPE html>');
writeln('<html><head>');
writeln('<meta charset="utf-8">');
writeln('<meta name="viewport" content="width=device-width,initial-scale=1">');
if loadCSS <> '' then writeln('<link rel="stylesheet" href="',loadCSS,'">');
writeln('<title>',aTitle,'</title>');
writeln('</head><body>');
writeln('<!-- isi laman mulai dari sini -->');
end;
// menulis kaki html
procedure writeFooter;
begin
writeln('<!-- isi laman berhenti di sini -->');
writeln('</body></html>');
end;
// menulis judul html
procedure writeTitle(const aTitle: string; aLevel: integer = 1);
begin
if aLevel < 1 then aLevel := 1; // nilai terendah
if aLevel > 6 then aLevel := 6; // nilai tertinggi
writeln('<h',aLevel,'>',aTitle,'</h',aLevel,'>');
end;
// menulis span html
function span(const aText:string; const aClass:string=''; const aID:string=''): string;
begin
Result := '<span';
if aClass <> '' then Result += ' class="'+aClass+'"';
if aID <> '' then Result += ' id="'+aID+'"';
Result += '>'+aText+'</span>';
end;
// menulis isi laman
procedure writeContent;
var
i: integer;
begin
writeln(Po,'Available environment variables:',Pc);
for i := 1 to GetEnvironmentVariableCount do
writeln(i:2,'. ',GetEnvironmentString(i),BR);
end;
(*** program utama ***)
begin
writeHeader('System Informations','test.css');
writeTitle('System Informations');
writeContent;
writeFooter;
end.