svg.escobar.life

A simple SVG markup editor for the web

Commit
c06179370421a64ca339967310daff4b649c2731
Parent
14418f1a4e0ae85f35dccd3f534d00a387d2b097
Author
Pablo Emilio Escobar Gaviria <pablo-escobar@riseup.net>
Date

Moved things around

Diffstat

7 files changed, 259 insertions, 342 deletions

Status File Name N° Changes Insertions Deletions
Added admin-tools/d-fold.py 69 69 0
Modified assets/example.svg 350 140 210
Deleted convert.py 67 0 67
Modified src/Editor.elm 5 3 2
Modified src/Main.elm 13 2 11
Modified src/Types.elm 46 21 25
Modified src/View.elm 51 24 27
diff --git a/admin-tools/d-fold.py b/admin-tools/d-fold.py
@@ -0,0 +1,69 @@
+#!/usr/bin/python3
+# A simple utility to fold the `d` attribute of <path> tags without breaking 
+# the image
+
+import argparse
+
+def split_at(s, length, sep=" "):
+    """Split a string in 'lines' of length ~ `length`"""
+
+    s_lines = [sep + line for line in s.split(sep)]
+     
+    if not len(s_lines):
+        return []
+
+    s_lines[0] = s_lines[0].strip(sep)
+
+    lines = []
+    line = ""
+    i = 0
+
+    # Construct the lines of the new file
+    while i < len(s_lines):
+        j = i
+
+        # Construct a single line
+        while i < len(s_lines) and len(line + s_lines[i]) <= length:
+            line += s_lines[i]
+            i += 1
+
+        # Append the line to lines
+        if i != j:
+            lines.append(line.strip())
+            line = ""
+        # Line is longer than 50 chars
+        else:
+            lines.append(s_lines[i].strip())
+            i += 1
+
+    return lines
+
+def main():
+    parser = argparse.ArgumentParser()
+    parser.add_argument("--input", "-i", type=str, action="store"
+                       , default= "-", help="The input file")
+    parser.add_argument("--chars", "-n", type=int, default=50, action="store"
+                       , help="The number of characters in each line")
+
+    args = parser.parse_args()
+    path = args.input if args.input != "-" else "/dev/stdin"
+
+    with open(path, "r") as f:
+        s = f.read().replace("\n", "")
+
+        # Lines separated by spaces with at-most 50 chars
+        spaced_lines = split_at(s, args.chars)
+        lines = []
+
+        for line in spaced_lines:
+            if len(line) <= args.chars:
+                lines.append(line)
+            else:
+                lines += split_at(line, args.chars, "-")
+
+        print("\n".join(lines))
+
+if __name__ == "__main__":
+    main()
+
+
diff --git a/assets/example.svg b/assets/example.svg
@@ -1,210 +1,140 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Edit the source code of the image and preview the results -->
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 70">
-  <path fill="#2D2B55" d="M22.58 8.37h-3.67l-.66
-                          1.69h-3.31L19.17.39h3.2l4.23
-                          9.67h-3.37l-.65-1.69zm-.9-2.35l-.94-2.43
-                          -.94
-                          2.43h1.88zm13.2 4.26c-.8
-                          0-1.58-.1-2.35-.28a6.36 6.36 0 0
-                          1-1.87-.71l1.05-2.38a6.38 6.38 0 0 0
-                          3.2.88c.45 0
-                          .77-.04.96-.12.2-.1.3-.22.3-.4
-                          0-.21-.13-.36-.4-.46-.24-.1-.66-.2-1.24
-                          -.33-.63-.12-1.25-.29-1.86-.5-.5-.18-.95
-                          -.49-1.3-.88a2.4
-                          2.4 0 0
-                          1-.56-1.67c0-.61.17-1.16.52-1.66.34
-                          -.5.84-.89
-                          1.52-1.18a6.3 6.3 0 0 1 2.47-.42 8.4
-                          8.4 0 0 1 3.65.84l-.98 2.36a5.96 5.96 0
-                          0 0-2.7-.72c-.84 0-1.26.21-1.26.61 0
-                          .2.13.35.38.44.25.1.66.2 1.23.3.73.15
-                          1.35.31 1.86.49s.94.47
-                          1.31.87c.38.4.57.95.57 1.66 0 .6-.16
-                          1.16-.5 1.66-.36.48-.87.88-1.54
-                          1.17-.68.28-1.5.43-2.46.43zm5.47
-                          -9.9h3.26v9.68h-3.26V.39zm13.47
-                          9.68l-.03-4.4-2.1
-                          3.53h-1.43l-2.1-3.39v4.26h
-                          -2.97V.39h2.68l3.15
-                          5.15L54.08.39h2.68l.03
-                          9.67h-2.97zm9.2-9.67c.9 0 1.67.15
-                          2.34.44a3.4 3.4 0 0 1 1.53
-                          1.27c.36.55.54 1.2.54 1.93 0 .74-.18
-                          1.39-.54 1.94-.36.55-.87.98-1.53
-                          1.27-.67.29-1.44.44-2.34.44h-1.4v2.38h
-                          -3.25V.39h4.65zm-.2
-                          4.78c.44 0
-                          .77-.1.99-.3.22-.2.33-.48.33-.84
-                          0-.35-.1-.63-.33-.82-.22-.21-.55-.3-1
-                          -.3h
-                          -1.18v2.26h1.18zM68.48.39h3.26v7.14h4.37v2.53H68.5V.39zm16.57
-                          7.2v2.47h-8.04V.39h7.86v2.46h
-                          -4.66v1.13h4.1v2.35h-4.1V7.6h4.84zM3.98
-                          30.29c-.84 0-1.63-.1-2.36-.28a6.6 6.6 0
-                          0 1-1.82-.7l1.25-2.4c1.04.59 2.13.9
-                          3.26.9.42 0
-                          .74-.06.96-.16.22-.1.33-.23.33-.41
-                          0-.17-.11-.3-.35-.4a7.6 7.6 0 0
-                          0-1.06-.34c-.54-.13-1.08-.3-1.6-.5-.43
-                          -.17-.81-.44-1.12-.78A2.05
-                          2.05 0 0 1 1
-                          23.8c0-.73.2-1.37.58-1.9.4-.56.97-.99
-                          1.7-1.28a8.35 8.35 0 0 1
-                          4.61-.23c.57.12 1.12.32 1.62.6l-1.17
-                          2.38a5.18 5.18 0 0 0-2.65-.72c-.46
-                          0-.8.07-1.06.2-.25.12-.37.27
-                          -.37.45s.11.32.33.42c.24.1.6.2
-                          1.12.33.62.15 1.15.3 1.58.47.42.17.8.43
-                          1.12.77.31.35.47.82.47 1.38 0 .72-.2
-                          1.36-.6 1.9-.4.54-.97.96-1.7
-                          1.25-.73.3-1.6.46-2.6.46zm17.51-9.9l
-                          -6.02
-                          9.68h-3.21l-2.16-9.67h3.35l1.2 5.63
-                          3.5-5.63h3.34zm5.66 4.58H30l-.83
-                          4.17c-.51.38-1.1.65-1.77.86-.7.2-1.43.3
-                          -2.16.29-.98
-                          0-1.85-.18-2.6-.54a4.12 4.12 0 0
-                          1-2.36-3.78c0-1.12.27-2.13.8-3a5.41
-                          5.41 0 0 1 2.19-2.05 6.8 6.8 0 0 1
-                          3.23-.74c2 0 3.47.63 4.4 1.89l-2.34
-                          1.8c-.3-.38-.64-.65-.98-.8a2.83 2.83 0
-                          0 0-1.23-.25c-.57
-                          0-1.05.12-1.47.37-.42.24-.76.6-.98
-                          1.05-.22.44-.33.95-.33 1.52 0 .56.2
-                          1.03.57 1.38.37.35.9.51 1.56.51.33 0
-                          .65-.04.95-.14l.51-2.54zm16.75
-                          5.1l-.03-4.4-2.1
-                          3.53h-1.43l-2.1-3.39v4.26h-2.97v
-                          -9.67h2.68l3.15
-                          5.15 3.06-5.15h2.68l.03
-                          9.67H43.9zm11.14-1.69h-3.68l-.65
-                          1.69H47.4l4.22-9.67h3.2l4.24
-                          9.67h-3.37l-.65-1.69zm-.9-2.35l-.94-2.43
-                          -.94
-                          2.43h1.88zm9.59
-                          1.6h-.89v2.44h-3.26v-9.67h4.66c.9 0
-                          1.67.15 2.33.44a3.4 3.4 0 0 1 1.54
-                          1.27c.36.55.54 1.2.54 1.93 0 .7-.16
-                          1.3-.47 1.81-.32.52-.76.93-1.36
-                          1.23l2.03
-                          2.99h-3.48l-1.64-2.43zm1.63-3.59c0-.35
-                          -.11-.63-.33-.82-.23-.21-.56-.3-1-.3h
-                          -1.19v2.26h1.2c.43
-                          0
-                          .76-.1.99-.3.22-.2.33-.48.33-.84zm8.45
-                          2.82l-.73.82v2.39h-3.2v
-                          -9.67h3.2v3.5l3.18-3.5h3.55l-3.87
-                          4.25L80 30.06h-3.77l-2.42-3.2zm11.13
-                          3.43c-1.48 0-2.64-.4-3.47-1.2a4.46 4.46
-                          0 0 1-1.25-3.37v-5.32h3.27v5.22c0 .7.12
-                          1.23.37 1.55.26.32.62.48 1.1.48.49 0
-                          .85-.16
-                          1.1-.48.26-.32.38-.85.38-1.55v
-                          -5.22h3.2v5.32c0
-                          1.45-.4 2.57-1.24 3.37-.83.8-1.99
-                          1.2-3.46 1.2zm10.86-9.9c.9 0 1.67.16
-                          2.33.45.66.29 1.18.72 1.53
-                          1.27.36.55.54 1.2.54 1.93 0 .74-.18
-                          1.39-.54 1.94-.35.55-.87.98-1.53
-                          1.27-.66.29-1.44.44-2.33.44h-1.4v2.38h
-                          -3.26v-9.67h4.66zm-.21
-                          4.79c.44 0 .77-.1
-                          1-.3.21-.2.33-.48.33-.84
-                          0-.35-.11-.63-.34-.82-.22-.21-.55-.3-1
-                          -.3H94.4v2.26h1.19zM13.48
-                          47.6v2.46H5.43v
-                          -9.67h7.87v2.46H8.64v1.13h4.09v2.35H8.64v1.27h4.84zm1.25
-                          -7.21h4.77c1.08
-                          0 2.03.19 2.86.6.82.38 1.46.93 1.92
-                          1.66.44.74.68 1.6.68 2.57 0 .98-.24
-                          1.84-.68 2.57a4.57 4.57 0 0 1-1.92 1.69
-                          6.7 6.7 0 0 1-2.86.58h-4.77v-9.67zm4.63
-                          7.13c.7 0 1.26-.2
-                          1.69-.6.41-.4.62-.96.62-1.7
-                          0-.73-.2-1.28-.64-1.68a2.3 2.3 0 0
-                          0-1.67-.61H18v4.59h1.37zm6.79
-                          -7.13h3.26v9.67h-3.26v-9.67zm6.93
-                          2.52h-2.83V40.4h8.93v2.52h-2.84v7.15h
-                          -3.26V42.9zm11.87
-                          7.37a6.03 6.03 0 0 1-2.8-.65 4.84 4.84
-                          0 0 1-2.66-4.4c0-.98.24-1.85.7-2.62a4.9
-                          4.9 0 0 1 1.96-1.8 6.05 6.05 0 0 1
-                          2.8-.65c1.04 0 1.98.23 2.8.66a4.89 4.89
-                          0 0 1 2.66 4.4 4.85 4.85 0 0 1-2.65
-                          4.41c-.83.43-1.77.65-2.81.65zm0-2.64c.4
-                          0 .77-.1
-                          1.1-.3.32-.2.59-.47.78-.85.2-.36.29
-                          -.78.29-1.27
-                          0-.48-.1-.9-.3-1.28a2.07 2.07 0 0
-                          0-1.88-1.13c-.39
-                          0-.76.1-1.1.28-.32.21-.59.5-.77.85-.2.37
-                          -.29.8-.29
-                          1.28 0 .49.1.91.3 1.27a2.08 2.08 0 0 0
-                          1.87
-                          1.15zm10.79-.01h-.88v2.43H51.6v
-                          -9.67h4.65c.9
-                          0 1.67.15 2.34.44.66.29 1.17.72 1.53
-                          1.27.36.55.54 1.2.54 1.93 0 .7-.15
-                          1.3-.47 1.81-.32.51-.76.93-1.35
-                          1.23l2.03
-                          2.99h-3.48l-1.65-2.43zm1.63-3.6c0-.36-.1
-                          -.63-.33-.83-.22-.2-.55-.3-1-.3h
-                          -1.18v2.27h1.18c.45
-                          0 .78-.1
-                          1-.3.22-.2.33-.48.33-.84zm11.93
-                          -1.18v1.65h4.03v2.46h-4.04v3.1h-3.26v
-                          -9.67h7.87v2.46h-4.6zm10.63
-                          7.43a6.03 6.03 0 0 1-2.8-.65 4.84 4.84
-                          0 0 1-2.65-4.4c0-.98.23-1.85.7-2.62a4.9
-                          4.9 0 0 1 1.95-1.8 6.05 6.05 0 0 1
-                          2.8-.65c1.04 0 1.98.23 2.8.65a4.89 4.89
-                          0 0 1 2.66 4.41 4.85 4.85 0 0 1-2.65
-                          4.41c-.83.43-1.77.65-2.8.65zm0-2.64c.4
-                          0 .78-.1
-                          1.1-.3.33-.2.59-.47.78-.85.2-.36.3-.78.3
-                          -1.27
-                          0-.48-.1-.9-.3-1.28a2.07 2.07 0 0
-                          0-1.88-1.13c-.4
-                          0-.77.1-1.1.28-.33.21-.6.5-.78.85-.19.37
-                          -.29.8-.29
-                          1.28 0 .49.1.91.3 1.27a2.08 2.08 0 0 0
-                          1.87
-                          1.15zm10.8-.01h-.89v2.43h-3.26v
-                          -9.67h4.66c.9
-                          0 1.67.15 2.33.44.66.29 1.18.72 1.54
-                          1.27.36.55.53 1.2.53 1.93 0 .7-.15
-                          1.3-.47 1.81-.31.51-.76.93-1.35
-                          1.23l2.03
-                          2.99h-3.48l-1.64-2.43zm1.62-3.6c0-.36-.1
-                          -.63-.33-.83-.22-.2-.55-.3-1-.3h
-                          -1.18v2.27h1.19c.44
-                          0 .77-.1
-                          1-.3.21-.2.32-.48.32-.84zm-74.1
-                          18.88H15.4V60.4h8.92v2.52H21.5v7.15h
-                          -3.26V62.9zM34.7
-                          60.4v9.67h-3.26v-3.57h-3.01v3.57h-3.26v
-                          -9.67h3.26v3.42h3.01V60.4h3.26zm9.62
-                          7.2v2.47h-8.04v-9.67h7.86v2.46h
-                          -4.66v1.13h4.1v2.35h
-                          -4.1v1.27h4.84zm21.14-7.2l-3.1
-                          9.67h-3.5l-1.55-5.17-1.65
-                          5.17h-3.5l-3.09-9.67h3.36l1.68 5.5
-                          1.79-5.5h3l1.68 5.56
-                          1.78-5.56h3.1zm8.76
-                          7.2v2.47h-8.04v-9.67h7.86v2.46h
-                          -4.66v1.13h4.1v2.35h-4.1v1.27h4.84zm9
-                          -2.59c.56.2
-                          1 .53 1.32.93.32.4.47.9.47 1.46 0
-                          .84-.35 1.5-1.05 1.98a5.6 5.6 0 0
-                          1-3.04.69h-5.45v-9.67h5.17a5.1 5.1 0 0
-                          1 2.92.69c.66.45 1 1.07 1 1.83 0
-                          .46-.12.86-.34 1.22-.23.36-.56.65-1
-                          .87zm-4.54-2.33v1.43h1.52c.7 0 1.06-.23
-                          1.06-.71
-                          0-.49-.36-.72-1.06-.72h-1.52zm1.96
-                          5.1c.72 0 1.08-.24
-                          1.08-.75s-.36-.76-1.08
-                          -.76H78.7v1.52h1.96z"/>
-</svg>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Edit the source code of the image and preview the results -->
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 70">
+  <path fill="#0d1928" 
+        d="M22.58 8.37h-3.67l-.66 1.69h-3.31L19.17.39h3.2l4.23
+           9.67h-3.37l-.65-1.69zm-.9-2.35l-.94-2.43 -.94
+           2.43h1.88zm13.2 4.26c-.8 0-1.58-.1-2.35-.28a6.36 6.36 0
+           0 1-1.87-.71l1.05-2.38a6.38 6.38 0 0 0 3.2.88c.45 0
+           .77-.04.96-.12.2-.1.3-.22.3-.4
+           0-.21-.13-.36-.4-.46-.24-.1-.66-.2-1.24
+           -.33-.63-.12-1.25-.29-1.86-.5-.5-.18-.95
+           -.49-1.3-.88a2.4 2.4 0 0
+           1-.56-1.67c0-.61.17-1.16.52-1.66.34 -.5.84-.89
+           1.52-1.18a6.3 6.3 0 0 1 2.47-.42 8.4 8.4 0 0 1
+           3.65.84l-.98 2.36a5.96 5.96 0 0 0-2.7-.72c-.84
+           0-1.26.21-1.26.61 0 .2.13.35.38.44.25.1.66.2
+           1.23.3.73.15 1.35.31 1.86.49s.94.47
+           1.31.87c.38.4.57.95.57 1.66 0 .6-.16 1.16-.5
+           1.66-.36.48-.87.88-1.54
+           1.17-.68.28-1.5.43-2.46.43zm5.47
+           -9.9h3.26v9.68h-3.26V.39zm13.47 9.68l-.03-4.4-2.1
+           3.53h-1.43l-2.1-3.39v4.26h -2.97V.39h2.68l3.15
+           5.15L54.08.39h2.68l.03 9.67h-2.97zm9.2-9.67c.9 0
+           1.67.15 2.34.44a3.4 3.4 0 0 1 1.53 1.27c.36.55.54
+           1.2.54 1.93 0 .74-.18 1.39-.54 1.94-.36.55-.87.98-1.53
+           1.27-.67.29-1.44.44-2.34.44h-1.4v2.38h
+           -3.25V.39h4.65zm-.2 4.78c.44 0
+           .77-.1.99-.3.22-.2.33-.48.33-.84
+           0-.35-.1-.63-.33-.82-.22-.21-.55-.3-1 -.3h
+           -1.18v2.26h1.18zM68.48.39h3.26v7.14h4.37
+           v2.53H68.5V.39zm16.57 7.2v2.47h-8.04V.39h7.86v2.46h
+           -4.66v1.13h4.1v2.35h-4.1V7.6h4.84zM3.98 30.29c-.84
+           0-1.63-.1-2.36-.28a6.6 6.6 0 0
+           1-1.82-.7l1.25-2.4c1.04.59 2.13.9 3.26.9.42 0
+           .74-.06.96-.16.22-.1.33-.23.33-.41
+           0-.17-.11-.3-.35-.4a7.6 7.6 0 0
+           0-1.06-.34c-.54-.13-1.08-.3-1.6-.5-.43
+           -.17-.81-.44-1.12-.78A2.05 2.05 0 0 1 1
+           23.8c0-.73.2-1.37.58-1.9.4-.56.97-.99 1.7-1.28a8.35
+           8.35 0 0 1 4.61-.23c.57.12 1.12.32 1.62.6l-1.17
+           2.38a5.18 5.18 0 0 0-2.65-.72c-.46
+           0-.8.07-1.06.2-.25.12-.37.27
+           -.37.45s.11.32.33.42c.24.1.6.2 1.12.33.62.15 1.15.3
+           1.58.47.42.17.8.43 1.12.77.31.35.47.82.47 1.38 0 .72-.2
+           1.36-.6 1.9-.4.54-.97.96-1.7
+           1.25-.73.3-1.6.46-2.6.46zm17.51-9.9l -6.02
+           9.68h-3.21l-2.16-9.67h3.35l1.2 5.63 3.5-5.63h3.34zm5.66
+           4.58H30l-.83 4.17c-.51.38-1.1.65-1.77.86-.7.2-1.43.3
+           -2.16.29-.98 0-1.85-.18-2.6-.54a4.12 4.12 0 0
+           1-2.36-3.78c0-1.12.27-2.13.8-3a5.41 5.41 0 0 1
+           2.19-2.05 6.8 6.8 0 0 1 3.23-.74c2 0 3.47.63 4.4
+           1.89l-2.34 1.8c-.3-.38-.64-.65-.98-.8a2.83 2.83 0 0
+           0-1.23-.25c-.57 0-1.05.12-1.47.37-.42.24-.76.6-.98
+           1.05-.22.44-.33.95-.33 1.52 0 .56.2 1.03.57
+           1.38.37.35.9.51 1.56.51.33 0
+           .65-.04.95-.14l.51-2.54zm16.75 5.1l-.03-4.4-2.1
+           3.53h-1.43l-2.1-3.39v4.26h-2.97v -9.67h2.68l3.15 5.15
+           3.06-5.15h2.68l.03 9.67H43.9zm11.14-1.69h-3.68l-.65
+           1.69H47.4l4.22-9.67h3.2l4.24
+           9.67h-3.37l-.65-1.69zm-.9-2.35l-.94-2.43 -.94
+           2.43h1.88zm9.59 1.6h-.89v2.44h-3.26v-9.67h4.66c.9 0
+           1.67.15 2.33.44a3.4 3.4 0 0 1 1.54 1.27c.36.55.54
+           1.2.54 1.93 0 .7-.16 1.3-.47 1.81-.32.52-.76.93-1.36
+           1.23l2.03 2.99h-3.48l-1.64-2.43zm1.63-3.59c0-.35
+           -.11-.63-.33-.82-.23-.21-.56-.3-1-.3h
+           -1.19v2.26h1.2c.43 0
+           .76-.1.99-.3.22-.2.33-.48.33-.84zm8.45
+           2.82l-.73.82v2.39h-3.2v
+           -9.67h3.2v3.5l3.18-3.5h3.55l-3.87 4.25L80
+           30.06h-3.77l-2.42-3.2zm11.13 3.43c-1.48
+           0-2.64-.4-3.47-1.2a4.46 4.46 0 0
+           1-1.25-3.37v-5.32h3.27v5.22c0 .7.12 1.23.37
+           1.55.26.32.62.48 1.1.48.49 0 .85-.16
+           1.1-.48.26-.32.38-.85.38-1.55v -5.22h3.2v5.32c0 1.45-.4
+           2.57-1.24 3.37-.83.8-1.99 1.2-3.46 1.2zm10.86-9.9c.9 0
+           1.67.16 2.33.45.66.29 1.18.72 1.53 1.27.36.55.54 1.2.54
+           1.93 0 .74-.18 1.39-.54 1.94-.35.55-.87.98-1.53
+           1.27-.66.29-1.44.44-2.33.44h-1.4v2.38h
+           -3.26v-9.67h4.66zm-.21 4.79c.44 0 .77-.1
+           1-.3.21-.2.33-.48.33-.84
+           0-.35-.11-.63-.34-.82-.22-.21-.55-.3-1
+           -.3H94.4v2.26h1.19zM13.48 47.6v2.46H5.43v
+           -9.67h7.87v2.46H8.64v1.13h4.09v2.35
+           H8.64v1.27h4.84zm1.25 -7.21h4.77c1.08 0 2.03.19
+           2.86.6.82.38 1.46.93 1.92 1.66.44.74.68 1.6.68 2.57 0
+           .98-.24 1.84-.68 2.57a4.57 4.57 0 0 1-1.92 1.69 6.7 6.7
+           0 0 1-2.86.58h-4.77v-9.67zm4.63 7.13c.7 0 1.26-.2
+           1.69-.6.41-.4.62-.96.62-1.7 0-.73-.2-1.28-.64-1.68a2.3
+           2.3 0 0 0-1.67-.61H18v4.59h1.37zm6.79
+           -7.13h3.26v9.67h-3.26v-9.67zm6.93
+           2.52h-2.83V40.4h8.93v2.52h-2.84v7.15h -3.26V42.9zm11.87
+           7.37a6.03 6.03 0 0 1-2.8-.65 4.84 4.84 0 0
+           1-2.66-4.4c0-.98.24-1.85.7-2.62a4.9 4.9 0 0 1 1.96-1.8
+           6.05 6.05 0 0 1 2.8-.65c1.04 0 1.98.23 2.8.66a4.89 4.89
+           0 0 1 2.66 4.4 4.85 4.85 0 0 1-2.65
+           4.41c-.83.43-1.77.65-2.81.65zm0-2.64c.4 0 .77-.1
+           1.1-.3.32-.2.59-.47.78-.85.2-.36.29 -.78.29-1.27
+           0-.48-.1-.9-.3-1.28a2.07 2.07 0 0 0-1.88-1.13c-.39
+           0-.76.1-1.1.28-.32.21-.59.5-.77.85-.2.37 -.29.8-.29
+           1.28 0 .49.1.91.3 1.27a2.08 2.08 0 0 0 1.87
+           1.15zm10.79-.01h-.88v2.43H51.6v -9.67h4.65c.9 0 1.67.15
+           2.34.44.66.29 1.17.72 1.53 1.27.36.55.54 1.2.54 1.93 0
+           .7-.15 1.3-.47 1.81-.32.51-.76.93-1.35 1.23l2.03
+           2.99h-3.48l-1.65-2.43zm1.63-3.6c0-.36-.1
+           -.63-.33-.83-.22-.2-.55-.3-1-.3h -1.18v2.27h1.18c.45 0
+           .78-.1 1-.3.22-.2.33-.48.33-.84zm11.93
+           -1.18v1.65h4.03v2.46h-4.04v3.1h-3.26v
+           -9.67h7.87v2.46h-4.6zm10.63 7.43a6.03 6.03 0 0
+           1-2.8-.65 4.84 4.84 0 0
+           1-2.65-4.4c0-.98.23-1.85.7-2.62a4.9 4.9 0 0 1 1.95-1.8
+           6.05 6.05 0 0 1 2.8-.65c1.04 0 1.98.23 2.8.65a4.89 4.89
+           0 0 1 2.66 4.41 4.85 4.85 0 0 1-2.65
+           4.41c-.83.43-1.77.65-2.8.65zm0-2.64c.4 0 .78-.1
+           1.1-.3.33-.2.59-.47.78-.85.2-.36.3-.78.3 -1.27
+           0-.48-.1-.9-.3-1.28a2.07 2.07 0 0 0-1.88-1.13c-.4
+           0-.77.1-1.1.28-.33.21-.6.5-.78.85-.19.37 -.29.8-.29
+           1.28 0 .49.1.91.3 1.27a2.08 2.08 0 0 0 1.87
+           1.15zm10.8-.01h-.89v2.43h-3.26v -9.67h4.66c.9 0 1.67.15
+           2.33.44.66.29 1.18.72 1.54 1.27.36.55.53 1.2.53 1.93 0
+           .7-.15 1.3-.47 1.81-.31.51-.76.93-1.35 1.23l2.03
+           2.99h-3.48l-1.64-2.43zm1.62-3.6c0-.36-.1
+           -.63-.33-.83-.22-.2-.55-.3-1-.3h -1.18v2.27h1.19c.44 0
+           .77-.1 1-.3.21-.2.32-.48.32-.84zm-74.1
+           18.88H15.4V60.4h8.92v2.52H21.5v7.15h -3.26V62.9zM34.7
+           60.4v9.67h-3.26v-3.57h-3.01v3.57h-3.26v
+           -9.67h3.26v3.42h3.01V60.4h3.26zm9.62
+           7.2v2.47h-8.04v-9.67h7.86v2.46h -4.66v1.13h4.1v2.35h
+           -4.1v1.27h4.84zm21.14-7.2l-3.1
+           9.67h-3.5l-1.55-5.17-1.65
+           5.17h-3.5l-3.09-9.67h3.36l1.68 5.5 1.79-5.5h3l1.68 5.56
+           1.78-5.56h3.1zm8.76 7.2v2.47h-8.04v-9.67h7.86v2.46h
+           -4.66v1.13h4.1v2.35h-4.1v1.27h4.84zm9 -2.59c.56.2 1 .53
+           1.32.93.32.4.47.9.47 1.46 0 .84-.35 1.5-1.05 1.98a5.6
+           5.6 0 0 1-3.04.69h-5.45v-9.67h5.17a5.1 5.1 0 0 1
+           2.92.69c.66.45 1 1.07 1 1.83 0 .46-.12.86-.34
+           1.22-.23.36-.56.65-1 .87zm-4.54-2.33v1.43h1.52c.7 0
+           1.06-.23 1.06-.71 0-.49-.36-.72-1.06-.72h-1.52zm1.96
+           5.1c.72 0 1.08-.24 1.08-.75s-.36-.76-1.08
+           -.76H78.7v1.52h1.96z"/>
+</svg>
diff --git a/convert.py b/convert.py
@@ -1,67 +0,0 @@
-#!/usr/bin/python3
-
-import argparse
-
-def split_at(s, length, sep=" "):
-    """Split a string in lines of length up to length"""
-
-    s_lines = [sep + line for line in s.split(sep)]
-     
-    if not len(s_lines):
-        return []
-
-    s_lines[0] = s_lines[0].strip(sep)
-
-    lines = []
-    line = ""
-    i = 0
-
-    # Construct the lines of the new file
-    while i < len(s_lines):
-        j = i
-
-        # Construct a single line
-        while i < len(s_lines) and len(line + s_lines[i]) <= length:
-            line += s_lines[i]
-            i += 1
-
-        # Append the line to lines
-        if i != j:
-            lines.append(line.strip())
-            line = ""
-        # Line is longer than 50 chars
-        else:
-            lines.append(s_lines[i].strip())
-            i += 1
-
-    return lines
-
-def main():
-    parser = argparse.ArgumentParser()
-    parser.add_argument("--input", "-i", type=str, action="store"
-                       , default= "-", help="The input file")
-    parser.add_argument("--chars", "-n", type=int, default=50, action="store"
-                       , help="The number of characters in each line")
-
-    args = parser.parse_args()
-    path = args.input if args.input != "-" else "/dev/stdin"
-
-    with open(path, "r") as f:
-        s = f.read().replace("\n", "")
-
-        # Lines separated by spaces with at-most 50 chars
-        spaced_lines = split_at(s, args.chars)
-        lines = []
-
-        for line in spaced_lines:
-            if len(line) <= args.chars:
-                lines.append(line)
-            else:
-                lines += split_at(line, args.chars, "-")
-
-        print("\n".join(lines))
-
-if __name__ == "__main__":
-    main()
-
-
diff --git a/src/Editor.elm b/src/Editor.elm
@@ -11,7 +11,8 @@ import SyntaxHighlight exposing (xml, toBlockHtml)
 
 editor : Model -> Html Msg
 editor model =
