forked from pool/lua-slaxml
Compare commits
3 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
|
50257d68ae
|
|||
|
1e87334110
|
|||
|
1215409bc6
|
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -21,3 +21,4 @@
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*.changes merge=merge-changes
|
||||
|
||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1 +1,7 @@
|
||||
.osc
|
||||
*.obscpio
|
||||
*.osc
|
||||
_build.*
|
||||
.pbuild
|
||||
SLAXML/
|
||||
lua*-slaxml-*-build/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<multibuild>
|
||||
<package>lua51</package>
|
||||
<package>luajit</package>
|
||||
<package>lua53</package>
|
||||
<package>lua54</package>
|
||||
</multibuild>
|
||||
|
||||
6
_service
6
_service
@@ -1,14 +1,14 @@
|
||||
<services>
|
||||
<service name="tar_scm" mode="disabled">
|
||||
<service name="tar_scm" mode="manual">
|
||||
<param name="url">https://github.com/Phrogz/SLAXML.git</param>
|
||||
<param name="filename">lua-slaxml</param>
|
||||
<param name="versionformat">0.7+git%cd.%h</param>
|
||||
<param name="scm">git</param>
|
||||
<param name="changesgenerate">enable</param>
|
||||
</service>
|
||||
<service name="recompress" mode="disabled">
|
||||
<service name="recompress" mode="manual">
|
||||
<param name="compression">xz</param>
|
||||
<param name="file">*.tar</param>
|
||||
</service>
|
||||
<service name="set_version" mode="disabled" />
|
||||
<service name="set_version" mode="manual" />
|
||||
</services>
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
<param name="url">https://github.com/antlarr/lua-mpris</param>
|
||||
<param name="changesrevision">2b12542d29f8f5f366a1dc047a82ee65bd735b41</param></service><service name="tar_scm">
|
||||
<param name="url">https://github.com/Phrogz/SLAXML.git</param>
|
||||
<param name="changesrevision">938dd5d5b9bb2a45663a5f310ab373c7f4461fbc</param></service></servicedata>
|
||||
<param name="changesrevision">756ffad03d2a06271170a0ba82d6eac02cc2a5ca</param></service></servicedata>
|
||||
75
fix_tests.patch
Normal file
75
fix_tests.patch
Normal file
@@ -0,0 +1,75 @@
|
||||
---
|
||||
slaxml.lua | 13 +++++++++++--
|
||||
test/test.lua | 9 +++++++--
|
||||
2 files changed, 18 insertions(+), 4 deletions(-)
|
||||
|
||||
Index: lua-slaxml-0.7+git20230101.756ffad/slaxml.lua
|
||||
===================================================================
|
||||
--- lua-slaxml-0.7+git20230101.756ffad.orig/slaxml.lua 2025-10-13 12:17:02.427586573 +0200
|
||||
+++ lua-slaxml-0.7+git20230101.756ffad/slaxml.lua 2025-10-13 12:17:19.072469712 +0200
|
||||
@@ -74,7 +74,13 @@
|
||||
end
|
||||
local entityMap = { ["lt"]="<", ["gt"]=">", ["amp"]="&", ["quot"]='"', ["apos"]="'" }
|
||||
local entitySwap = function(orig,n,s) return entityMap[s] or n=="#" and utf8(tonumber('0'..s)) or orig end
|
||||
- local function unescape(str) return gsub( str, '(&(#?)([%d%a]+);)', entitySwap ) end
|
||||
+ local function unescape(str)
|
||||
+ local s = gsub(str, '(&(#?)([%d%a]+);)', "") -- remove all valid entities
|
||||
+ if find(s, '&') then
|
||||
+ error("Invalid ampersand in string: "..str)
|
||||
+ end
|
||||
+ return gsub( str, '(&(#?)([%d%a]+);)', entitySwap )
|
||||
+ end
|
||||
|
||||
local function finishText()
|
||||
if first>textStart and self._call.text then
|
||||
@@ -135,7 +141,7 @@
|
||||
for i=#nsStack,1,-1 do if nsStack[i]['!'] then currentElement[2] = nsStack[i]['!']; break end end
|
||||
end
|
||||
currentAttributeCt = 0
|
||||
- push(nsStack,{})
|
||||
+ push(nsStack,{['__name__']=currentElement[1]})
|
||||
return true
|
||||
end
|
||||
end
|
||||
@@ -153,6 +159,8 @@
|
||||
if first then
|
||||
pos = last+1
|
||||
match2 = unescape(match2)
|
||||
+ else
|
||||
+ error("Attribute value must be quoted for attribute: "..match1)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -225,6 +233,7 @@
|
||||
end
|
||||
if first then
|
||||
finishText()
|
||||
+ if nsStack[#nsStack]['__name__'] ~= match1 then error("Mismatched closing tag: expected "..nsStack[#nsStack]['__name__']..", got "..match1) end
|
||||
if self._call.closeElement then self._call.closeElement(match1,nsURI) end
|
||||
pos = last+1
|
||||
textStart = pos
|
||||
Index: lua-slaxml-0.7+git20230101.756ffad/test/test.lua
|
||||
===================================================================
|
||||
--- lua-slaxml-0.7+git20230101.756ffad.orig/test/test.lua 2025-10-13 12:17:02.428324592 +0200
|
||||
+++ lua-slaxml-0.7+git20230101.756ffad/test/test.lua 2025-10-13 12:17:19.072959653 +0200
|
||||
@@ -1,5 +1,10 @@
|
||||
package.path = '../?.lua;' .. package.path
|
||||
-_ENV = require('lunity')()
|
||||
+local env = require('lunity')()
|
||||
+if _VERSION:find("5.1") then
|
||||
+ setfenv(1, env)
|
||||
+else
|
||||
+ _ENV = env
|
||||
+end
|
||||
|
||||
local SLAXML = require 'slaxdom'
|
||||
|
||||
@@ -218,7 +223,7 @@
|
||||
end
|
||||
|
||||
function test:invalid_documents()
|
||||
- local silentParser = SLAXML:parser{}
|
||||
+ local silentParser = SLAXML:parser{ text = function() end }
|
||||
assertErrors(silentParser.parse, silentParser, XML['invalid_unquoted'] )
|
||||
assertErrors(silentParser.parse, silentParser, XML['invalid_pi_only'] )
|
||||
assertErrors(silentParser.parse, silentParser, XML['invalid_unclosed_tags'] )
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e37c689a77a9ed4ecd565b7d7719c4f39112f0f156cd5779f4f457901460b332
|
||||
size 15528
|
||||
BIN
lua-slaxml-0.7+git20230101.756ffad.tar.xz
LFS
Normal file
BIN
lua-slaxml-0.7+git20230101.756ffad.tar.xz
LFS
Normal file
Binary file not shown.
@@ -1,3 +1,22 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Oct 24 14:51:04 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||
|
||||
- Switch off building lua51 build of the package.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Oct 13 10:02:39 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||
|
||||
- Add fix_tests.patch (gh#Phrogz/SLAXML!22) to improve parser
|
||||
strictness and error handling. Goal was originally to make the
|
||||
test suite to pass even on LuaJIT.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Oct 13 09:33:04 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||
|
||||
- Update to version 0.7+git20230101.756ffad:
|
||||
* Indicate compatibility with 5.1-5.4, inclusive
|
||||
* Update rockspec for v0.8.1
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 25 11:52:07 UTC 2023 - Michal Suchanek <msuchanek@suse.de>
|
||||
|
||||
|
||||
@@ -18,13 +18,16 @@
|
||||
|
||||
%define flavor @BUILD_FLAVOR@
|
||||
%define mod_name slaxml
|
||||
Version: 0.7+git20191225.108970c
|
||||
Version: 0.7+git20230101.756ffad
|
||||
Release: 0
|
||||
Summary: SAX-like streaming XML parser for Lua
|
||||
License: MIT
|
||||
Group: Development/Libraries/Other
|
||||
URL: https://github.com/Phrogz/SLAXML
|
||||
Source: lua-slaxml-%{version}.tar.xz
|
||||
# PATCH-FIX-UPSTREAM fix_tests.patch gh#Phrogz/SLAXML!22 mcepl@suse.com
|
||||
# unescape() function was too lenient
|
||||
Patch0: fix_tests.patch
|
||||
BuildRequires: lua-macros
|
||||
BuildRequires: %{flavor}-devel
|
||||
BuildArch: noarch
|
||||
@@ -49,7 +52,9 @@ it allows certain XML that is syntactically-invalid (not
|
||||
well-formed) to be parsed without reporting an error.
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n lua-slaxml-%{version}
|
||||
%setup -q -n lua-slaxml-%{version}
|
||||
find . -name \*.lua -exec sed -i 's/\r/\n/g; s/\n$//' '{}' +
|
||||
%autopatch -p1
|
||||
|
||||
%build
|
||||
|
||||
@@ -57,13 +62,11 @@ well-formed) to be parsed without reporting an error.
|
||||
install -D -m 0644 -t %{buildroot}%{lua_noarchdir} slaxml.lua slaxdom.lua
|
||||
|
||||
%check
|
||||
%if "%{flavor}" != "lua51"
|
||||
cd test
|
||||
lua test.lua
|
||||
%endif
|
||||
|
||||
%files
|
||||
%license LICENSE.txt
|
||||
%{lua_noarchdir}/*
|
||||
%{lua_noarchdir}/slax*.lua
|
||||
|
||||
%changelog
|
||||
|
||||
Reference in New Issue
Block a user