Usage
JSON
Tempo takes information encoded as JSON and renders it according to an HTML template. Below is a sample array of JSON data.
var data = [ {'name':{'first':'Leonard','last':'Marx'},'nickname':'Chico','born':'March 21, 1887','actor': true,'solo_endeavours':[{'title':'Papa Romani'}]}, {'name':{'first':'Adolph','last':'Marx'},'nickname':'Harpo','born':'November 23, 1888','actor':true,'solo_endeavours':[{'title':'Too Many Kisses','rating':'favourite'},{'title':'Stage Door Canteen'}]}, {'name':{'first':'Julius Henry','last':'Marx'},'nickname':'Groucho','born': 'October 2, 1890','actor':true,'solo_endeavours':[{'title':'Copacabana'},{'title':'Mr. Music','rating':'favourite'},{'title':'Double Dynamite'}]}, {'name':{'first':'Milton','last':'Marx'},'nickname':'Gummo','born':'October 23, 1892'}, {'name':{'first':'Herbert','last':'Marx'},'nickname':'Zeppo','born':'February 25, 1901','actor':true,'solo_endeavours':[{'title':'A Kiss in the Dark'}]} ];
JavaScript
Include script
You only need to include one little script.

Tempo.prepare(element)
To initialize Tempo, run the prepare()
function to scan an HTML container for data templates, cache them in memory, and remove the data template HTML elements from the page. Tempo.prepare(element)
returns an instance of a renderer that knows how to layout the data you provide to it.
element
The ID of the HTML element (or the element itself) containing your data template. If you're using jQuery, you may pass in a jQuery object instead.
If the container does not contain a default (that is without conditions and not nested) data-template
the entire contents of the container will be considered to represent the template.
renderer.render()
The Tempo.prepare() function returns an instance of a renderer. Once the JSON data is available, run the render(data)
function to add the data to the page.
data
The JSON data to be rendered. You'll first need to perform an AJAX call to the JSON data source (see below).
Tempo.prepare( element ).render( data );
Tempo.prepare('marx-brothers').render(data);
renderer.append()
Renderer methods all return an instance of the renderer (a la fluent) so you can chain calls to it. The append(data)
function will render the data you pass in and append it to the container.
data
The JSON data to append.
Tempo.prepare('marx-brothers').render( data ).append( more_brothers );
renderer.prepend()
The prepend(data)
function will render the data you pass in and insert it before others in the container.
data
The JSON data to prepend.
Tempo.prepare('marx-brothers').render( data ).prepend( brothers_we_didnt_know_about );
renderer.clear()
The clear()
function will empty the container, allowing you to render the data again.
Tempo.prepare('marx-brothers').render( data ).clear();
HTML
data-template
Any tag with the data-template
attribute will be flagged as a data template.
For compliance the full (non-minimized) form is also supported: data-template="data-template"
.
{{fields}}
Any field represented in the JSON data may be retrieved by referencing the field name inside double brackets.

{{nickname}} {{name.last}}

The above example would be rendered as:
- Chico Marx
- Harpo Marx
- Groucho Marx
- Gummo Marx
- Zeppo Marx
You can reference the object being iterated with {{.}}:

{{.}}

If the JSON data represents an array of arrays (which can not be referenced by field/member name) for example:
You can reference array elements with the following notation:

{{[0]}} {{[1]}}

Both examples above would be rendered as:
- Leonard Marx
- Adolph Marx
- Julius Henry Marx
- Milton Marx
- Herbert Marx
Nested data-templates
Data templates can even be nested within other data templates. Multiple nested templates are supported.

 {{nickname}} {{name.last}}

{{title}}

- Chico Marx
- Papa Romani
- Harpo Marx
- Too Many Kisses
- Stage Door Canteen
- Groucho Marx
- Copacabana
- Mr. Music
- Double Dynamite
- Gummo Marx
- Zeppo Marx
- A Kiss in the Dark
Conditional Templates
Tempo provides boolean and value-based conditionals, as well as the ability to define multiple data templates per container (the first matching template wins).

{{nickname}} (aka {{name.first}}) was grumpy!

{{name.first}}, nicknamed '{{nickname}} {{name.last}}' was born on {{born}}

{{name.first}} {{name.last}} was not in any movies!

- Leonard, nicknamed 'Chico Marx' was born on March 21, 1887
- Adolph, nicknamed 'Harpo Marx' was born on November 23, 1888
- Groucho (aka Julius Henry) was grumpy!
- Milton Marx was not in any movies!
- Herbert, nicknamed 'Zeppo Marx' was born on February 25, 1901
Fallback Template
Use the data-template-fallback
attribute to identify HTML containers you would like to show if JavaScript is disabled.
To ensure that your data template is not visible before being rendered (either because of JavaScript being disabled or due to latency retrieving the data), it's best practice to hide your templates with CSS. If you add an inline rule of style="display: none;"
Tempo will simply remove the inline rule once the data has been rendered.

{{nickname}} {{name.last}}

Sorry, JavaScript required!

If JavaScript is disabled in the browser the above example would be rendered as:
- Sorry, JavaScript required!
Filter and Formatting Functions
Tempo supports a number of filter functions to modify individual values before they are rendered. Filters can be chained to apply multiple ones to the same value.
{{ field | truncate 25 [, 'optional_suffix'] }}
If the value of this field is longer than 25 characters, then truncate to the length provided. If a second argument is provided then it is used as the suffix instead of the default ellipsis (...).
{{ field | format }}
Currently only formats numbers like 100000.25 by adding commas: 100,000.25
{{ field | default 'default value' }}
If the field is undefined, or null, then show the default value specified.
{{ field | date 'preset or pattern like HH:mm, DD-MM-YYYY' }}
Creates a date object from the field value, and formats according to presets, or using a date pattern. Available presets are localedate
, localetime
, date
and time
. The following pattern elements are supported:
YYYY or YY
: year as 4 or 2 digits.MMMM, MMM, MM or M
: month of the year as either full name (September), abbreviated (Sep), padded two digit number or simple integer.DD or D
: day of the month.EEEE, EEE or E
: day of the week as either full (Tuesday), abbreviated (Tue) or number.HH, H or h
: hour of the day.mm or m
: minutes of the hour.ss or s
: seconds.SSS or S
: milliseconds.a
: AM/PM.
If you would like to use any of the format characters verbatim in the pattern then use \
to escape: {{ some_date | date '\at HH:mm' }}
. In this case the a
is not replaced with AM/PM.
{{ field | replace 'regex_pattern', 'replacement' }}
Replace all occurrences of the pattern (supports regular expressions) with the replacement. Replacement string can contain backreferences. See Twitter code sample for an example.
{{ field | trim }}
Trim any white space at the beginning or end of the value.
{{ field | upper }}
Change any lower case characters in the value to upper case.
{{ field | lower }}
Change any upper case characters in the value to lower case.
{{ field | append ' some suffix' }}
If the field value is not empty, then append the string to the value. Helpful if you don't want the suffix to show up in the template if the field is undefined or null. Use if you need before or after the suffix.
{{ field | prepend 'some prefix ' }}
If the field value is not empty, then prepend the string to the value. Helpful if you don't want the prefix to show up in the template if the field is undefined or null. Use if you need before or after the prefix.
{{ field | join 'separator' }}
If the field is an array joins the elements into a string using the supplied separator.
Attribute Setters
If an HTML element attribute in a template is immediately followed by a second attribute with the same name, prefixed with data-
, then as long as the second one is not empty will the value of the original be replaced with the value of the latter.
In the following example, will the reference to default_image.png
be replaced by an actual field value if one exists. Notice here that the .png
suffix is only added if the field is not empty.

