diff --git a/pulkka/massage_outputs.py b/pulkka/massage_outputs.py index ad32c47..7ae452d 100644 --- a/pulkka/massage_outputs.py +++ b/pulkka/massage_outputs.py @@ -26,6 +26,18 @@ def write_massaged_files(env, df): body_class="table-body", ), ) + with open(OUT_DIR / "data-vertical.html", "w") as f: + with io.StringIO() as s: + for _, row in df.iterrows(): + row.dropna().to_frame().to_html(s, header=False, na_rep="", border=0) + s.write("\n") + table_html = s.getvalue() + f.write( + env.get_template("_table.html").render( + table_html=table_html, + body_class="table-body", + ), + ) df.to_csv(OUT_DIR / "data.csv", index=False) df.to_excel(OUT_DIR / "data.xlsx", index=False) df.to_json( diff --git a/template/index.html b/template/index.html index a75d7b7..a428c41 100644 --- a/template/index.html +++ b/template/index.html @@ -48,6 +48,7 @@
diff --git a/template/style.css b/template/style.css index 9db54d8..c6dfd36 100644 --- a/template/style.css +++ b/template/style.css @@ -27,6 +27,7 @@ body.table-body { body.table-body table { border-collapse: collapse; + margin-bottom: 1em; } body.table-body td, @@ -35,6 +36,10 @@ body.table-body th { border: 1px solid #999; } +body.table-body tr th { + text-align: left; +} + h1, h2, h3 {