From afbad13f51c9c4c4cb636409aa4ee5cbee631dc9 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Sun, 19 Feb 2023 20:52:02 +0100 Subject: [PATCH] Add short URL and CLI to rendered drawing --- boxes/drawing.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/boxes/drawing.py b/boxes/drawing.py index 715c2cc..b7b4d16 100644 --- a/boxes/drawing.py +++ b/boxes/drawing.py @@ -434,6 +434,7 @@ class SVGSurface(Surface): if "url" in md and md["url"]: self._addTag(w, 'dc:source', md["url"]) + self._addTag(w, 'dc:source', md["url_short"]) else: self._addTag(w, 'dc:source', md["cli"]) @@ -442,9 +443,12 @@ class SVGSurface(Surface): desc += "\n\n" + md["description"] desc += "\n\nCreated with Boxes.py (https://festi.info/boxes.py)\n" desc += "Command line: %s\n" % md["cli"] + desc += "Command line short: %s\n" % md["cli_short"] if md["url"]: desc += "Url: %s\n" % md["url"] + desc += "Url short: %s\n" % md["url_short"] desc += "SettingsUrl: %s\n" % md["url"].replace("&render=1", "") + desc += "SettingsUrl short: %s\n" % md["url_short"].replace("&render=1", "") self._addTag(w, 'dc:description', desc) # title @@ -465,11 +469,13 @@ Created with Boxes.py (https://festi.info/boxes.py) Creation date: {date} """.format(date=date, **md) - txt += "Command line (remove spaces between dashes): %s\n" % md["cli"] + txt += "Command line (remove spaces between dashes): %s\n" % md["cli_short"] if md["url"]: txt += "Url: %s\n" % md["url"] + txt += "Url short: %s\n" % md["url_short"] txt += "SettingsUrl: %s\n" % md["url"].replace("&render=1", "") + txt += "SettingsUrl short: %s\n" % md["url_short"].replace("&render=1", "") m = ET.Comment(txt.replace("--", "- -").replace("--", "- -")) # ---- m.tail = '\n' root.insert(0, m) @@ -611,9 +617,12 @@ class PSSurface(Surface): desc += "%\n" desc += "%% Command line: %s\n" % md["cli"] + desc += "%% Command line short: %s\n" % md["cli_short"] if md["url"]: desc += f'%%Url: {md["url"]}\n' + desc += f'%%Url short: {md["url_short"]}\n' desc += f'%%SettingsUrl: {md["url"].replace("&render=1", "")}\n' + desc += f'%%SettingsUrl short: {md["url_short"].replace("&render=1", "")}\n' return desc def finish(self, inner_corners="loop"):