diff src/nabble/view/naml/feeds.naml @ 0:7ecd1a4ef557

add content
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 21 Mar 2019 19:15:52 -0600
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/nabble/view/naml/feeds.naml	Thu Mar 21 19:15:52 2019 -0600
@@ -0,0 +1,139 @@
+<macro name="feeds" requires="servlet">
+	<n.node_page.>
+		<n.html>
+			<head>
+				<n.title.><t>Atom feeds for <t.location.page_node.subject/></t></n.title.>
+			</head>
+			<body>
+				<h1><t>Atom feeds for <t.location.page_node.subject/></t></h1>
+				<div style="margin-top:1.5em">
+					<div class="big-title second-font">
+						<img src="/images/feeds.png" width="16" height="16" align="absmiddle" alt="feeds"/>
+						<t>Topics only</t>
+					</div>
+					<a href="[n.page_node.feeds_topics_path/]"><n.request_base_url/><n.page_node.feeds_topics_path/></a>
+				</div>
+				<div style="margin-top:1.5em">
+					<div class="big-title second-font">
+						<img src="/images/feeds.png" width="16" height="16" align="absmiddle" alt="feeds"/>
+						<t>Topics and replies</t>
+					</div>
+					<a href="[n.page_node.feeds_posts_path/]"><n.request_base_url/><n.page_node.feeds_posts_path/></a>
+				</div>
+			</body>
+		</n.html>
+	</n.node_page.>
+</macro>
+
+<macro name="feeds_topics_path" requires="node">
+	<n.encode_url.>
+		/<n.url_encoded_subject/>-ft<n.id/>.xml
+	</n.encode_url.>
+</macro>
+
+<macro name="feeds_posts_path" requires="node">
+	<n.encode_url.>
+		/<n.url_encoded_subject/>-f<n.id/>.xml
+	</n.encode_url.>
+</macro>
+
+<static>
+	feed
+	id
+	subtitle
+	entry
+	published
+	updated
+	author
+	name
+	content
+	thr:in-reply-to
+</static>
+
+<macro name="as_atom_feeds" dot_parameter="do" requires="node">
+<n.use_html_encoder.>
+<![CDATA[<?xml version="1.0" encoding="utf-8"?>]]>
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0">
+	<n.xml_response/>
+	<id>tag:<n.server_name/>,2006:forum-<n.id/></id>
+	<title>Nabble - <n.subject/></title>
+	<updated><n.now.as_atom_date_format/></updated>
+	<link rel="self" type="application/atom+xml" href="[n.current_url/]" />
+	<link rel="alternate" type="text/html" href="[n.url/]" />
+	<subtitle type="html"><n.encode.message.message_as_html/></subtitle>
+	<n.do/>
+</feed>
+</n.use_html_encoder.>
+</macro>
+
+<macro name="as_atom_entry" requires="node, node_page">
+	<n.nop/>
+	<entry>
+		<id>tag:<n.server_name/>,2006:post-<n.id/></id>
+		<title><n.subject/></title>
+		<published><n.when_created.as_atom_date_format/></published>
+		<updated><n.atom_entry_updated_value/></updated>
+		<author>
+			<name><n.owner.name/></name>
+		</author>
+		<content type="html">
+			<n.encode.message_with_signature/>
+			<n.if.not.this_node.get_app_node.equals.page_node>
+				<then.encode.>
+					<p>Posted in <n.get_app_node.node_link/></p>
+				</then.encode.>
+			</n.if.not.this_node.get_app_node.equals.page_node>
+		</content>
+		<link rel="alternate" type="text/html" href="[n.url/]" />
+		<n.if.parent_node.is_post>
+			<then><thr:in-reply-to ref="tag:[n.server_name/],2006:post-[n.parent_node.id/]"/></then>
+		</n.if.parent_node.is_post>
+	</entry>
+</macro>
+
+<macro name="atom_entry_updated_value" requires="node">
+	<n.if.was_updated>
+		<then.when_updated.as_atom_date_format/>
+		<else.when_created.as_atom_date_format/>
+	</n.if.was_updated>
+</macro>
+
+<macro name="as_atom_date_format" requires="date">
+	<n.custom_format format="yyyy-MM-dd'T'HH:mm:ss'Z'"/>
+</macro>
+
+<macro name="atom_topics_by_date" requires="servlet" unindent="true">
+	<n.node_page.>
+		<n.app_caching/>
+		<n.page_node.as_atom_feeds.>
+			<n.page_node.topics_list.
+				start="0"
+				length="[n.atom_length/]"
+				sort="last-node-date"
+			>
+				<n.loop.current_node.as_atom_entry/>
+			</n.page_node.topics_list.>
+		</n.page_node.as_atom_feeds.>
+	</n.node_page.>
+</macro>
+
+<macro name="atom_posts_by_date" requires="servlet" unindent="true">
+	<n.node_page.>
+		<n.app_caching/>
+		<n.page_node.as_atom_feeds.>
+			<n.page_node.post_list.
+				start="0"
+				length="[n.atom_length/]"
+				sort="date-descending"
+			>
+				<n.loop.current_node.as_atom_entry/>
+			</n.page_node.post_list.>
+		</n.page_node.as_atom_feeds.>
+	</n.node_page.>
+</macro>
+
+<macro name="atom_length">
+	<n.default. to="35">
+		<n.get_parameter name="length"/>
+	</n.default.>
+</macro>
\ No newline at end of file