diff --git a/Makefile b/Makefile index ffe0b43..0c6d382 100644 --- a/Makefile +++ b/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 diff --git a/xquery/validator.xqy b/xquery/validator.xqy new file mode 100644 index 0000000..f0099eb --- /dev/null +++ b/xquery/validator.xqy @@ -0,0 +1,45 @@ +declare namespace m = "http://www.w3.org/2005/10/feed-validator"; + +parse-xml(x:request(x: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" + ), " ") +)