Ignore non-standard languages in Wikimedia OPML generator
This commit is contained in:
parent
89e1f93edf
commit
e8c1b81751
|
@ -1,13 +1,16 @@
|
||||||
declare function local:get-feeds($url as xs:anyURI, $language as xs:string) as node()* {
|
declare function local:get-feeds($url as xs:anyURI, $language as xs:string) as node()* {
|
||||||
doc(resolve-uri('./w/index.php?title=Special:SiteMatrix', $url))//link[@rel = 'alternate'][@type = 'application/rss+xml' or @type = 'application/atom+xml']
|
doc(resolve-uri('./w/index.php?title=Special:SiteMatrix', $url))//link[@rel = 'alternate'][@type = 'application/rss+xml' or @type = 'application/atom+xml']
|
||||||
! <outline
|
! element outline {
|
||||||
type="rss"
|
attribute type { "rss" },
|
||||||
text="{@title}"
|
attribute text { @title },
|
||||||
version="{if (@type = 'application/atom+xml') then 'ATOM' else 'RSS'}"
|
attribute version { if (@type = 'application/atom+xml') then 'ATOM' else 'RSS' },
|
||||||
xmlUrl="{resolve-uri(@href, $url)}"
|
attribute xmlUrl { resolve-uri(@href, $url) },
|
||||||
htmlUrl="{$url}"
|
attribute htmlUrl { $url },
|
||||||
language="{$language}"
|
(: Some languages are not actual language codes, like `wikidata` or `labs` or `wikimania2008`, so we do not include them :)
|
||||||
/>
|
if (fn:matches($language, "\d|^\w{4,}"))
|
||||||
|
then ()
|
||||||
|
else attribute { "language" } { $language }
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
doc('https://commons.wikimedia.org/w/api.php?action=sitematrix&format=xml')//sitematrix
|
doc('https://commons.wikimedia.org/w/api.php?action=sitematrix&format=xml')//sitematrix
|
||||||
|
|
Loading…
Reference in New Issue