-  div [ id "editor"
+  div 
+    [ id "editor"
     , region
     , label "Text editor" 
     ]
@@ -56,5 +57,5 @@ translate (x, y) =
       ("translate(" ++ (show -x) ++ "px, " ++ (show -y) ++ "px)")
 
 placeholder : String
-placeholder = "<svg ...> ... </svg>"
+placeholder = "<svg> ... </svg>"
 
diff --git a/src/Main.elm b/src/Main.elm
@@ -33,7 +33,7 @@ update msg model =
       ({ model | status = val }, Cmd.none)
 
     ToggleDarkMode ->
-      ({ model | mode = toggle model.mode }, Cmd.none)
+      ({ model | darkModeOn = not model.darkModeOn }, Cmd.none)
 
     Download ->
       (model, Download.string model.fileName "image/svg+xml" model.image)
@@ -71,7 +71,7 @@ init =
   in
     { image = emptySvg
     , status = Valid
-    , mode = Light
+    , darkModeOn = False
     , uriEncoder = Maybe.withDefault Regex.never (Regex.fromString re)
     , fileName = "example.svg"
     , editorScroll = (0, 0)
@@ -85,15 +85,6 @@ loadContent =
     , expect = Http.expectString Load
     }
 
-toggle : Mode -> Mode
-toggle mode =
-  case mode of
-    Light -> 
-      Dark
-
-    Dark -> 
-      Light
-
 emptySvg : String
 emptySvg = "<svg> . . . </svg>"
 
diff --git a/src/Types.elm b/src/Types.elm
@@ -5,37 +5,33 @@ import File exposing (File)
 import Regex exposing (Regex)
 
 type alias Model =
-    { image : String
-    , status : Status
-    , mode : Mode
-    , uriEncoder : Regex
-    , fileName : String
-    , editorScroll : (Int, Int)
-    , load : Load
-    }
+  { image : String
+  , status : Status
+  , darkModeOn : Bool
+  , uriEncoder : Regex
+  , fileName : String
+  , editorScroll : (Int, Int)
+  , load : Load
+  }
 
 type Status
-    = Valid
-    | Invalid
-
-type Mode
-    = Light
-    | Dark
+  = Valid
+  | Invalid
 
 type Load
-    = Loading
-    | Loaded
+  = Loading
+  | Loaded
 
 type Upload
-    = Requested
-    | Selected File
+  = Requested
+  | Selected File
 
 type Msg
-    = Update String
-    | Load (Result Http.Error String)
-    | Validation Status
-    | ToggleDarkMode
-    | Download
-    | Upload Upload
-    | Scroll (Int, Int)
+  = Update String
+  | Load (Result Http.Error String)
+  | Validation Status
+  | ToggleDarkMode
+  | Download
+  | Upload Upload
+  | Scroll (Int, Int)
 
diff --git a/src/View.elm b/src/View.elm
@@ -39,12 +39,12 @@ view : Model -> Document Msg
 view model =
   { title = "SVG Editor"
   , body =
-    case model.load of
-      Loading -> 
-        []
+      case model.load of
+        Loading -> 
+          []
 
-      Loaded -> 
-        [ lazy container model ]
+        Loaded -> 
+          [ lazy container model ]
   }
 
 container : Model -> Html Msg
@@ -65,7 +65,7 @@ display model =
     (
       [ id "display"
       , region
-      , class (if darkMode model.mode then "dark" else "light") 
+      , class (if model.darkModeOn then "dark" else "light") 
       , label "Picture preview"
       ] 
       ++ 
@@ -90,13 +90,14 @@ display model =
         [ onClick ToggleDarkMode
         , label "Toggle dark mode"
         ] 
-        [ bulbIcon model.mode ]
+        [ bulbIcon model ]
     ]
 
 uri : Model -> String
 uri model =
   "data:image/svg+xml;utf8," 
-    ++ (replace model.uriEncoder percentEscape model.image)
+  ++ 
+  (replace model.uriEncoder percentEscape model.image)
 
 percentEscape : Match -> String
 percentEscape m =
@@ -139,19 +140,12 @@ loaded model =
 valid : Status -> Bool
 valid status =
   case status of
-    Valid   -> True
-
-    Invalid -> False
+    Valid -> 
+      True
 
-darkMode : Mode -> Bool
-darkMode mode =
-  case mode of
-    Light -> 
+    Invalid -> 
       False
 
-    Dark -> 
-      True
-
 downloadIcon : Html Msg
 downloadIcon = 
   img 
@@ -170,15 +164,18 @@ uploadIcon =
     ] 
     []
 
-bulbIcon : Mode -> Html Msg
-bulbIcon mode =
-  img 
-    [ src 
-        (if darkMode mode then "assets/bulb-on.svg" else "assets/bulb-off.svg")
-    , hidden True
-    , alt "Toggle dark mode"
-    ] 
-    []
+bulbIcon : Model -> Html Msg
+bulbIcon model =
+  let
+    bulbOn = "assets/bulb-on.svg" 
+    bulbOff = "assets/bulb-off.svg"
+  in
+    img 
+      [ src (if model.darkModeOn then bulbOn else bulbOff)
+      , hidden True
+      , alt "Toggle dark mode"
+      ] 
+      []
 
 errorIcon : Html Msg
 errorIcon =