Template Tags
Tempo also supports tag blocks.
{% if javascript-expression %} ... {% else %} ... {% endif %}
The body of the tag will only be rendered if the JavaScript expression evaluates to true. The {% else %}
is optional.
Variable injection for inline scripts
If you're using scripts inline in your template, you can access JSON object members. You reference these via the __
variable.
{{name.last}}
You can refer to the object being iterated with this:
{{[0]}}
Similarly you can reference array elements:
{{[0]}}
At render time the accessor variable will be replaced by the object it references. If the object is a
Using Tempo with jQuery
jQuery's getJSON() method provides an easy means of loading JSON-encoded data from the server using a GET HTTP request.
var twitter = Tempo.prepare('tweets'); $.getJSON("http://search.twitter.com/search.json?q='marx brothers'&callback=?", function(data) { twitter.render(data.results); });
Binding event handlers
Note that if you've bound event listeners to elements in your template, these will not be cloned when the template is used. In order to do this you have two options.
You can either leave binding until the data has been rendered, e.g. by registering a TempoEvent.Types.RENDER_COMPLETE
listener and doing the binding when that fires, or you can use jQuery live which attaches a handler to elements even though they haven't been created.
The following example shows how to make a template clickable (assuming an 'ol li'
selector provides a reference to a template element) and how to obtain a reference to the clicked element:
$('ol li').live('click', function() { // Do something with the clicked element alert(this); });
Advanced Topics
renderer.notify(eventlistener)
After preparing a template you can register an event listener by providing a callback function to be notified of events in the lifecycle. The event listener will be called with a single argument, a TempoEvent
which has the following properties:
type
The type of the event. Constant values are defined in TempoEvent.Types
.
TempoEvent.Types.RENDER_STARTING
: Indicates that rendering has started, or been manually triggered by callingstarting()
on the renderer object.TempoEvent.Types.ITEM_RENDER_STARTING
: Indicates that the rendering of a given individual item is starting.TempoEvent.Types.ITEM_RENDER_COMPLETE
: Indicates that the rendering of a given individual item has completed.TempoEvent.Types.RENDER_COMPLETE
: Indicates that the rendering of all items is completed.
item
The item being rendered. This is only available for the ITEM_RENDER_STARTING
and ITEM_RENDER_COMPLETE
events.
element
The HTML element or template being used for rendering. This is only available for the ITEM_RENDER_STARTING
and ITEM_RENDER_COMPLETE
events.
starting()
In some cases you prepare the templates ahead of calling render. In those cases if you would like to e.g. set loader graphics, call the renderer's starting()
method just prior to issuing e.g. a jQuery request. This will fire the ITEM_RENDER_STARTING
event.
The following example demonstrates use of both methods above. In this case we prepare the templates, and register our event handler function. The event handler is then notified that the jQuery request is about to be issued (when we manually fire RENDER_STARTING
with a call to starting()
) adding a CSS class to the container. We are then notified that rendering is complete so we can remove the CSS class.
var twitter = Tempo.prepare('tweets').notify( function (event) { if (event.type === TempoEvent.Types.RENDER_STARTING || event.type === TempoEvent.Types.RENDER_COMPLETE) { $('#tweets').toggleClass('loading'); } }); twitter.starting(); $.getJSON(url, function(data) { twitter.render(data.results); });
Configuring the surrounding brace syntax
In order to make it easier to use Tempo with other frameworks such as Django, you can configure Tempo to use surrounding braces other than the default {{ ... }}
and {% ... %}
.
To do this you pass the var_braces
and tag_braces
parameters to the Tempo.prepare
function. These will be split down the middle to form the left and right braces.
Tempo.prepare('marx-brothers', {'var_braces' : '\\[\\[\\]\\]', 'tag_braces' : '\\[\\?\\?\\]'});
You can now use this template syntax instead:

[[nickname]] is [? if nickname == 'Groucho' ?]grouchy[? else ?]happy[? endif ?]!

Tempo Renderer Information - the _tempo
variable
You can access information about the rendering process via the _tempo
variable.
_tempo.index
The index
variable tells you how many iterations of a given template have been carried out. This is a zero (0) based index. Nested templates have a separate counter.
The following example adds the iteration count to the class
attribute, prefixed with 'item-
':

{{nickname}} {{name.last}}

This example shows how to access the iteration counter using inline JavaScript injection:
{{name.last}}


I defines a set of standards and techniques to be used by Services Order 2 Cash (O2C) teams when building IBM Community Wiki sites for end user consumption. The goal was for the wiki sites to have a the look and feel of a well designed and organized web site. Adherence to these standards will insure a consistent look and feel across Services O2C communities and deliver an optimal end user experience.
To facilitate this I also wrote the O2C community authoring utility. This utility uses XML, XSL, and XSLT processing to allow the community’s content to be developed outside the community, within a simple XML document(s), and thereafter generated using XSLT processing. The utility allows for the complexity of the wiki page's HTML to be hidden from the author(s).
The standard and tool manage manage and enable the following:
The page below is an example of the different content that can be generated for the community pages.


.active
You can make all items thinner by adding .thin
.
Use an <a>
tag for .list-group-item
to produce a hover effect.
This is some body content. It will wrap if the line gets too long, which I think is pretty nice.
This is some body content.
You can add multiple .list-group-item-text
components to have them act as paragraphs with some vertical spacing in between.
This is the second .list-group-item-text
component.
You can use .list-group-item-addon
s and the .has-addon
class to take up constant width for styling selections.
Simply add .list-group-dark
and it'll be a dark version!
It will indent the whole body to align correctly with the heading.
In popover components they will be styled a tad differently to fit within the popover better.


Change Password
Email
Old Password
Your password must be 8-20 characters long, contain letters and numbers, and must not contain spaces, special characters, or emoji.
New Password
Your password must be 8-20 characters long, contain letters and numbers, and must not contain spaces, special characters, or emoji.
Verify Password
Your password must be 8-20 characters long, contain letters and numbers, and must not contain spaces, special characters, or emoji.
Close


MALCOLM X A film review by Jon Webb Copyright 1992 Jon Webb
This film is an assembly of symbols of racism and politics in this country. It opens with two of the most powerful symbols in recent years: the Rodney King videotape, and a burning American flag. Clearly, Spike Lee is trying to grab hold of our political consciousness and move us.
The movie is really about three people: Malcolm Little (a.k.a. Detroit Red), the hood and dandy; Malcolm X, the follower of Elijah Muhammed; and the anti-racist who rejected black separatism after a pilgrimage to Mecca (whose long name I do not recall). The tone and direction of the film changes significantly with each incarnation of the man -- it is really three movies concatenated.
I liked the first two parts of the film better. The final conversion is just not convincing (frankly, I thought it was motivated by political convenience -- he needed a power base outside the Black Muslims), and the heart of Denzel Washington's character seems to have disappeared following the return from Mecca. (Though it was interesting actually seeing Mecca, a rare experience; to make this film, some of the crew actually had to convert to Islam.) He seems to simply be waiting for the assassin's bullets.
This is Spike Lee's master work, the one film he has been moving towards all these years. Its length and breadth will make it the starting point for many in their understanding of what Malcolm X was about. It admirably fills that role; it is part historical documentary, part a course on the issues that moved Malcolm X. But it is not really moving in itself. In Spike Lee's recent films (e.g., SCHOOL DAZE, JUNGLE FEVER), he explicitly calls on us to wake up to what is happening to African Americans, and in this film he tries to do so in every way possible -- by the use of charged symbols like a burning flag and the JFK assassination, by including actual appearances by controversial people like the Reverend Al Sharpton and Nelson Mandela, by showing us the most powerful possible images of African Americans being brutalized -- still, for me, it was not enough. Lee tries to include everything he can think of, but in the process he loses focus. I found the fairy tale HERO more moving politically than this film.
Denzel Washington turns in an admirable performance. It wasn't until the end of the film, when we see actually footage of Malcolm X talking, that I realized how good it really was: he has his smile down just right, his laugh. The man who plays Elijah Muhammed is also very good; just the right combination of saintliness and power. I also admired the performance of the woman who plays Betty Shabazz, at least before she married Malcolm X and became somewhat strident.
-- J
.
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews