Created
July 1, 2011 08:29
-
-
Save mike-neck/1058094 to your computer and use it in GitHub Desktop.
Groovy Markup Builder for jquery mobile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.xml.MarkupBuilder | |
def writer = new StringWriter() | |
def xml = new MarkupBuilder(writer) | |
xml.html('lang' : 'ja'){ | |
head{ | |
meta('http-equiv' : 'Content-Type', 'content' : 'text/html; charset=UTF-8') | |
title('jQuery Mobile Sample') | |
link('rel' : 'stylesheet', 'href' : 'http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css') | |
['http://code.jquery.com/jquery-1.6.1.min.js', 'http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js'].each{ | |
script('src' : it, ''){ | |
} | |
} | |
} | |
body{ | |
div('data-role' : 'page'){ | |
div('data-role' : 'header'){ | |
a('href' : '#', 'data-role' : 'button', 'data-icon' : 'back', 'data-rel' : 'back', 'Back') | |
h1('List Sample') | |
} | |
div('data-role' : 'content'){ | |
ul('data-role' : 'listview', 'data-themes' : 'g'){ | |
['Apple', 'Mango', 'Banana', 'Grape', 'Citras'].sort{a, b -> a <=> b}.each{item -> | |
li(){ | |
a('href' : 'next_page1.html', 'data-icon' : 'arrow-r', 'data-iconpos' : 'right', item) | |
} | |
} | |
} | |
} | |
div('data-role' : 'footer'){ | |
['back' : 'back', 'arrow-u' : 'prev', 'arrow-d' : 'next', 'delete' : 'delete'].each{key, value -> | |
a('href' : '#', 'data-role' : 'button', 'data-icon' : key, value) | |
} | |
h1('mike_neck') | |
} | |
} | |
} | |
} | |
println '<!DOCTYPE html>' | |
println writer.toString() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment