Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Structurizr scripts
#!/usr/bin/env python3
import fileinput
def cleanup(line: str) -> str:
return line.replace(" ", " ").replace('xml:space="preserve"', "")
def __main__():
# inplace=True causes standard output to be directed to the input file
for line in fileinput.input(inplace=True, backup=".bak"):
# since the line already ends with a newline char, we use end to avoid adding another
print(cleanup(line), end="")
if __name__ == "__main__":
__main__()
#!/usr/bin/env bb
(require '[clojure.data.xml :as xml]
'[clojure.java.io :as io])
(defn main [file-paths]
(doseq [fp file-paths]
(->> (io/reader fp)
(xml/parse)
(xml/indent-str)
(spit fp))))
(when (= *file* (System/getProperty "babashka.file"))
(main *command-line-args*))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment