BastliPOSPrinter

A collection of programs that allow receipt printing
git clone git://xatko.vsos.ethz.ch/BastliPOSPrinter.git
Log | Files | Refs

commit 243bbac5cd5bac9e1147c2dcd4c4614cd8b56b30
parent bd3dc21c4fe668e05f70b69b43e6352ce2a67e05
Author: Dominik Schmidt <doeme@bastli.ethz.ch>
Date:   Mon,  3 Sep 2018 17:47:04 +0200

Escape the string before printing.

Diffstat:
pipeline/JSON_to_GROFF.d | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pipeline/JSON_to_GROFF.d b/pipeline/JSON_to_GROFF.d @@ -25,7 +25,8 @@ void main(string[] argv){ double price=art["price"].str.to!double; string name=art["name"].str; ulong amount=art["amount"].integer; - app.formattedWrite!"%d\tT{\n%s\nT}\t%.2f\n"(amount,name,price); + auto esc_name=name.replace("\\","\\\\").replace("\n","\n "); + app.formattedWrite!"%d\tT{\n%s\nT}\t%.2f\n"(amount,esc_name,price); total+=price * amount; } app~="\n";