blabel icon indicating copy to clipboard operation
blabel copied to clipboard

Too long text is silently discarded

Open hlovdal opened this issue 5 years ago • 3 comments

With a template like

<img src="{{label_tools.qr_code(label_id)}}"/>
<span class='label'>{{ label_text }}</span>

css style like in README.rst and records like

records= [
...
    dict(label_id="112", label_text="123456789012"),
    dict(label_id="113", label_text="1234567890123"),
    dict(label_id="114", label_text="12345678901234"),
    dict(label_id="115", label_text="123456789012345"),
    dict(label_id="116", label_text="1234567890123456"),
    dict(label_id="117", label_text="12345678901234567"),
    dict(label_id="118", label_text="123456789012345678"),
...

all labels after "12345678901234" only contains the QR code while the text is blank.

One thing is not handling auto-scaling or word splitting, but silently dropping input is really bad. Could you please fix to at least give a warning/error?

hlovdal avatar Jan 06 '20 12:01 hlovdal

Can you provide a full example, with HTML, CSS and python? I suspect that the issue here is not "dropping input" but a formatting issue: when the label is too long, it gets printed on a new line that falls outside of the printed area of the label. This could be partially fixed by CSS, using either text-overflow: ellipsis; or word-break: always;.

Zulko avatar Jan 06 '20 17:01 Zulko

I too am having this issue. I'm re writing a script with your library. I need to resize the text so it fits the label. No idea how to do it with css. Have tried multiple ways :/ .

W-M-D avatar Feb 12 '20 11:02 W-M-D

You could decide the font size (or even the page size) based on the label length, on the python side, since the template uses Jinja.

Zulko avatar Feb 12 '20 12:02 Zulko