auto-generate descriptions and make tiers' maps non-str

pull/24020/head
Shane Smiskol 3 years ago
parent a1ef90480c
commit 92b7aa54c4
  1. 23
      docs/vehicles_template.js
  2. 1
      selfdrive/car/docs.py

@ -18,18 +18,21 @@ export const state = () => ({
], ],
supportedVehicles: { supportedVehicles: {
{% for tier, car_rows in tiers %} {% for tier, car_rows in tiers %}
'{{tier.name.title()}}': [ '{{tier.name.title()}}': {
{% for row in car_rows %} description: '{{ tier.value | replace("'", "\\'") }}',
[ rows: [
'{{row[0].text}}', {% for row in car_rows %}
'{{row[1].text}}', [
'{{row[2].text}}', '{{row[0].text}}',
{% for star_col in row if star_col.star is not none %} '{{row[1].text}}',
'{{star_col.star.html_icon}}{{footnote_tag.format(star_col.footnote) if star_col.footnote else ''}}', '{{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 %} },
],
{% endfor %} {% endfor %}
}, },
}) })

@ -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) template = jinja2.Template(f.read(), trim_blocks=True, lstrip_blocks=True)
footnotes = [fn.value.text for fn in ALL_FOOTNOTES] 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], return template.render(tiers=tier_car_rows, columns=[column.value for column in Column],
footnotes=footnotes, Star=Star) footnotes=footnotes, Star=Star)

Loading…
Cancel
Save