Skip to content

Commit

Permalink
Fix #16: Error interpolating unicode into JS
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkevans committed Oct 6, 2021
1 parent 8e0709b commit 067eb48
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 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.1

- Fix #16: Error interpolating unicode into JS

## v0.9.0

- Removing Javscript treatment from `on` attributes
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.0"
version = "0.9.1"

[compat]
julia = "1"
Expand Down
7 changes: 7 additions & 0 deletions docs/src/script.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,10 @@ strictly unnecessary escaping.

@htl "<script>var x = $v</script>"
#-> <script>var x = "<\!-- <\Script> <\! 3<4 <\/ <\s !>"</script>

It's important to handle unicode content properly.

s = "α\n"

@htl("<script>alert($(s))</script>")
#-> <script>alert("α\n")</script>
2 changes: 1 addition & 1 deletion src/script.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function print_script(io::IO, value::AbstractString)
final = lastindex(value)
i = last = 1
function emit(s::String)
print(io, SubString(value, last, i - 1))
print(io, SubString(value, last, prevind(value, i)))
last = nextind(value, i)
print(io, s)
end
Expand Down

2 comments on commit 067eb48

@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/46209

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.1 -m "<description of version>" 067eb489b6ccf5616aebead0bb44b262c912f70e
git push origin v0.9.1

Please sign in to comment.