The
exception to this is when a string constant contains rounded parentheses; in this situation, to avoid
conflicts, the constant value must be included in curly brackets.
In haXe code, before instantiating the Template / Loader class, it will be necessary to set the Loader
.MACROS static variable to point to the macros XML file. In the example, the macro file has the name
macros.xml and it contains the following code:
< macros >
< macro name=???image(uri, desc, link)??? >
::if (link == ?????™ || link == null)::
< img ::attr src uri; alt desc:: / >
::else::
< a ::attr href link:: > < img ::attr src uri; alt desc:: / > < /a >
::end::
< /macro >
< macro name=???zebraList(list)??? >
< ul >
::foreach item list::
::if isOdd::
::set class = ???odd-row??™::
::else::
::set class = ???even-row??™::
::end::
< li ::attr class class :: >
::item::
< /li >
::end::
< /ul >
< /macro >
< /macros >
Thus, two macros are defined: The first creates the tag for an image element and accepts a URI for the
image, and a description; it optionally accepts a third URI argument if the image has to be used as a
hyperlink.
Pages:
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526