Skip to content

Instantly share code, notes, and snippets.

@mindboard
Last active November 4, 2015 09:05
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 mindboard/a781cf19aee1357365bc to your computer and use it in GitHub Desktop.
Save mindboard/a781cf19aee1357365bc to your computer and use it in GitHub Desktop.
def sb = new StringBuffer()
sb.append("""<html>
<body>
<table border=0 style="border-collapse: collapse;border:solid 1px;">""")
def cellW = 200
def cellStyle0 = "width:${cellW}px;border-left:solid 1px #333;background-color:#eee;"
sb.append("""
<tr>
<th></th>
<th style="${cellStyle0}">MON</th>
<th style="${cellStyle0}">TUE</th>
<th style="${cellStyle0}">WED</th>
<th style="${cellStyle0}">THU</th>
<th style="${cellStyle0}">FRI</th>
<th style="${cellStyle0}">SAT</th>
<th style="${cellStyle0}">SUN</th>
</tr>""")
def cellStyle1 = 'height:24px;border-left:solid 1px #333;background-color:#eee;'
sb.append("""
<tr>
<td></td>
<td style="${cellStyle1}"></td>
<td style="${cellStyle1}"></td>
<td style="${cellStyle1}"></td>
<td style="${cellStyle1}"></td>
<td style="${cellStyle1}"></td>
<td style="${cellStyle1}"></td>
<td style="${cellStyle1}"></td>
</tr>""")
def color = '#999'
def cellStyle2 = "border-left:solid 1px $color;height:15px;"
def cellStyle3 = "border-left:solid 1px $color;border-top:solid 1px $color;height:15px;"
//(0..24).each {
(5..24).each {
sb.append("""
<tr>
<th style="margin:0;padding-right:5px;width:50px;text-align:right;" rowspan="2"><span style="font-size:9px;">$it:00</span></th>
<td style="$cellStyle2"></td>
<td style="$cellStyle2"></td>
<td style="$cellStyle2"></td>
<td style="$cellStyle2"></td>
<td style="$cellStyle2"></td>
<td style="$cellStyle2"></td>
<td style="$cellStyle2"></td>
</tr>
<tr>
<td style="$cellStyle3"></td>
<td style="$cellStyle3"></td>
<td style="$cellStyle3"></td>
<td style="$cellStyle3"></td>
<td style="$cellStyle3"></td>
<td style="$cellStyle3"></td>
<td style="$cellStyle3"></td>
</tr>""")
}
sb.append('''
</table>
</body>
</html>''')
new File('weekly-schedule.html').text = sb.toString()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment