diff --git a/CHANGELOG.md b/CHANGELOG.md index 14619ec..1630e2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,17 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +## 0.17.1 - 2024-06-27 + +### Fixed + +- Using attributes enclosed in quotes, but not jsons. Extra scenario handled (#176) + +### Changed + +- Dependency updates + - asciidoctor-diagram to 2.3.1 + ## 0.17.0 - 2024-06-24 ### Added diff --git a/convert/src/main/kotlin/com/github/zeldigas/text2confl/convert/PageAttributes.kt b/convert/src/main/kotlin/com/github/zeldigas/text2confl/convert/PageAttributes.kt index ca2ba87..ebab2cc 100644 --- a/convert/src/main/kotlin/com/github/zeldigas/text2confl/convert/PageAttributes.kt +++ b/convert/src/main/kotlin/com/github/zeldigas/text2confl/convert/PageAttributes.kt @@ -1,6 +1,6 @@ package com.github.zeldigas.text2confl.convert -import com.fasterxml.jackson.core.JsonParseException +import com.fasterxml.jackson.core.JacksonException import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.module.kotlin.readValue import io.github.oshai.kotlinlogging.KotlinLogging @@ -18,7 +18,7 @@ fun parseAttribute(value: Any): Any { } else { value } - } catch (e: JsonParseException) { + } catch (e: JacksonException) { logger.debug(e) { "Failed to parse value $value, looks like not a valid json" } value } diff --git a/convert/src/test/kotlin/com/github/zeldigas/text2confl/convert/asciidoc/AsciidocFileConverterTest.kt b/convert/src/test/kotlin/com/github/zeldigas/text2confl/convert/asciidoc/AsciidocFileConverterTest.kt index ec8fb91..c983075 100644 --- a/convert/src/test/kotlin/com/github/zeldigas/text2confl/convert/asciidoc/AsciidocFileConverterTest.kt +++ b/convert/src/test/kotlin/com/github/zeldigas/text2confl/convert/asciidoc/AsciidocFileConverterTest.kt @@ -48,6 +48,10 @@ class AsciidocFileConverterTest { """ :title: Custom title :labels: a,b,c + :with_braces: {hello} + :with_brackets: [a, b, c] + :json_with_braces: { "hello": "world" } + :json_with_brackets: ["hello", "world"] = Doc title @@ -59,7 +63,13 @@ class AsciidocFileConverterTest { assertThat(result).all { prop(PageHeader::title).isEqualTo("Prefixed: Custom title") - prop(PageHeader::attributes).contains("labels", "a,b,c") + prop(PageHeader::attributes).all { + contains("labels", "a,b,c") + contains("with_braces", "{hello}") + contains("with_brackets", "[a, b, c]") + contains("json_with_braces", mapOf("hello" to "world")) + contains("json_with_brackets", listOf("hello", "world")) + } } }