Skip to content

Instantly share code, notes, and snippets.

@Kungi
Last active July 5, 2018 10:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kungi/94eaef7d27fbeb33e13a531a296d4397 to your computer and use it in GitHub Desktop.
Save Kungi/94eaef7d27fbeb33e13a531a296d4397 to your computer and use it in GitHub Desktop.
(def data (zip/xml-zip
(xml/parse
(io/input-stream (io/resource "public/img/test.xml")))))
(defn edit-text [loc]
(zip/edit
loc
(fn [l] (assoc-in l [:content] [(zip-xml/text loc)]))))
(def texts (zip-xml/xml-> data
:svg
:g
zip/down
:g
:text
edit-text
zip/root))
(with-out-str
(xml/emit (first texts)))
({:tag :svg,
:attrs
{:y "0pt",
:zoomAndPan "magnify",
:preserveAspectRatio "xMidYMid meet",
:xml:space "preserve",
:contentScriptType "application/ecmascript",
:width "243.78pt",
:xmlns "http://www.w3.org/2000/svg",
:contentStyleType "text/css",
:xmlns:xlink "http://www.w3.org/1999/xlink",
:x "0pt",
:version "1.1",
:height "153.071pt"},
:content
[{:tag :g,
:attrs {:fill "none", :clip-path "url(#clp1)"},
:content
[{:tag :g,
:attrs {:transform "matrix(11 0 0 11 2.1009 10.3821)"},
:content
[{:tag :text,
:attrs
{:kerning "0",
:word-spacing "0",
:letter-spacing "0",
:glyph-orientation-horizontal "0.0",
:font-size "1",
:font-family "'Arial-BoldMT'",
:fill "#000000"},
:content ["Not"]}]}]}
{:tag :g,
:attrs {:fill "none", :clip-path "url(#clp1)"},
:content
[{:tag :g,
:attrs {:transform "matrix(11 0 0 11 2.1009 10.3821)"},
:content
[{:tag :text,
:attrs
{:kerning "0",
:word-spacing "0",
:letter-spacing "0",
:glyph-orientation-horizontal "0.0",
:font-size "1",
:font-family "'Arial-BoldMT'",
:fill "#000000"},
:content
[{:tag :tspan, :attrs {:y "0", :x "0"}, :content ["N"]}
{:tag :tspan, :attrs {:y "0", :x "0.722"}, :content ["o"]}
{:tag :tspan,
:attrs {:y "0", :x "1.333"},
:content ["t"]}]}]}]}]}
{:tag :svg,
:attrs
{:y "0pt",
:zoomAndPan "magnify",
:preserveAspectRatio "xMidYMid meet",
:xml:space "preserve",
:contentScriptType "application/ecmascript",
:width "243.78pt",
:xmlns "http://www.w3.org/2000/svg",
:contentStyleType "text/css",
:xmlns:xlink "http://www.w3.org/1999/xlink",
:x "0pt",
:version "1.1",
:height "153.071pt"},
:content
[{:tag :g,
:attrs {:fill "none", :clip-path "url(#clp1)"},
:content
[{:tag :g,
:attrs {:transform "matrix(11 0 0 11 2.1009 10.3821)"},
:content
[{:tag :text,
:attrs
{:kerning "0",
:word-spacing "0",
:letter-spacing "0",
:glyph-orientation-horizontal "0.0",
:font-size "1",
:font-family "'Arial-BoldMT'",
:fill "#000000"},
:content
[{:tag :tspan, :attrs {:y "0", :x "0"}, :content ["N"]}
{:tag :tspan, :attrs {:y "0", :x "0.722"}, :content ["o"]}
{:tag :tspan,
:attrs {:y "0", :x "1.333"},
:content ["t"]}]}]}]}
{:tag :g,
:attrs {:fill "none", :clip-path "url(#clp1)"},
:content
[{:tag :g,
:attrs {:transform "matrix(11 0 0 11 2.1009 10.3821)"},
:content
[{:tag :text,
:attrs
{:kerning "0",
:word-spacing "0",
:letter-spacing "0",
:glyph-orientation-horizontal "0.0",
:font-size "1",
:font-family "'Arial-BoldMT'",
:fill "#000000"},
:content ["Not"]}]}]}]})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment