From 343097990be105e56c3ac76be2de1d88608992fe Mon Sep 17 00:00:00 2001 From: "Clark C. Evans" Date: Sat, 23 Oct 2021 11:00:39 -0500 Subject: [PATCH] fix #17: attribute interpolation bug --- NEWS.md | 4 ++++ Project.toml | 2 +- docs/src/attribute.md | 6 ++++++ src/lexer.jl | 2 -- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index 6916ee6..6986c0b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # Release Notes +## v0.9.2 + +- Fix #17: Attribute interpolation bug + ## v0.9.1 - Fix #16: Error interpolating unicode into JS diff --git a/Project.toml b/Project.toml index 9bc4333..f3eab61 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "HypertextLiteral" uuid = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2" authors = ["Clark C. Evans "] -version = "0.9.1" +version = "0.9.2" [compat] julia = "1" diff --git a/docs/src/attribute.md b/docs/src/attribute.md index dadf7ea..ababad3 100644 --- a/docs/src/attribute.md +++ b/docs/src/attribute.md @@ -355,3 +355,9 @@ exclude it to guard it against accidently forgetting a comma. ERROR: LoadError: DomainError with data_value = 42: assignments are not permitted in an interpolationâ‹® =# + +Interpolation of adjacent values should work. + + x = 'X'; y = 'Y'; + @htl("") + #-> diff --git a/src/lexer.jl b/src/lexer.jl index 3916840..23fe1d1 100644 --- a/src/lexer.jl +++ b/src/lexer.jl @@ -82,8 +82,6 @@ function interpolate(args) "interpolation is limited to a single component")) elseif state == STATE_ATTRIBUTE_VALUE_SINGLE_QUOTED || state == STATE_ATTRIBUTE_VALUE_DOUBLE_QUOTED - @assert parts[end] isa String - name = parts[end][attribute_start:attribute_end] push!(parts, :(attribute_value($(esc(input))))) elseif state == STATE_BEFORE_ATTRIBUTE_NAME || state == STATE_AFTER_ATTRIBUTE_NAME