Skip to content

Commit

Permalink
correctly handle JSONText in join_js() and other cases
Browse files Browse the repository at this point in the history
  • Loading branch information
hhaensel committed Oct 31, 2024
1 parent 50c7ca6 commit b73f46b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/stipple/rendering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ julia> join_js([1, f, "2 "], " - ", pre = strip)
"1 - hi - 2"
```
"""
function join_js(xx, delim = ""; skip_empty = true, pre::Function = identity, strip_delimiter = true, pre_delim::Union{Function,Nothing} = nothing)
function join_js(xx::Union{Tuple, AbstractArray}, delim = ""; skip_empty = true, pre::Function = identity, strip_delimiter = true, pre_delim::Union{Function,Nothing} = nothing)
io = IOBuffer()
firstrun = true
s_delim = pre_delim === nothing ? pre(delim) : pre_delim(delim)
Expand Down Expand Up @@ -67,9 +67,9 @@ function join_js(xx, delim = ""; skip_empty = true, pre::Function = identity, st
String(take!(io))
end

join_js(s::AbstractString, delim = ""; kwargs...) = join_js([s], delim; kwargs...)
join_js(p::Pair, delim = ""; kwargs...) = join_js([p], delim; kwargs...)
join_js(f::Base.Callable, delim = ""; kwargs...) = join_js([f], delim; kwargs...)
function join_js(x, delim = ""; skip_empty = true, pre::Function = identity, strip_delimiter = true, pre_delim::Union{Function,Nothing} = nothing)
join_js([x], delim; skip_empty, pre, strip_delimiter, pre_delim)
end

const RENDERING_MAPPINGS = Dict{String,String}()
mapping_keys() = collect(keys(RENDERING_MAPPINGS))
Expand Down

0 comments on commit b73f46b

Please sign in to comment.