diff --git a/NEWS.md b/NEWS.md index 43a10ba..6916ee6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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 diff --git a/Project.toml b/Project.toml index 603f59b..9bc4333 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.0" +version = "0.9.1" [compat] julia = "1" diff --git a/docs/src/script.md b/docs/src/script.md index bd6321c..7415c28 100644 --- a/docs/src/script.md +++ b/docs/src/script.md @@ -160,3 +160,10 @@ strictly unnecessary escaping. @htl "" #-> + +It's important to handle unicode content properly. + + s = "α\n" + + @htl("") + #-> diff --git a/src/script.jl b/src/script.jl index e800b13..3ac1889 100644 --- a/src/script.jl +++ b/src/script.jl @@ -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