[Overview][Constants][Procedures and functions] | Reference for unit 'pwumain' (#powtils_main) |
Source position: pwumain.pas line 131
procedure OutLn( |
const s: String |
); |
You can still use the system.WriteLn procedure if writing to a text file handle, but if you call system writeln to standard out (web browser out) you will interfere with how OutLn handles headers, and gzip buffering (if on).
It is recommended to not use system.writeln() for web output - instead, use OutLn.
This function appends a regular linefeed, it will not actually output a HTML break.
uses pwumain; begin outln('hi world'); outln('hi planet'); // not on a new line in web browser but when you view html // source, it is. end.
The reason OutLn does not output a brand new line to your browser is because of how HTML works. If we hardcoded an html break into this procedure, it would interfere with HTML and offer less flexibility. For example consider the <PRE> tag where we do not want HTML breaks, and OutLn therefore works as expected:
uses pwumain; begin outln('<pre>'); // preserve formatting outln( 'hi world'); outln( 'hi planet'); // does show new line in web browser outln('</pre>'); end.You can build a function like below if you need an html break:
uses pwumain; procedure writebr(s: string); begin outln(s + '<br />'); end; begin writebr('hi world'); writebr('hi planet'); // does show new line in browser since <BR> is called end;Consider also the rapid-html units in the /extras/ folder of your download, which will contain a lot of these wrappers and html automation implemented already.