FSK B

>b's weblog

News. Journal. Whatever.

Ohne WorteSteht die Kirche des Papstes auf dem Boden der FDGO?

YML 2 features of the day: a template langue with pointers and default body

YML 2 can be used as XML template engine. For that purpose, you can declare a default body for a YML 2 function. Together with Pointers this makes things complete. Let's see an example:

% yml2proc -P
decl page(*title) alias html {
    head title *title;
    body {       
        h1 *title;
        content;
    }
};

page "My Homepage" p "Welcome to my homepage!";
^D
<?xml version='1.0' encoding='UTF-8'?>
<html>
  <head>
    <title>My Homepage</title>
  </head>
  <body>
    <h1>My Homepage</h1>
    <p>Welcome to my homepage!</p>
  </body>
</html>
% _

To learn more about that idea, you can read the documentation on how to create a wiki like language named YHTML.

publiziert Thu, 22 Sep 2011 18:30:25 +0200 #software #yml

Zurück zum Blogindex