Add W3C validator script
This commit is contained in:
parent
34990d6157
commit
0f0ed2084b
3
Makefile
3
Makefile
|
@ -27,3 +27,6 @@ img/sprites.png: $(sprites)
|
|||
css/sprites.css: img/sprites.png xquery/build_sprites_css.xqy
|
||||
xidel --extract-kind=xquery3 --extract-file=xquery/build_sprites_css.xqy > $@
|
||||
chmod a+r $@
|
||||
|
||||
validate: feed.xml
|
||||
xidel --extract-kind=xquery3 --extract-file=xquery/validator.xqy
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
declare namespace m = "http://www.w3.org/2005/10/feed-validator";
|
||||
|
||||
parse-xml(x:request(x:form(
|
||||
<form action="https://validator.w3.org/feed/check.cgi">
|
||||
<input name="output" value="soap12" />
|
||||
<input name="url" value="https://envs.net/~lucidiot/rsrsss/feed.xml" />
|
||||
</form>
|
||||
))/raw)//m:feedvalidationresponse ! concat(
|
||||
"W3C feed validation results for ",
|
||||
m:uri,
|
||||
" on ",
|
||||
m:date,
|
||||
": ",
|
||||
switch (m:validity)
|
||||
case "true" return "VALID"
|
||||
case "false" return "INVALID"
|
||||
default return concat("UNKNOWN (", ., ")"),
|
||||
" ",
|
||||
m:errors/m:errorcount,
|
||||
" errors, ",
|
||||
m:warnings/m:warningcount,
|
||||
" warnings, ",
|
||||
m:informations/m:infocount,
|
||||
" informations ",
|
||||
string-join((
|
||||
m:errors/m:errorlist/error,
|
||||
m:warnings/m:warninglist/warning,
|
||||
m:informations/m:infolist/info
|
||||
) ! concat(
|
||||
" ",
|
||||
upper-case(name()),
|
||||
" at line ",
|
||||
if (backupline ne line) then backupline else line,
|
||||
", column ",
|
||||
if (backupcolumn ne column) then backupcolumn else column,
|
||||
": ",
|
||||
text,
|
||||
if (number(msgcount) gt 1) then concat(" Repeated ", msgcount, "times") else "",
|
||||
" Documentation: https://validator.w3.org/feed/docs/",
|
||||
lower-case(name()),
|
||||
"/",
|
||||
type,
|
||||
".html"
|
||||
), " ")
|
||||
)
|
Loading…
Reference in New Issue