mirror of https://github.com/searxng/searxng.git
Merge 6303c56c55
into b176323e89
This commit is contained in:
commit
c02a700504
|
@ -0,0 +1,59 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||||
|
|
||||||
|
<xsl:output method="html" version="5" encoding="UTF-8" indent="yes" />
|
||||||
|
|
||||||
|
<xsl:template match="rss">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<title><xsl:value-of select="channel/title" /> RSS Feed</title>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="x-ua-compatible" content="IE=edge,chrome=1" />
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||||
|
<style type="text/css">
|
||||||
|
html {
|
||||||
|
background: #fff;
|
||||||
|
color: #444;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #334999;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<h2>
|
||||||
|
<xsl:value-of select="channel/description" />
|
||||||
|
</h2>
|
||||||
|
</header>
|
||||||
|
<hr />
|
||||||
|
<main>
|
||||||
|
<xsl:for-each select="channel/item">
|
||||||
|
<article>
|
||||||
|
<h3>
|
||||||
|
<a hreflang="en" target="_blank">
|
||||||
|
<xsl:attribute name="href">
|
||||||
|
<xsl:value-of select="link" />
|
||||||
|
</xsl:attribute>
|
||||||
|
<xsl:value-of select="title" />
|
||||||
|
</a>
|
||||||
|
</h3>
|
||||||
|
<time>
|
||||||
|
<xsl:value-of select="pubDate" />
|
||||||
|
</time>
|
||||||
|
<p><xsl:value-of select="description" /></p>
|
||||||
|
<hr />
|
||||||
|
</article>
|
||||||
|
</xsl:for-each>
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
|
@ -1,11 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<?xml-stylesheet href="{{ url_for('static', filename='xsl/rss.xsl') }}" type="text/xsl"?>
|
||||||
<rss version="2.0"
|
<rss version="2.0"
|
||||||
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
|
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
|
||||||
xmlns:atom="http://www.w3.org/2005/Atom">
|
xmlns:atom="http://www.w3.org/2005/Atom">
|
||||||
<channel>
|
<channel>
|
||||||
<title>Searx search: {{ q|e }}</title>
|
<title>SearXNG search: {{ q|e }}</title>
|
||||||
<link>{{ url_for('search', _external=True) }}?q={{ q|e }}</link>
|
<link>{{ url_for('search', _external=True) }}?q={{ q|e }}</link>
|
||||||
<description>Search results for "{{ q|e }}" - searx</description>
|
<description>Search results for "{{ q|e }}" - SearXNG</description>
|
||||||
<opensearch:totalResults>{{ number_of_results }}</opensearch:totalResults>
|
<opensearch:totalResults>{{ number_of_results }}</opensearch:totalResults>
|
||||||
<opensearch:startIndex>1</opensearch:startIndex>
|
<opensearch:startIndex>1</opensearch:startIndex>
|
||||||
<opensearch:itemsPerPage>{{ number_of_results }}</opensearch:itemsPerPage>
|
<opensearch:itemsPerPage>{{ number_of_results }}</opensearch:itemsPerPage>
|
||||||
|
|
|
@ -180,7 +180,7 @@ class ViewsTestCase(SearxTestCase): # pylint: disable=missing-class-docstring,
|
||||||
def test_search_rss(self):
|
def test_search_rss(self):
|
||||||
result = self.app.post('/search', data={'q': 'test', 'format': 'rss'})
|
result = self.app.post('/search', data={'q': 'test', 'format': 'rss'})
|
||||||
|
|
||||||
self.assertIn(b'<description>Search results for "test" - searx</description>', result.data)
|
self.assertIn(b'<description>Search results for "test" - SearXNG</description>', result.data)
|
||||||
|
|
||||||
self.assertIn(b'<opensearch:totalResults>3</opensearch:totalResults>', result.data)
|
self.assertIn(b'<opensearch:totalResults>3</opensearch:totalResults>', result.data)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue