diff --git a/scripts/templating/matrix_templates/templates/common-event-fields.tmpl b/scripts/templating/matrix_templates/templates/common-event-fields.tmpl index b69fb79c4..f62f59ba3 100644 --- a/scripts/templating/matrix_templates/templates/common-event-fields.tmpl +++ b/scripts/templating/matrix_templates/templates/common-event-fields.tmpl @@ -7,6 +7,6 @@ {% for table in common_event.tables %} -{{ tables.paramtable(table.rows, [(table.title or "") ~ " Key", "Type", "Description"]) }} +{{ tables.paramtable(table.rows, ["Key", "Type", "Description"], (table.title or "")) }} {% endfor %} diff --git a/scripts/templating/matrix_templates/templates/events.tmpl b/scripts/templating/matrix_templates/templates/events.tmpl index e5ec899f2..679aee5b8 100644 --- a/scripts/templating/matrix_templates/templates/events.tmpl +++ b/scripts/templating/matrix_templates/templates/events.tmpl @@ -13,7 +13,7 @@ {% for table in event.content_fields %} -{{ tables.paramtable(table.rows, [(table.title or "Content") ~ " Key", "Type", "Description"]) }} +{{ tables.paramtable(table.rows, [(table.title or "Content") ~ " Key", "Type", "Description"], (table.title or "")) }} {% endfor %} Example{% if examples | length > 1 %}s{% endif %}: diff --git a/scripts/templating/matrix_templates/templates/http-api.tmpl b/scripts/templating/matrix_templates/templates/http-api.tmpl index db70da42f..1d486cd35 100644 --- a/scripts/templating/matrix_templates/templates/http-api.tmpl +++ b/scripts/templating/matrix_templates/templates/http-api.tmpl @@ -18,7 +18,7 @@ Request format: {{ tables.split_paramtable(endpoint.req_param_by_loc) }} {% if (endpoint.req_body_tables) %} {% for table in endpoint.req_body_tables -%} -{{ tables.paramtable(table.rows, [(table.title or "") ~ " Parameter", "Type", "Description"] ) }} +{{ tables.paramtable(table.rows, caption=(table.title or "")) }} {% endfor -%} {% endif -%} @@ -38,7 +38,7 @@ Response format: {% for table in endpoint.res_tables -%} -{{ tables.paramtable(table.rows, [(table.title or "") ~ " Parameter", "Type", "Description"] ) }} +{{ tables.paramtable(table.rows, caption=(table.title or "")) }} {% endfor %} diff --git a/scripts/templating/matrix_templates/templates/msgtypes.tmpl b/scripts/templating/matrix_templates/templates/msgtypes.tmpl index dfcf2e9da..060a7db0f 100644 --- a/scripts/templating/matrix_templates/templates/msgtypes.tmpl +++ b/scripts/templating/matrix_templates/templates/msgtypes.tmpl @@ -5,13 +5,7 @@ {{event.desc | wrap(80)}} {% for table in event.content_fields -%} -{% if table.title -%} -{% set tabletitle = table.title -%} -{% else -%} -{% set tabletitle = "" -%} -{% endif -%} - -{{ tables.paramtable(table.rows, [(table.title or "Content") ~ " Key", "Type", "Description"] ) }} +{{ tables.paramtable(table.rows, [(table.title or "Content") ~ " Key", "Type", "Description"], (table.title or "")) }} {% endfor %} Example: diff --git a/scripts/templating/matrix_templates/templates/tables.tmpl b/scripts/templating/matrix_templates/templates/tables.tmpl index 13ac08c85..fde546a7d 100644 --- a/scripts/templating/matrix_templates/templates/tables.tmpl +++ b/scripts/templating/matrix_templates/templates/tables.tmpl @@ -8,8 +8,8 @@ # # 'rows' is the list of parameters. Each row should be a TypeTableRow. #} -{% macro paramtable(rows, titles=["Parameter", "Type", "Description"]) -%} -{{ split_paramtable({None: rows}, titles) }} +{% macro paramtable(rows, titles=["Parameter", "Type", "Description"], caption="") -%} +{{ split_paramtable({None: rows}, titles, caption) }} {% endmacro %} @@ -21,7 +21,7 @@ # written for that location. This is used by the standard 'paramtable' macro. #} {% macro split_paramtable(rows_by_loc, - titles=["Parameter", "Type", "Description"]) -%} + titles=["Parameter", "Type", "Description"], caption="") -%} {% set rowkeys = ['key', 'title', 'desc'] %} {% set titlerow = {'key': titles[0], 'title': titles[1], 'desc': titles[2]} %} @@ -36,11 +36,6 @@ {% set fieldwidths = (([titlerow] + flatrows) | fieldwidths(rowkeys[0:-1], [10, 10])) + [50] -%} -{% set caption = titlerow['key'] | replace (' Key', '') | replace ('Parameter', '') -%} -{% if caption == 'Content' -%} -{% set caption = '' -%} -{% endif -%} - {{".. table:: "}}{{ caption }} {{" :widths: auto"}} {{""}}