https://twitter.com/keisei_1092/status/861206475472904193
main.rb
require 'sinatra'
require 'slim'
require 'open-uri'
get '/' do
page_source = open('http://twipla.jp/events/printlist/247207', 'r:UTF-8', &:read)
@attendees = page_source.scan(%r!<tr><td><img src="(.+?)" width.+?</td><td>(.+?)<br>(.+?)</td><td>.+?</td></tr>!)
slim :index
end
views/index.slim
doctype html
html
head
title My Slim Template App
css:
* {
font-family: sans-serif;
}
body
- if @attendees.any?
div style='display: -webkit-flex; -webkit-flex-wrap: wrap;'
- @attendees.each_with_index do |attendee, index|
table style='width: 47%; padding: 16px; border: 1px solid #DDD;'
tr
td style='font-size: 24px;'
| 整理番号
= index
tr
td style='width: 166px;'
img src=attendee[0] style='width: 150px; border-radius: 75px;'
td style='font-size: 24px;'
span style='color: #1B95E0;'
= attendee[1]
br
b style='font-size: 36px;'
= attendee[2]
tr
td colspan=2
center
img src='hoge.png' style='width: 90%;'
- else
No attendees here