Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language kid

Date:02/13/07
Author:Arvin Schnell
URL:http://arvin.schnell-web.net
Comments:1
Info:http://kid-templating.org/
Score: (2.91 in 11 votes)
<?xml version="1.0" encoding="utf-8"?>

<!--! Author: Arvin Schnell -->
<!--! Tested with kid 0.9.4 on openSUSE 10.2, run: -->
<!--! kid beer.kid > beer.html -->

<?python

max_bottles = 99

def nbs (num, upper = False):
    if num == 0:
        return ["no", "No"][upper] + " more bottles of beer"
    elif num == 1:
        return "1 bottle of beer"
    else:
        return "%s bottles of beer" % num

?>

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#">

<head>
    <title>99 Bottles of Beer</title>
</head>

<body>

<p py:for="n in xrange (max_bottles, -1, -1)">
<span py:strip="True">
${nbs(n, True)} on the wall, ${nbs(n)}.
</span>
<br/>
<span py:if="n >= 1" py:strip="True">
Take one down and pass it around, ${nbs(n-1)} on the wall.
</span>
<span py:if="n == 0" py:strip="True">
Go to the store and buy some more, ${nbs(max_bottles)} on the wall.
</span>
</p>

</body>

</html>

Download Source | Write Comment

Alternative Versions

Comments

>>  TwilaCarroll26 said on 08/09/10 15:09:45

TwilaCarroll26 Do you acknowledge that it is correct time to get the <a href="http://bestfinance-blog.com/topics/business-loans">business loans</a>, which can realize your dreams.

Download Source | Write Comment

Add Comment

Please provide a value for the fields Name, Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.

Please don't post large portions of code here! Use the form to submit new examples or updates instead!

Name:

eMail:

URL:

Security Code:
  
Comment: