Skip to content

Commit

Permalink
fix #17: attribute interpolation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkevans committed Oct 23, 2021
1 parent 067eb48 commit 3430979
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## v0.9.2

- Fix #17: Attribute interpolation bug

## v0.9.1

- Fix #16: Error interpolating unicode into JS
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "HypertextLiteral"
uuid = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2"
authors = ["Clark C. Evans <[email protected]>"]
version = "0.9.1"
version = "0.9.2"

[compat]
julia = "1"
Expand Down
6 changes: 6 additions & 0 deletions docs/src/attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -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("<span att='$x$y'/>")
#-> <span att='XY'/>
2 changes: 0 additions & 2 deletions src/lexer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

2 comments on commit 3430979

@clarkevans
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/47380

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.9.2 -m "<description of version>" 343097990be105e56c3ac76be2de1d88608992fe
git push origin v0.9.2

Please sign in to comment.