From ed5a259ad02a2cf35657e502aa0e75dad653efa2 Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Sat, 29 Jul 2023 01:26:07 +0200 Subject: [PATCH] add color and encoding table --- .../capabilities-template.jinja | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/doc/capability_templates/capabilities-template.jinja b/doc/capability_templates/capabilities-template.jinja index e30f701..ef6dfa3 100644 --- a/doc/capability_templates/capabilities-template.jinja +++ b/doc/capability_templates/capabilities-template.jinja @@ -4,6 +4,15 @@ {{ escape_rst(text) }} {{ escape_rst(text) | length * symbol }} {%- endmacro %} +{% macro abort(error) %} +{{ None['[ERROR] ' ~ error][0] }} +{% endmacro %} +{% macro fill_line(text, total, symbol=' ') -%} +{%- if total < text|length -%} +{{- abort("Line cannot be filled: must be longer") -}} +{%- endif -%} +{{- text + ((total - text|length ) * symbol ) -}} +{%- endmacro %} {{ '.. _printer-label-' + item + ':' }} @@ -28,10 +37,18 @@ Fonts .. todo:: list supported fonts (ID, Name, Columns) + Colors ^^^^^^ -.. todo:: list supported colors (ID, Name) ++------------------+----------------------------------------------------------------+ +| ID | Color | ++==================+================================================================+ +{% for id in printer.colors -%} +| {{ fill_line(escape_rst(id), 16) }} | {{ fill_line(escape_rst(printer.colors[id]), 62) }} | ++------------------+----------------------------------------------------------------+ +{% endfor %} + Feature support ^^^^^^^^^^^^^^^ @@ -57,8 +74,12 @@ starCommands clear Text code pages ^^^^^^^^^^^^^^^ -todo example encoding: :ref:`encoding-label-CP3011` - -.. todo: list code pages (ID, Encoding, link to Encoding list) ++------------------+----------------------------------------------------------------+ +| ID | Encoding | ++==================+================================================================+ +{% for id in printer.codePages -%} +| {{ fill_line(escape_rst(id), 16) }} | {{ fill_line(':ref:`encoding-label-'+printer.codePages[id]+'`', 62) }} | ++------------------+----------------------------------------------------------------+ +{% endfor %} {% endfor %} \ No newline at end of file