Skip to content

Instantly share code, notes, and snippets.

@jawher
Created July 28, 2010 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jawher/496465 to your computer and use it in GitHub Desktop.
Save jawher/496465 to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<ul id="list">
<li>Oh hai !</li>
</ul>
</body>
</html>
Document doc = Jsoup.parse(new File(
"src/main/resources/jawher/aot/test.html"), "utf-8");
AOTEngine e = new AOTEngine();
List<String> seasons = Arrays.asList("Winter", "Spring", "Summer",
"Autumn");
e.register("ul#list > li",
repeat(seasons.size()),
attr("class", "even", "odd"),
text(seasons.iterator()));
e.process(doc);
System.out.println(doc.html());
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert title here</title>
</head>
<body>
<ul id="list">
<li class="even">
Winter
</li>
<li class="odd">
Spring
</li>
<li class="even">
Summer
</li>
<li class="odd">
Autumn
</li>
</ul>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment