From 92b7aa54c41faef63489a4b61f5b94f62613d4b5 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 22 Mar 2022 19:27:03 -0700 Subject: [PATCH] auto-generate descriptions and make tiers' maps non-str --- docs/vehicles_template.js | 23 +++++++++++++---------- selfdrive/car/docs.py | 1 - 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/docs/vehicles_template.js b/docs/vehicles_template.js index 052c52ecc3..fae17da882 100644 --- a/docs/vehicles_template.js +++ b/docs/vehicles_template.js @@ -18,18 +18,21 @@ export const state = () => ({ ], supportedVehicles: { {% for tier, car_rows in tiers %} - '{{tier.name.title()}}': [ - {% for row in car_rows %} - [ - '{{row[0].text}}', - '{{row[1].text}}', - '{{row[2].text}}', - {% for star_col in row if star_col.star is not none %} - '{{star_col.star.html_icon}}{{footnote_tag.format(star_col.footnote) if star_col.footnote else ''}}', + '{{tier.name.title()}}': { + description: '{{ tier.value | replace("'", "\\'") }}', + rows: [ + {% for row in car_rows %} + [ + '{{row[0].text}}', + '{{row[1].text}}', + '{{row[2].text}}', + {% for star_col in row if star_col.star is not none %} + '{{star_col.star.html_icon}}{{footnote_tag.format(star_col.footnote) if star_col.footnote else ''}}', + {% endfor %} + ], {% endfor %} ], - {% endfor %} - ], + }, {% endfor %} }, }) diff --git a/selfdrive/car/docs.py b/selfdrive/car/docs.py index b9f5b0d06e..445197e9e1 100755 --- a/selfdrive/car/docs.py +++ b/selfdrive/car/docs.py @@ -58,7 +58,6 @@ def generate_cars_md(tier_car_rows: List[Tuple[Tier, List[RowItem]]], template_f template = jinja2.Template(f.read(), trim_blocks=True, lstrip_blocks=True) footnotes = [fn.value.text for fn in ALL_FOOTNOTES] - print(tier_car_rows[0][1][0]) return template.render(tiers=tier_car_rows, columns=[column.value for column in Column], footnotes=footnotes, Star=Star)