Skip to content

Instantly share code, notes, and snippets.

@aviflax
Created December 9, 2021 15:25
Show Gist options
  • Save aviflax/ce3042a693b5e5c32c8ca8dd4878a978 to your computer and use it in GitHub Desktop.
Save aviflax/ce3042a693b5e5c32c8ca8dd4878a978 to your computer and use it in GitHub Desktop.
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