인라인 스타일로 수정

This commit is contained in:
2025-06-27 15:11:00 +09:00
parent 4d31353a79
commit 385bb5290d

View File

@ -39,26 +39,13 @@ def get_precipitation_summary(retry=True):
total_rainfall = 0.0 total_rainfall = 0.0
lines = [ lines = [
'<style>', '<div class="weatherinfo" style="text-align:center;">',
'.weatherinfo table {', '<h3 style="font-size: 2em; margin: 20px 0;">[시간대별 강수량]</h3>',
' border-collapse: collapse;', '<table style="border-collapse: collapse; border-spacing: 0; display: inline-table; margin: 0 auto;">',
' border-spacing: 0;', '<tr>',
' display: inline-table;', '<th style="padding: 0; border: 1px solid #333;">시간</th>',
'}', '<th style="padding: 0; border: 1px solid #333;">강수량</th>',
'.weatherinfo td, .weatherinfo th {', '</tr>'
' padding: 0;',
' border: 1px solid #333;',
'}',
'.weatherinfo h3 {',
' font-size: 2em;',
' text-align: center;',
' margin: 20px 0;',
'}',
'</style>',
'<div class="weatherinfo">',
'<h3>[시간대별 강수량]</h3>',
'<table>',
'<tr><th>시간</th><th>강수량</th></tr>'
] ]
for item in data['response']['body']['items']['item']: for item in data['response']['body']['items']['item']:
@ -67,7 +54,7 @@ def get_precipitation_summary(retry=True):
if 900 < int(time) < 2300: if 900 < int(time) < 2300:
mm = parse_precip(item['fcstValue']) mm = parse_precip(item['fcstValue'])
time_str = f"{time[:2]}:{time[2:]}" # '11:00' time_str = f"{time[:2]}:{time[2:]}" # '11:00'
lines.append(f'<tr><td>{time_str}</td><td>{mm}mm</td></tr>') lines.append(f'<tr><td style="padding: 0; border: 1px solid #333;">{time_str}</td><td style="padding: 0; border: 1px solid #333;">{mm}mm</td></tr>')
total_rainfall += mm total_rainfall += mm
lines.append('</table></div>') lines.append('</table></div>')