diff --git a/docs/index.html b/docs/index.html index c544e1f..26a801d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -24,7 +24,19 @@

OPL – Optimisation problem library

Submit problems and corrections on GitHub with pull requests / issues, through the Google form, or by email: koen.van.der.blom@cwi.nl

- +
+
+
Visible columns
+
+ + +
+
+ +
+
+
+
@@ -1215,46 +1227,161 @@

OPL – Optimisation problem library

name
name textual description suite/generator/single objectives dimensionality variable type constraints dynamic noise multi-fidelity source (real-world/artificial) reference implementation
+ + + +
+

Problem details

+

Click a table row to inspect full details.

+
+
+ diff --git a/docs/javascript.html b/docs/javascript.html index a194ca7..73f9e58 100644 --- a/docs/javascript.html +++ b/docs/javascript.html @@ -1,44 +1,150 @@ diff --git a/docs/problems.html b/docs/problems.html index 4c2be02..d3040ea 100644 --- a/docs/problems.html +++ b/docs/problems.html @@ -1,4 +1,16 @@ - +
+
+
Visible columns
+
+ + +
+
+ +
+
+
+
@@ -1188,4 +1200,12 @@ -
namehttps://gitlab.com/verel/pubo-importance-benchmark
name textual description suite/generator/single objectives dimensionality variable type constraints dynamic noise multi-fidelity source (real-world/artificial) reference implementation
\ No newline at end of file +name textual description suite/generator/single objectives dimensionality variable type constraints dynamic noise multi-fidelity source (real-world/artificial) reference implementation + + + +
+

Problem details

+

Click a table row to inspect full details.

+
+
diff --git a/docs/table_styles.css b/docs/table_styles.css index 05418c8..1c53f6d 100644 --- a/docs/table_styles.css +++ b/docs/table_styles.css @@ -1,35 +1,280 @@ -/* Apply to everything */ +:root { + --opl-bg: #f5f7fb; + --opl-surface: #ffffff; + --opl-text: #12263a; + --opl-muted: #607389; + --opl-border: #d7e1ec; + --opl-accent: #0f6c8b; + --opl-accent-soft: #eaf4fa; + --opl-heading: "Segoe UI", "Trebuchet MS", sans-serif; + --opl-body: "Tahoma", "Verdana", sans-serif; + --opl-table-font-size: 0.86rem; +} + * { - font-family: sans-serif; + box-sizing: border-box; } body { margin: 1vw; - background-color: WhiteSmoke; + font-family: var(--opl-body); + color: var(--opl-text); + background: + var(--opl-bg); +} + +h2 { + font-family: var(--opl-heading); + letter-spacing: 0.01em; +} + +.table-shell { + margin-top: 1rem; + border: 1px solid var(--opl-border); + border-radius: 16px; + background: var(--opl-surface); + box-shadow: 0 14px 30px rgba(17, 37, 61, 0.08); + overflow: hidden; +} + +.table-toolbar { + display: grid; + gap: 0.65rem; + padding: 0.9rem 1rem; + border-bottom: 1px solid var(--opl-border); + background: linear-gradient(90deg, #f7fafc, #edf6fb); +} + +.toolbar-title { + font-size: 0.78rem; + text-transform: uppercase; + letter-spacing: 0.08em; + font-weight: 700; + color: var(--opl-muted); +} + +.toolbar-actions { + display: flex; + flex-wrap: wrap; + gap: 0.45rem; +} + +.toolbar-btn { + border: 1px solid #b8c8df; + background: #fff; + color: #1b3249; + border-radius: 8px; + padding: 0.36rem 0.62rem; + font-size: 0.8rem; + font-weight: 600; + cursor: pointer; + transition: all 120ms ease; +} + +.toolbar-btn:hover { + background: #eff6fb; + border-color: #94adc9; +} + +.toolbar-btn:active { + transform: translateY(1px); +} + +.column-controls { + display: flex; + flex-wrap: wrap; + gap: 0.45rem; +} + +.column-chip { + display: inline-flex; + align-items: center; + gap: 0.4rem; + padding: 0.35rem 0.65rem; + border-radius: 999px; + border: 1px solid var(--opl-border); + background: #fff; + font-size: 0.82rem; + cursor: pointer; + user-select: none; + transition: all 120ms ease; +} + +.column-chip:hover { + border-color: #b8c8df; + background: #f7fbfd; +} + +.column-chip.is-off { + color: var(--opl-muted); + background: #f1f5f9; +} + +.column-chip input { + accent-color: var(--opl-accent); +} + +.table-wrap { + overflow-x: auto; + padding: 0.45rem; +} + +#problems { + width: 100%; + min-width: 980px; + border-collapse: separate; + border-spacing: 0; + font-size: var(--opl-table-font-size); +} + +#problems thead th { + background: #f9fcff; + color: #1d324a; + border-bottom: 1px solid var(--opl-border); + font-weight: 700; + white-space: nowrap; } -input[type=text] { - background-color: #3CBC8D; - color: white; +#problems td { + vertical-align: top; + line-height: 1.4; + font-size: inherit; } -.styled-table { - font-size: 0.9em; - box-shadow: 0 0 20px rgba(0, 0, 0, 0.15); +#problems td * { + font-size: inherit; } -.styled-table thead tr { - background-color: AntiqueWhite; +#problems th:first-child { + position: sticky; + left: 0; + z-index: 5; + background: #f9fcff; + box-shadow: 1px 0 0 0 var(--opl-border); } -.styled-table tbody tr:nth-of-type(odd) { - background-color: SeaShell; +#problems td:first-child { + position: sticky; + left: 0; + z-index: 2; + background: #fcfeff; + box-shadow: 1px 0 0 0 var(--opl-border); } -.styled-table tbody tr:nth-of-type(even) { - background-color: Snow; +#problems tbody tr:nth-of-type(odd) td { + background: #fcfeff; } -.styled-table tbody tr:hover { - filter: brightness(.975); +#problems tbody tr:nth-of-type(even) td { + background: #f8fbfe; +} + +#problems tbody tr:hover td { + background: var(--opl-accent-soft); +} + +#problems tbody tr:hover td:first-child { + background: #deedf6; +} + +#problems tbody tr.is-active td { + background: #dceefa; +} + +#problems tbody tr.is-active td:first-child { + background: #cce5f5; +} + +#problems a { + color: #085f75; +} + +#problems thead input { + width: 100%; + padding: 0.35rem 0.45rem; + border-radius: 6px; + border: 1px solid var(--opl-border); + background: #fff; + color: var(--opl-text); + font-size: inherit; +} + +.details-shell { + margin-top: 0.9rem; + padding: 0.9rem 1rem; + border: 1px solid var(--opl-border); + border-radius: 14px; + background: var(--opl-surface); + box-shadow: 0 10px 24px rgba(17, 37, 61, 0.06); +} + +.details-title { + margin: 0 0 0.3rem; + font-family: var(--opl-heading); + font-size: 1.02rem; +} + +.details-hint { + margin: 0 0 0.75rem; + color: var(--opl-muted); + font-size: 0.88rem; +} + +.details-grid { + margin: 0; + display: grid; + grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); + gap: 0.6rem; +} + +.detail-item { + margin: 0; + border: 1px solid var(--opl-border); + border-radius: 10px; + padding: 0.55rem 0.65rem; + background: #fbfdff; +} + +.detail-item dt { + margin: 0; + color: #23415e; + font-size: 0.74rem; + text-transform: uppercase; + letter-spacing: 0.04em; + font-weight: 700; +} + +.detail-item dd { + margin: 0.35rem 0 0; + color: var(--opl-text); + font-size: 0.86rem; + line-height: 1.4; + overflow-wrap: anywhere; +} + +.details-empty { + color: var(--opl-muted); + font-style: italic; +} + +@media (max-width: 900px) { + body { + margin: 0.6rem; + } + + .table-toolbar { + padding: 0.8rem; + } + + .column-chip { + font-size: 0.76rem; + } + + .details-shell { + padding: 0.8rem; + } + + .details-grid { + grid-template-columns: 1fr; + } } diff --git a/docs/table_template.html b/docs/table_template.html new file mode 100644 index 0000000..270d61f --- /dev/null +++ b/docs/table_template.html @@ -0,0 +1,21 @@ +
+
+
Visible columns
+
+ + +
+
+ __COLUMN_TOGGLES__ +
+
+
+ __TABLE__ +
+
+ +
+

Problem details

+

Click a table row to inspect full details.

+
+
diff --git a/yaml_to_html.py b/yaml_to_html.py index a9a219f..87e8cce 100755 --- a/yaml_to_html.py +++ b/yaml_to_html.py @@ -3,6 +3,7 @@ import pandas as pd import yaml import shutil +from html import escape import re @@ -28,10 +29,11 @@ def repl(m): html_scripts = f"{html_dir}javascript.html" html_footer = f"{html_dir}footer.html" html_index = f"{html_dir}index.html" +html_table_template = f"{html_dir}table_template.html" # Load data -with open(yaml_file) as in_file: - data = pd.json_normalize(yaml.safe_load(in_file)) +with open(yaml_file) as yaml_input: + data = pd.json_normalize(yaml.safe_load(yaml_input)) # Choose desired columns all_columns = False @@ -68,12 +70,36 @@ def repl(m): idx = table.index('') final_table = table[:idx] + "" + " ".join([""+ i +"" for i in data.columns])+" " + table[idx:] +default_hidden_columns = {"textual description", "reference", "implementation"} + +column_toggles = "".join( + [ + ( + f'' + ) + for i, col in enumerate(data.columns) + ] +) + +with open(html_table_template, encoding="utf-8") as template_file: + table_template = template_file.read() + +table_markup = ( + table_template + .replace("__COLUMN_TOGGLES__", column_toggles) + .replace("__TABLE__", final_table) +) + # Write table to file -with open(html_table, "w") as table_file: - table_file.write(final_table) +with open(html_table, "w", encoding="utf-8") as table_file: + table_file.write(table_markup) # Merge table and scripts into HTML page with open(html_index, "wb") as output_file: - for in_file in [html_header, html_table, html_scripts, html_footer]: - with open(in_file, "rb") as in_file: - shutil.copyfileobj(in_file, output_file) + for part_path in [html_header, html_table, html_scripts, html_footer]: + with open(part_path, "rb") as part_file: + shutil.copyfileobj(part_file, output_file)