Skip to content

Commit a1e739b

Browse files
authored
Merge pull request #16 from IHPSystems/feature/julia_1.6
Add support for Julia 1.6
2 parents 143c2b2 + de00f35 commit a1e739b

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed

.github/workflows/CI.yml

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
version:
15+
- '1.6'
1516
- '1' # automatically expands to the latest stable 1.x release of Julia
1617
- 'nightly'
1718
os:

Project.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name = "XML"
22
uuid = "72c71f33-b9b6-44de-8c94-c961784809e2"
33
authors = ["Josh Day <[email protected]> and contributors"]
4-
version = "0.3.0"
4+
version = "0.3.1"
55

66
[deps]
77
Mmap = "a63ad114-7e13-5084-954f-fe012c677804"
88
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
99

1010
[compat]
11-
julia = "1.7"
1211
OrderedCollections = "1.4, 1.5"
12+
julia = "1.6"

src/XML.jl

+18-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,20 @@ export
1313

1414
#-----------------------------------------------------------------------------# escape/unescape
1515
const escape_chars = ('&' => "&amp;", '<' => "&lt;", '>' => "&gt;", "'" => "&apos;", '"' => "&quot;")
16-
unescape(x::AbstractString) = replace(x, reverse.(escape_chars)...)
17-
escape(x::String) = replace(x, r"&(?=\s)" => "&amp;", escape_chars[2:end]...)
16+
function unescape(x::AbstractString)
17+
result = x
18+
for (pat, r) in reverse.(escape_chars)
19+
result = replace(result, pat => r)
20+
end
21+
return result
22+
end
23+
function escape(x::String)
24+
result = replace(x, r"&(?=\s)" => "&amp;")
25+
for (pat, r) in escape_chars[2:end]
26+
result = replace(result, pat => r)
27+
end
28+
return result
29+
end
1830

1931
#-----------------------------------------------------------------------------# NodeType
2032
"""
@@ -137,7 +149,10 @@ end
137149
Node(o::Node; kw...) = isempty(kw) ? o : Node((get(kw, x, getfield(o, x)) for x in fieldnames(Node))...)
138150

139151
function Node(node::LazyNode)
140-
(;nodetype, tag, attributes, value) = node
152+
nodetype = node.nodetype
153+
tag = node.tag
154+
attributes = node.attributes
155+
value = node.value
141156
c = XML.children(node)
142157
Node(nodetype, tag, attributes, value, isempty(c) ? nothing : map(Node, c))
143158
end

src/raw.jl

+6-2
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,9 @@ would visit nodes by reading top-down through an XML file. Not defined for `XML
235235
"""
236236
function next(o::Raw)
237237
i = o.pos + o.len + 1
238-
(; depth, data, type) = o
238+
depth = o.depth
239+
data = o.data
240+
type = o.type
239241
i = findnext(!isspace, data, i) # skip insignificant whitespace
240242
isnothing(i) && return nothing
241243
if type === RawElementOpen || type === RawDocument
@@ -294,7 +296,9 @@ end
294296
Return the previous node in the document during depth-first traversal. Not defined for `XML.Node`.
295297
"""
296298
function prev(o::Raw)
297-
(; depth, data, type) = o
299+
depth = o.depth
300+
data = o.data
301+
type = o.type
298302
type === RawDocument && return nothing
299303
j = o.pos - 1
300304
j = findprev(!isspace, data, j) # skip insignificant whitespace

0 commit comments

Comments
 (0)