1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-22 12:10:11 +01:00

[WIP] <type> element isn't a part of the RSS 2.0 spec [1]

[1] https://cyber.harvard.edu/rss/rss.html

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2024-10-29 15:09:40 +01:00
parent 6303c56c55
commit 9e7823df67
3 changed files with 34 additions and 80 deletions

View File

@ -1,30 +1,13 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <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:output method="html" version="5" encoding="UTF-8" indent="yes" />
<xsl:template match="rss"> <xsl:template match="rss">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title><xsl:value-of select="channel/title" /> RSS Feed</title> <title><xsl:value-of select="channel/title" />RSS Feed</title>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta http-equiv="x-ua-compatible" content="IE=edge,chrome=1" /> <meta http-equiv="x-ua-compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,initial-scale=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> </head>
<body> <body>
<header> <header>
@ -44,9 +27,7 @@
<xsl:value-of select="title" /> <xsl:value-of select="title" />
</a> </a>
</h3> </h3>
<time> <time><xsl:value-of select="pubDate" /></time>
<xsl:value-of select="pubDate" />
</time>
<p><xsl:value-of select="description" /></p> <p><xsl:value-of select="description" /></p>
<hr /> <hr />
</article> </article>
@ -55,5 +36,4 @@
</body> </body>
</html> </html>
</xsl:template> </xsl:template>
</xsl:stylesheet> </xsl:stylesheet>

View File

@ -21,34 +21,11 @@
{% for r in results %} {% for r in results %}
<item> <item>
<title>{{ r.title }}</title> <title>{{ r.title }}</title>
<type>result</type>
<link>{{ r.url }}</link> <link>{{ r.url }}</link>
<description>{{ r.content }}</description> <description>{{ r.content }}</description>
{% if r.pubdate %}<pubDate>{{ r.pubdate }}</pubDate>{% endif %} {% if r.pubdate %}<pubDate>{{ r.pubdate }}</pubDate>{% endif %}
</item> </item>
{% endfor %} {% endfor %}
{% if answers %}
{% for a in answers %}
<item>
<title>{{ a }}</title>
<type>answer</type>
</item>
{% endfor %}
{% endif %}
{% if corrections %}
{% for a in corrections %}
<item>
<title>{{ a }}</title>
<type>correction</type>
</item>
{% endfor %}
{% endif %}
{% if suggestions %}
{% for a in suggestions %}
<item>
<title>{{ a }}</title>
<type>suggestion</type>
</item>
{% endfor %}
{% endif %}
</channel> </channel>
</rss> </rss>

View File

@ -740,9 +740,6 @@ def search():
response_rss = render( response_rss = render(
'opensearch_response_rss.xml', 'opensearch_response_rss.xml',
results=results, results=results,
answers=result_container.answers,
corrections=result_container.corrections,
suggestions=result_container.suggestions,
q=request.form['q'], q=request.form['q'],
number_of_results=result_container.number_of_results, number_of_results=result_container.number_of_results,
) )