Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Hyperscript

##Changes

Besides fixing the camelcase algorithm for initial caps, which i PR'd, I have removed all escapes everywhere for everything. Remember to add them back one at a time if problems show up.








Hyperscript is a package for working with HTML, SVG, and CSS in Julia.

When using this library you automatically get:
Expand Down
14 changes: 9 additions & 5 deletions src/Hyperscript.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ printescaped(io::IO, x::AbstractChar, escapes) = printescaped(io, string(x), esc
printescaped(io::IO, x, escapes) = printescaped(io, sprint(print, x), escapes)

# pass numbers (and 1-character attributes) through untrammelled
kebab(camel::String) = length(camel) > 1 ? join(islowercase(c) || isnumeric(c) || c == '-' ? c : '-' * lowercase(c) for c in camel) : camel
kebab(camel::String) = camel[1] * join(islowercase(c) || isnumeric(c) || c == '-' ? c : '-' * lowercase(c) for c in camel[2:end])


## HTMLSVG
Expand Down Expand Up @@ -311,14 +311,18 @@ end
# Creates an HTML or SVG escaping dictionary
chardict(chars) = Dict(c => "&#$(Int(c));" for c in chars)

# Used for CSS nodes, as well as children of tag nodes defined with @tags_noescape
const NO_ESCAPES = Dict{Char, String}()

# See: https://stackoverflow.com/questions/7753448/how-do-i-escape-quotes-in-html-attribute-values
const ATTR_VALUE_ESCAPES = chardict("&<>\"\n\r\t")
const ATTR_VALUE_ESCAPES = NO_ESCAPES
#chardict("&<>\"\n\r\t")

# See: https://stackoverflow.com/a/9189067/1175713
const HTML_ESCAPES = chardict("&<>\"'`!@\$%()=+{}[]")
const HTML_ESCAPES = NO_ESCAPES
# chardict("&<>\"'`!@\$%()=+{}[]")


# Used for CSS nodes, as well as children of tag nodes defined with @tags_noescape
const NO_ESCAPES = Dict{Char, String}()

escapetag(ctx::HTMLSVG) = HTML_ESCAPES
escapeattrname(ctx::HTMLSVG) = HTML_ESCAPES
Expand Down