From f01e8f82c5e0ae4ad9b22c25e174b55c99078388 Mon Sep 17 00:00:00 2001 From: Jed Clinger Date: Fri, 22 Nov 2024 08:31:41 -0800 Subject: [PATCH] Set indent-with-indicator before indicator-indent in dumper options (#142) --- src/clojure/clj_yaml/core.clj | 4 ++-- test/clj_yaml/core_test.clj | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/clojure/clj_yaml/core.clj b/src/clojure/clj_yaml/core.clj index 508a633..a5c37c3 100644 --- a/src/clojure/clj_yaml/core.clj +++ b/src/clojure/clj_yaml/core.clj @@ -72,10 +72,10 @@ (.setDefaultFlowStyle dumper (flow-styles flow-style))) (when indent (.setIndent dumper indent)) - (when indicator-indent - (.setIndicatorIndent dumper indicator-indent)) (when indent-with-indicator (.setIndentWithIndicator dumper indent-with-indicator)) + (when indicator-indent + (.setIndicatorIndent dumper indicator-indent)) dumper)) (defn default-loader-options diff --git a/test/clj_yaml/core_test.clj b/test/clj_yaml/core_test.clj index 0ad4a65..bbdfde7 100644 --- a/test/clj_yaml/core_test.clj +++ b/test/clj_yaml/core_test.clj @@ -411,7 +411,20 @@ lol: yolo") :dumper-options {:indent 5 :indicator-indent 2 :indent-with-indicator true - :flow-style :block}))))) + :flow-style :block}))) + (is (= (str "todo:\n" + ;12 + " issues:\n" + ;; 12 + " - name: Fix all the things\n" + " responsible:\n" + ;; 12 + " name: Rita\n") + (generate-string (parse-string indent-yaml) + :dumper-options {:indent 2 + :indicator-indent 2 + :indent-with-indicator true + :flow-style :block}))))) (def yaml-with-unknown-tags "--- scalar: !CustomScalar some-scalar