HTML Macros and Macro Syntax
Macro Parsing
- Added and confirmed code to properly recognize syntax like %=SET|x=%=HubApp.CGIAPP=%=%
(e.g. no space after 'x=')
- Added support for '//' to be recognized as a comment when found at the beginning of a line. This feature will
be enabled by default for all webapps. Should you require otherwise set WebApp.whComments to false.
- Enhanced the HTML Tag parser to support all variations of parameters for controlled HTML. This
removes a long-standing shortcoming and gives you the utmost in HTML Tag parameter flexibility.
Experiment with this chunk
Macros for Branding
What is Branding? Branding is a revolutionary concept owned by HREF Tools Corp that adds state to static
websites by adjusting links and performing macro expansion on the fly, on static pages.
Other New Macros
Macro Changes
- HTTP/HTTPS
%=Bounce=%,%=HREF=%, WebMail, now allow HTTP and HTTPS interchangably
- INCLUDE Macro
fixed/unchanged: use %=include|c:\autoexec.bat=% to include the listed file
- SENDFILE Macro
fixed/unchanged: use %=flush|=%
%=sendfile|c:\autoexec.bat=%
to clear the output buffer of any headers or leading text that might have snuck in, then send an arbitrary file.
include a "Content-Type: xyz" line (and a blank line thereafter) in the file if you are sending a custom binary
file and dont know the mime type ahead of time. use %=sendfile|c:\temp\temp.gif,image/gif=% if you're
sending a binary file and you know the type beforehand.
- AutoLoad/BodyLoad Macros
Examp;es for these two macros which to integrate some JavaScript into WebHub and which utilize the
ThtWebApp's JavaScript property were missing from prior builds. I've included a simple demo
autoload.htm with all the clues for these important macros.
- Page Macro: Bug Fixed
Sending Page-Macros from within WebAction components (but not WebPage.OnExecute/OnSection)
were ineffective as the EAbort exception was not re-raised by the WebAction.Execute mechanism. This
has been corrected.
In addition, regardless of where you used 'Writeln' to trigger a page-change, the macro would only work
every other time. This was a bit of a puzzler at first sight as 'Writeln' works by bending pointers in the RTL,
but it's been resolved as well.
Bottomline is: %=Page|..=% and raising EAbort now reliably works in all the combinations that I could
think of testing at the time.
- 'Checked' Bug introduced in 1.05,1.06, fixed in 1.07
Two variations of problems involving the Checked macro were introduced in the experimental 1.05/1.06
builds. One would create HUGE session var files, the other would cause problems resetting checkmarks
Support for other Markup Tags
- WebHub can now recognize Cold Fusion and Frontpage Bot Syntax. This functionality must be enabled by
setting the desired syntax option in WebApp.OtherTags. If alternate tags are enabled, the
WebApp.OnOtherTag event is called with the unexpanded tag. Use routines from ucstring, uchtml, uttaglst
to process the value, use WebApp.CompareTo to expand webhub individual macros. Set the 'Send'
parameter to false if you don't want the tag to be passed through.
- new event type: TOnOtherTag= procedure(Sender:TWebOutputApp;const
Value:String;Send:boolean;Kind:TOtherTag) of object;
- To test, actviate OtherTags and try this code with a frontpage or cold-fusion file:
- procedure TfmWebAppMainForm.htWebAppOtherTag(Sender: TWebOutputApp;
const Value: string; Send: Boolean; Kind: TOtherTag);
begin
writeln('<hr>');
showmessage(Value);
end;
- Uses: map frontpage bots to action components; map cold-fusion commands to webhub commands; either
is simpler now.