mirror of
https://github.com/python-escpos/python-escpos
synced 2025-08-24 09:03:34 +00:00
Add printer profile list to documentation (#536)
* add first draft of printer profile listing * add todos * Update doc/capability_templates/capabilities-template.jinja * Update doc/capability_templates/capabilities-template.jinja * restructure documentation * add encoding list * add color and encoding table * add notes on usage * add feature table
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
{% for item in data.encodings %}
|
||||
{% set encoding = data.encodings[item] %}
|
||||
{% macro draw_with_underline(text, symbol='-') -%}
|
||||
{{ escape_rst(text) }}
|
||||
{{ escape_rst(text) | length * symbol }}
|
||||
{%- endmacro %}
|
||||
|
||||
{{ '.. _encoding-label-' + item + ':' }}
|
||||
|
||||
{{ draw_with_underline(encoding.name) }}
|
||||
|
||||
{{ escape_rst(encoding.notes) }}
|
||||
|
||||
Mapping Information
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
====================== ================================================================
|
||||
identifier {{ escape_rst(item) }}
|
||||
Name {{ escape_rst(encoding.name|default('Unknown')) }}
|
||||
Iconv Name {{ escape_rst(encoding.iconv|default('Unknown')) }}
|
||||
``python_encode`` Name {{ escape_rst(encoding.python_encode|default('Unknown')) }}
|
||||
====================== ================================================================
|
||||
|
||||
{% if encoding.data is defined %}
|
||||
{{ draw_with_underline('Code page data', symbol='^') }}
|
||||
{{ encoding.data }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
83
doc/capability_templates/capabilities-template.jinja
Normal file
83
doc/capability_templates/capabilities-template.jinja
Normal file
@@ -0,0 +1,83 @@
|
||||
{% for item in data.profiles %}
|
||||
{% set printer = data.profiles[item] %}
|
||||
{% macro draw_with_underline(text, symbol='-') -%}
|
||||
{{ 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 + ':' }}
|
||||
|
||||
{{ draw_with_underline(printer.name) }}
|
||||
{{ escape_rst(printer.notes) }}
|
||||
|
||||
You can select this profile in python-escpos with this identifier: ``{{ item }}``.
|
||||
(Set parameter to `profile='{{ item }}'`.)
|
||||
|
||||
Basic information
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
====================== ================================================================
|
||||
Name {{ escape_rst(printer.name|default('Unknown')) }}
|
||||
Vendor {{ escape_rst(printer.vendor|default('Unknown')) }}
|
||||
Media width (mm) {{ escape_rst(printer.media.width.mm|default('Unknown')|string) }}
|
||||
Media width (pixels) {{ escape_rst(printer.media.width.pixels|default('Unknown')|string) }}
|
||||
DPI {{ escape_rst(printer.media.dpi|default('Unknown')|string) }}
|
||||
====================== ================================================================
|
||||
|
||||
Fonts
|
||||
^^^^^
|
||||
|
||||
+------------------+------------------------------+-----------------------+
|
||||
| ID | Name | Columns |
|
||||
+==================+==============================+=======================+
|
||||
{% for id in printer.fonts -%}
|
||||
| {{ fill_line(escape_rst(id), 16) }} | {{ fill_line(escape_rst(printer.fonts[id].name), 28) }} | {{ fill_line(printer.fonts[id].columns|string, 21) }} |
|
||||
+------------------+------------------------------+-----------------------+
|
||||
{% endfor %}
|
||||
|
||||
|
||||
Colors
|
||||
^^^^^^
|
||||
|
||||
+------------------+----------------------------------------------------------------+
|
||||
| ID | Color |
|
||||
+==================+================================================================+
|
||||
{% for id in printer.colors -%}
|
||||
| {{ fill_line(escape_rst(id), 16) }} | {{ fill_line(escape_rst(printer.colors[id]), 62) }} |
|
||||
+------------------+----------------------------------------------------------------+
|
||||
{% endfor %}
|
||||
|
||||
|
||||
Feature support
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
+-----------------------------------+----------------------------+
|
||||
| Feature | Supported |
|
||||
+===================================+============================+
|
||||
{% for feature in printer.features -%}
|
||||
| {{ fill_line(escape_rst(feature), 33) }} | {{ fill_line(escape_rst(printer.features[feature]|string), 26) }} |
|
||||
+-----------------------------------+----------------------------+
|
||||
{% endfor %}
|
||||
|
||||
|
||||
Text code pages
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
+------------------+----------------------------------------------------------------+
|
||||
| ID | Encoding |
|
||||
+==================+================================================================+
|
||||
{% for id in printer.codePages -%}
|
||||
| {{ fill_line(escape_rst(id), 16) }} | {{ fill_line(':ref:`encoding-label-'+printer.codePages[id]+'`', 62) }} |
|
||||
+------------------+----------------------------------------------------------------+
|
||||
{% endfor %}
|
||||
|
||||
{% endfor %}
|
Reference in New Issue
Block a user