posts.xsl 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. _ _ ____ _
  4. _| || |_/ ___| ___ _ __ _ __ ___ | |
  5. |_ .. _\___ \ / _ \ '_ \| '_ \ / _ \| |
  6. |_ _|___) | __/ |_) | |_) | (_) |_|
  7. |_||_| |____/ \___| .__/| .__/ \___/(_)
  8. |_| |_|
  9. Personal Social Web.
  10. Copyright (C) The #Seppo contributors. All rights reserved.
  11. This program is free software: you can redistribute it and/or modify
  12. it under the terms of the GNU General Public License as published by
  13. the Free Software Foundation, either version 3 of the License, or
  14. (at your option) any later version.
  15. This program is distributed in the hope that it will be useful,
  16. but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. GNU General Public License for more details.
  19. You should have received a copy of the GNU General Public License
  20. along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. https://w3.org/TR/xslt-10
  22. https://w3.org/TR/xpath-10
  23. -->
  24. <xsl:stylesheet
  25. xmlns="http://www.w3.org/1999/xhtml"
  26. xmlns:a="http://www.w3.org/2005/Atom"
  27. xmlns:as="https://www.w3.org/ns/activitystreams#"
  28. xmlns:georss="http://www.georss.org/georss"
  29. xmlns:ldp="http://www.w3.org/ns/ldp#"
  30. xmlns:media="http://search.yahoo.com/mrss/"
  31. xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
  32. xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  33. xmlns:schema="http://schema.org#"
  34. xmlns:se="http://seppo.social/"
  35. xmlns:seppo="http://seppo.social/2023/ns#"
  36. xmlns:toot="http://joinmastodon.org/ns#"
  37. xmlns:wf="urn:ietf:rfc:7033"
  38. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  39. exclude-result-prefixes="a as opensearch ldp media georss rdf se"
  40. xmlns:math="http://exslt.org/math"
  41. extension-element-prefixes="math"
  42. version="1.0">
  43. <!-- maybe mitigate the white flash via https://www.w3.org/Style/styling-XML.en.html -->
  44. <!-- xsl:variable name="redirector">https://anonym.to/?</xsl:variable --> <!-- mask the HTTP_REFERER -->
  45. <xsl:variable name="redirector"></xsl:variable>
  46. <xsl:variable name="archive">https://web.archive.org/web/</xsl:variable>
  47. <xsl:include href="util.xsl"/>
  48. <xsl:output
  49. method="html"
  50. doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
  51. doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/>
  52. <!-- http://stackoverflow.com/a/16328207 -->
  53. <xsl:key name="CategorY" match="a:entry/a:category" use="@term" />
  54. <xsl:variable name="self" select="/*/a:link[@rel = 'self']/@href"/>
  55. <xsl:variable name="xml_base_absolute" select="/*/@xml:base"/>
  56. <xsl:variable name="xml_base" select="normalize-space($xml_base_absolute)"/>
  57. <xsl:variable name="xml_base_pub" select="concat($xml_base,'o')"/>
  58. <xsl:variable name="skin_base" select="concat($xml_base,'themes/current')"/>
  59. <xsl:variable name="cgi_url" select="concat($xml_base,'seppo.cgi')"/>
  60. <!-- a bit hairy, but actually works -->
  61. <xsl:variable name="xml_base_relative">../../<xsl:choose>
  62. <xsl:when test="'seppo.cgi/search/?q=' = substring($self, 1, 24)"/>
  63. <xsl:when test="'//' = translate($self, 'abcdefghijklmnopqrstuvwxyz0123456789-', '')"/>
  64. <xsl:otherwise>../</xsl:otherwise>
  65. </xsl:choose>
  66. </xsl:variable>
  67. <xsl:variable name="is_cgi" select="starts-with($self, 'seppo.cgi/')"/>
  68. <xsl:variable name="lang" select="/*/@xml:lang"/>
  69. <xsl:variable name="perso" select="document(concat($xml_base,'activitypub/actor.xml'))/rdf:RDF/as:Person"/>
  70. <xsl:variable name="niy">!! Not implemented yet !!</xsl:variable>
  71. <xsl:template match="/">
  72. <!--
  73. Do not set a class="logged-out" initially, but do via early JavaScript.
  74. If JavaScript is off, we need a compromise between logged-in and -out.
  75. -->
  76. <html xmlns="http://www.w3.org/1999/xhtml" data-seppo-cgi-url="{$cgi_url}" lang="{$lang}" xml:lang="{$lang}" class="script-inactive" bgcolor="darkgreen">
  77. <xsl:if test="234 &lt; count(a:feed/a:category)">
  78. <xsl:attribute name="class"><xsl:value-of select="@class"/> manytags</xsl:attribute>
  79. </xsl:if>
  80. <xsl:if test="$is_cgi">
  81. <!-- not striclty accurate (login, search?), but the cgi knows itself and can decide what to serve. -->
  82. <xsl:attribute name="class"><xsl:value-of select="@class"/> logged-in</xsl:attribute>
  83. </xsl:if>
  84. <xsl:call-template name="head"/>
  85. <body>
  86. <xsl:apply-templates select="a:feed|a:entry" mode="root"/>
  87. </body>
  88. </html>
  89. </xsl:template>
  90. <xsl:template name="head">
  91. <head>
  92. <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
  93. <meta name="viewport" content="width=device-width,initial-scale=1.0"/>
  94. <link rel="icon" type="image/jpg" href="{$xml_base}me-avatar.jpg"/>
  95. <link rel="stylesheet" type="text/css" href="{$skin_base}/awesomplete.css"/>
  96. <link rel="stylesheet" type="text/css" href="{$skin_base}/style.css"/>
  97. <script src="{$skin_base}/posts.js"></script>
  98. <script src="{$skin_base}/awesomplete.js"></script>
  99. <!-- script src="{$skin_base}/../../live.js"></script -->
  100. <link rel="alternate" type="application/atom+xml" href="."/>
  101. <link rel="self" type="application/xhtml+xml" href="."/>
  102. <title><xsl:value-of select="a:*/a:title"/></title>
  103. </head>
  104. </xsl:template>
  105. <xsl:template match="a:feed" mode="root">
  106. <noscript><p>JavaScript deactivated, almost fully functional, but <em>nicer</em> if on.</p></noscript>
  107. <xsl:call-template name="header"/>
  108. <!-- h1><xsl:value-of select="a:title"/></h1 -->
  109. <p id="tags" class="categories">
  110. <xsl:variable name="countMax">
  111. <!-- https://stackoverflow.com/a/17966412 -->
  112. <xsl:for-each select="a:category">
  113. <xsl:sort select="@label" data-type="number" order="descending"/>
  114. <xsl:if test="position() = 1"><xsl:value-of select="@label"/></xsl:if>
  115. </xsl:for-each>
  116. </xsl:variable>
  117. <xsl:variable name="labelsDesc">
  118. <xsl:for-each select="a:category">
  119. <xsl:sort select="@label" order="descending"/>
  120. <xsl:value-of select="@label"/>
  121. </xsl:for-each>
  122. </xsl:variable>
  123. <xsl:for-each select="a:category[@label >= 1]">
  124. <xsl:sort select="@term" order="ascending"/>
  125. <!-- not log, just linear, similar to https://github.com/sebsauvage/Shaarli/blob/master/index.php#L1254 -->
  126. <xsl:variable name="size" select="8 + 40 * @label div $countMax"/>
  127. <a style="font-size:{$size}pt" href="{$cgi_url}/search/?q=%23{@term}+" class="tag" data-count="{@label}"><span class="label"><xsl:value-of select="@term"/></span><span style="font-size:8pt">&#160;(<span class="count"><xsl:value-of select="@label"/></span>)</span></a><xsl:text> </xsl:text>
  128. </xsl:for-each>
  129. </p>
  130. <xsl:if test="count(a:entry) &lt; 1">
  131. <p>Here will show up a paged list of all your posts. There are none until you create one, however.</p>
  132. </xsl:if>
  133. <ol id="entries" data-level="0" class="even" role="feed">
  134. <xsl:apply-templates select="a:entry"/>
  135. </ol>
  136. <xsl:call-template name="pagination">
  137. <xsl:with-param name="id">pagination-lower</xsl:with-param>
  138. </xsl:call-template>
  139. <xsl:call-template name="footer"/>
  140. </xsl:template>
  141. <xsl:template name="pagination">
  142. <xsl:param name="id">-</xsl:param>
  143. <xsl:variable name="self" select="a:link[@rel='self']"/>
  144. <xsl:if test="a:link[@rel='previous'] or a:link[@rel='next']">
  145. <ol id="{$id}" class="noshade" role="navigation" aria-label="pagination">
  146. <li>
  147. <xsl:variable name="link" select="a:link[@rel='first']"/>
  148. <a title="most recent page" href="{$xml_base_relative}{$link/@href}#pagination-upper" rel="first" role="button"><xsl:value-of select="$link/@title"/></a>
  149. </li>
  150. <li>
  151. <a title="more recent page" rel="previous" role="button">
  152. <xsl:variable name="link" select="a:link[@rel='previous']"/>
  153. <xsl:choose>
  154. <xsl:when test="$link/@href">
  155. <xsl:attribute name="href"><xsl:value-of select="concat($xml_base_relative, $link/@href, '#pagination-lower')"/></xsl:attribute>
  156. <xsl:attribute name="class">probe-2xx</xsl:attribute>
  157. </xsl:when>
  158. <xsl:otherwise>
  159. <xsl:attribute name="aria-disabled">true</xsl:attribute>
  160. </xsl:otherwise>
  161. </xsl:choose>
  162. &#160;<xsl:value-of select="$link/@title"/>&#160;</a>
  163. </li>
  164. <li aria-current="page">
  165. <a href="{$xml_base_relative}{$self/@href}#{$id}" title="current page" rel="self"><xsl:value-of select="$self/@title"/></a>
  166. </li>
  167. <li>
  168. <a title="next older page" rel="next" role="button">
  169. <xsl:variable name="link" select="a:link[@rel='next']"/>
  170. <xsl:choose>
  171. <xsl:when test="$link/@href">
  172. <xsl:attribute name="href"><xsl:value-of select="concat($xml_base_relative, $link/@href, '#pagination-upper')"/></xsl:attribute>
  173. <xsl:attribute name="class">probe-2xx</xsl:attribute>
  174. </xsl:when>
  175. <xsl:otherwise>
  176. <xsl:attribute name="aria-disabled">true</xsl:attribute>
  177. </xsl:otherwise>
  178. </xsl:choose>
  179. &#160;<xsl:value-of select="$link/@title"/>&#160;</a>
  180. </li>
  181. <li>
  182. <xsl:variable name="link" select="a:link[@rel='last']"/>
  183. <a title="oldest page" href="{$xml_base_relative}{$link/@href}#pagination-lower" rel="last" role="button"><xsl:value-of select="$link/@title"/></a>
  184. </li>
  185. </ol>
  186. </xsl:if>
  187. </xsl:template>
  188. <xsl:template name="header">
  189. <xsl:choose>
  190. <xsl:when test="$is_cgi">
  191. <xsl:call-template name="header_cgi"/>
  192. </xsl:when>
  193. <xsl:otherwise>
  194. <xsl:call-template name="header_static"/>
  195. </xsl:otherwise>
  196. </xsl:choose>
  197. </xsl:template>
  198. <xsl:template name="header_cgi">
  199. <div aria-label="Header" id="header" role="banner">
  200. <a href="{$xml_base}" rel="start" role="button" title="Public Feed">📜</a>
  201. <!-- a href="{$cgi_url}/timeline/p/" rel="start" role="button">🕞 <span class="hidden-xs">Timeline</span></a -->
  202. <a href="{$cgi_url}/timeline/p/" rel="start" role="button" title="Private/internal">🏡 <span class="hidden-xs">Home</span></a>
  203. <a href="{$cgi_url}/people" rel="nofollow" role="button">👥 <span class="hidden-xs">People</span></a>
  204. <a href="{$cgi_url}/backoffice/" rel="nofollow" role="button">⚙️ <span class="hidden-xs">Settings</span></a>
  205. <form disabled="disabled" role="search" title="{$niy}" id="form_search" name="form_search" class="combined" action="{$cgi_url}/search/">
  206. <input disabled="disabled awesomplete" tabindex="100" name="q" id="q" value="{@se:searchTerms}" type="text" placeholder="🔍
  207. Search text or #tag or @person" data-multiple="true"/>
  208. <button type="Submit">Search</button>
  209. </form>
  210. <form role="form" id="form_post" name="form_post" class="hidden-logged-out combined" action="{$cgi_url}/post">
  211. <input tabindex="300" name="post" type="text" placeholder="✍️ Enter text and create a post." autofocus="autofocus"/>
  212. <button type="Submit">Create Post</button>
  213. </form>
  214. <p class="whitespace"></p>
  215. <xsl:call-template name="pagination">
  216. <xsl:with-param name="id">pagination-upper</xsl:with-param>
  217. </xsl:call-template>
  218. </div>
  219. </xsl:template>
  220. <xsl:template name="header_static">
  221. <div aria-label="Header" id="header" role="banner">
  222. <div id="banner">
  223. <div id="banner-img">
  224. <img alt="Banner" src="{$xml_base}me-banner.jpg"/>
  225. </div>
  226. <div id="head-grid">
  227. <a href="{$xml_base}" rel="start" role="button" title="Public Feed">📜</a>
  228. <form action="{$cgi_url}/notifyme" id="form_notifyme" name="notifyme" class="hidden-logged-in">
  229. <input name="resource" required="required" pattern="(acct:|@)?[a-zA-Z0-9._~\-]+@[a-zA-Z0-9._~\-]+"
  230. placeholder="@alice@example.com" title="Subscribe to this feed with your ActivtyPub account" />
  231. <input name="rel" type="hidden" value="http://ostatus.org/schema/1.0/subscribe"/>
  232. <input type="submit" value="Subscribe 🔔" title="Subscribe with your ActivtyPub account"/>
  233. </form>
  234. <span class="hidden-logged-in">
  235. <a id="link_login" href="{$cgi_url}/timeline/p/" rel="nofollow"
  236. name="link_login" role="button"><span class="hidden-xs">Login </span> 👋</a>
  237. </span>
  238. <span class="visible-logged-in">
  239. <a href="{$cgi_url}/timeline/p/" rel="start nofollow" role="button" title="Private/internal">🏡 <span class="hidden-xs">Home</span></a>
  240. </span>
  241. <a id="link_logout" href=
  242. "{$cgi_url}/logout" class="hidden-logged-out" rel="nofollow" name=
  243. "link_logout" role="button"><span class="hidden-xs" title="Switch to public view">Logout</span> 👋</a>
  244. </div>
  245. <!--
  246. <div id="subscribe" class="hidden-logged-out">
  247. <a href="{$xml_base}activitypub/subscribed/" rel="nofollow" title="a.k.a. Following" role="button">📄 <span class="hidden-xs">Subscribed</span> 👂</a>
  248. <a href="{$xml_base}activitypub/subscribers/" rel="nofollow" title="a.k.a. Followers" role="button">📄 <span class="hidden-xs">Subscribers</span> 📣</a>
  249. <a aria-disabled="true" href="{$xml_base}activitypub/blocked/" rel="nofollow" role="button">📄 <span class="hidden-xs">Blocked</span> 🤐</a>
  250. </div>
  251. -->
  252. </div>
  253. <div class="" id="avatar">
  254. <a href="{$xml_base}"><img alt="Avatar" src="{$xml_base}me-avatar.jpg" rel="icon"/></a>
  255. </div>
  256. <h3 class="" id="name"><a href="{$perso/as:url/@rdf:resource}"><xsl:value-of select="$perso/as:name"/></a></h3>
  257. <xsl:variable name="host1" select="$perso/as:url/@rdf:resource"/>
  258. <xsl:variable name="host0" select="substring-after($host1,'://')"/>
  259. <xsl:variable name="host" select="substring-before($host0,'/')"/>
  260. <p class=""><a href="{$perso/as:url/@rdf:resource}">@<span id="preferredUsername"><xsl:value-of select="$perso/as:preferredUsername"/></span>@<xsl:value-of select="$host"/></a></p>
  261. <xsl:if test="1 or a:link[@rel='first']/@href = a:link[@rel='self']/@href">
  262. <div class="noshade" id="bio">
  263. <p class="clickable" title="summary">
  264. <xsl:call-template name="linefeed2br">
  265. <xsl:with-param name="string" select="$perso/as:summary"/>
  266. </xsl:call-template>
  267. </p>
  268. <dl>
  269. <xsl:for-each select="$perso/as:attachment/schema:PropertyValue[schema:value]">
  270. <dt class="clickable"><xsl:value-of select="as:name"/></dt>
  271. <dd class="clickable"><xsl:value-of select="schema:value"/></dd>
  272. </xsl:for-each>
  273. </dl>
  274. </div>
  275. </xsl:if>
  276. <xsl:comment> https://stackoverflow.com/a/18520870 http://jsfiddle.net/66Ynx/ </xsl:comment>
  277. <form disabled="disabled" role="search" id="form_search" name="form_search" class="combined" action="{$cgi_url}/search/">
  278. <input disabled="disabled" class="awesomplete" tabindex="100" name="q" id="q" value="{@se:searchTerms}" type="text" placeholder="🔍
  279. Search text or #tag or @person" data-multiple="true"/>
  280. <button type="Submit">Search</button>
  281. </form>
  282. <form role="form" id="form_post" name="form_post" class="hidden-logged-out combined" action="{$cgi_url}/post">
  283. <input tabindex="300" name="post" type="text" placeholder="✍️ Enter text to start a post." autofocus="autofocus"/>
  284. <button type="Submit">Create Post</button>
  285. </form>
  286. <p class="whitespace"></p>
  287. <xsl:call-template name="pagination">
  288. <xsl:with-param name="id">pagination-upper</xsl:with-param>
  289. </xsl:call-template>
  290. </div>
  291. </xsl:template>
  292. <xsl:template name="footer">
  293. <p role="contentinfo" aria-label="Footer" id="footer">
  294. <a title="Syndicate" href="{$xml_base_absolute}{a:link[@rel='self']/@href}">
  295. <img alt="Feed" src="{$skin_base}/feed-icon.svg"/>
  296. </a>
  297. <xsl:text> </xsl:text>
  298. <a title="Validate (Atom 1.0)" href="https://validator.w3.org/feed/check.cgi?url={$xml_base_absolute}{a:link[@rel='self']/@href}">
  299. <img alt="Validity badge (Atom 1.0)" src="{$skin_base}/valid-atom.svg"/>
  300. </a>
  301. <!-- <xsl:text> </xsl:text>
  302. <a href="https://validator.w3.org/check?uri=referer">
  303. <img alt="Valid XHTML 1.0 Strict" src="{$skin_base}/valid-xhtml10-blue-v.svg"/>
  304. </a>
  305. <a href="https://jigsaw.w3.org/css-validator/check/referer?profile=css3&amp;usermedium=screen&amp;warning=2&amp;vextwarning=false&amp;lang={$lang}">
  306. <img alt="CSS ist valide!" src="{$skin_base}/valid-css-blue-v.svg"/>
  307. </a>
  308. -->
  309. <xsl:text> </xsl:text>
  310. <!--
  311. <a href="{a:link[@rel='about']/@href}">
  312. About<xsl:if test="string-length(a:link[@rel='about']/@href) &lt; 2"><span> link rel='about' missing.</span></xsl:if>
  313. </a>
  314. <xsl:text> </xsl:text>
  315. <a href="{a:link[@rel='license']/@href}">
  316. <xsl:value-of select="a:link[@rel='license']/@title"/><xsl:if test="string-length(a:link[@rel='license']/@href) &lt; 2"><span> link rel='license' missing.</span></xsl:if>
  317. </a>
  318. <xsl:text> </xsl:text>
  319. <a href="{a:link[@rel='terms-of-service']/@href}">
  320. § Imprint<xsl:if test="string-length(a:link[@rel='terms-of-service']/@href) &lt; 2"><span> link rel='terms-of-service' missing.</span></xsl:if>
  321. </a>
  322. <xsl:text> </xsl:text>
  323. <a href="{a:link[@rel='privacy-policy']/@href}">
  324. 🤫 Privacy<xsl:if test="string-length(a:link[@rel='terms-of-service']/@href) &lt; 2"><span> link rel='terms-of-service' missing.</span></xsl:if>
  325. </a>
  326. -->
  327. <xsl:text> </xsl:text>
  328. <a title="Generator" href="https://{a:generator/@uri}">
  329. <xsl:value-of select="a:generator"/>
  330. </a>
  331. </p>
  332. </xsl:template>
  333. <xsl:template match="a:entry" mode="root">
  334. <noscript><p>JavaScript deactivated, almost fully functional, but <em>nicer</em> if on.</p></noscript>
  335. <xsl:call-template name="header"/>
  336. <ol id="entries" data-level="0" class="even">
  337. <xsl:apply-templates select="."/>
  338. </ol>
  339. <xsl:call-template name="footer"/>
  340. </xsl:template>
  341. <xsl:template match="a:entry">
  342. <xsl:variable name="link" select="a:link[not(@rel)]/@href"/>
  343. <xsl:variable name="self" select="a:link[@rel='self']/@href"/>
  344. <xsl:variable name="id_slash" select="substring-after($self, '/p/')"/>
  345. <xsl:variable name="id" select="substring-after($self, '#')"/>
  346. <li class="noshade" id="{$id}" data-id="{a:id}" role="article">
  347. <h3>
  348. <xsl:if test="media:thumbnail/@url">
  349. <!-- https://varvy.com/pagespeed/defer-images.html -->
  350. <!-- img alt="Vorschaubild" data-src="{media:thumbnail/@url}" src="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" / -->
  351. </xsl:if>
  352. <xsl:choose>
  353. <xsl:when test="$link">
  354. <a href="{$redirector}{$link}" rel="noopener noreferrer" referrerpolicy="no-referrer"><xsl:value-of select="a:title"/></a>
  355. </xsl:when>
  356. <xsl:otherwise>
  357. <xsl:value-of select="a:title"/>
  358. </xsl:otherwise>
  359. </xsl:choose>
  360. </h3>
  361. <xsl:if test="a:summary">
  362. <h5>
  363. <xsl:call-template name="linefeed2br">
  364. <xsl:with-param name="string" select="a:summary"/>
  365. </xsl:call-template>
  366. </h5>
  367. </xsl:if>
  368. <!-- p class="small text-right"><a><xsl:value-of select="$link"/></a></p -->
  369. <!-- html content won't work that easy (out-of-the-firebox): https://bugzilla.mozilla.org/show_bug.cgi?id=98168#c140 -->
  370. <!-- workaround via jquery: http://stackoverflow.com/a/9714567 -->
  371. <!-- Überbleibsel vom Shaarli Atom Feed raus: -->
  372. <!-- xsl:value-of select="substring-before(a:content[not(@src)], '&lt;br&gt;(&lt;a href=&quot;https://links.mro.name/?')" disable-output-escaping="yes" / -->
  373. <xsl:apply-templates select="a:content"/>
  374. <xsl:if test="a:category">
  375. <p class="categories">
  376. <xsl:for-each select="a:category">
  377. <xsl:sort select="@term"/>
  378. <xsl:if test="position() != 1">
  379. <xsl:text>, </xsl:text>
  380. </xsl:if>
  381. <a href="{@scheme}{@term}/" class="tag">#<xsl:value-of select="@term"/></a>
  382. </xsl:for-each>
  383. </p>
  384. </xsl:if>
  385. <p class="footer">
  386. <xsl:variable name="entry_updated" select="a:updated"/>
  387. <xsl:variable name="entry_updated_human"><xsl:call-template name="human_time"><xsl:with-param name="time" select="$entry_updated"/></xsl:call-template></xsl:variable>
  388. <xsl:variable name="entry_published" select="a:published"/>
  389. <xsl:variable name="entry_published_human"><xsl:call-template name="human_time"><xsl:with-param name="time" select="$entry_published"/></xsl:call-template></xsl:variable>
  390. <a class="updated" title="Go to Original" rel="canonical via" href="{a:link[@rel='self']/@href}"
  391. data-rfc3339="{a:updated}"><xsl:value-of select="$entry_updated_human"/> 🔗</a>
  392. <xsl:for-each select="a:author[wf:uri]">
  393. <xsl:text> * </xsl:text>
  394. <a class="from rfc7565" title="Go to Author" href="{$cgi_url}/activitypub/actor.xml?resource={wf:uri}">
  395. <!-- img alt="Avatar" src="{wf:icon}"/ -->
  396. @<xsl:value-of select="substring-after(wf:uri,'acct:')"/>
  397. </a>
  398. </xsl:for-each>
  399. <!--
  400. <xsl:if test="$link">
  401. *
  402. <a href="{$archive}{$link}" rel="noopener noreferrer" referrerpolicy="no-referrer">@archive.org</a>
  403. </xsl:if>
  404. -->
  405. <span class="hidden-logged-out">
  406. <xsl:variable name="id_esc" select="translate(a:id,'#','$')"/>
  407. <xsl:variable name="can_edit" select="a:link[@rel='edit']/@href"/>
  408. <xsl:if test="$can_edit">
  409. *
  410. <!-- a href="{$cgi_url}/edit?id={$id_esc}" rel="nofollow">XY</a><xsl:text> </xsl:text -->
  411. <a href="{$can_edit}" rel="nofollow">Edit</a><xsl:text> </xsl:text>
  412. </xsl:if>
  413. *
  414. <xsl:variable name="ap_inbox" select="a:link[@rel='ap_inbox']/@href"/>
  415. <xsl:if test="$ap_inbox">
  416. <a href="{$cgi_url}/activitypub/like?id={$id_esc}&amp;inbox={$ap_inbox}" rel="nofollow" title="Like">❤️ </a>
  417. &#xa0;
  418. <a href="{$cgi_url}/activitypub/announce?id={$id_esc}&amp;inbox={$ap_inbox}" rel="nofollow" title="Announce">📣 </a>
  419. &#xa0;
  420. <a aria-disabled="true" href="{$cgi_url}/activitypub/reply?id={$id_esc}&amp;inbox={$ap_inbox}" rel="nofollow" title="Reply">↩️ </a>
  421. </xsl:if>
  422. </span>
  423. <!--
  424. *
  425. <a aria-disabled="true" href="{$cgi_url}/replies?id={a:id}">Replies</a>
  426. -->
  427. </p>
  428. <!-- iframe data-src="{$cgi_url}/replies?id={a:id}"/ -->
  429. </li>
  430. </xsl:template>
  431. <xsl:template match="a:content[not(@type) or @type = 'text']">
  432. <xsl:if test="string-length(.) &gt; 0">
  433. <p class="clickable rendered type-text">
  434. <xsl:call-template name="linefeed2br">
  435. <xsl:with-param name="string" select="."/>
  436. </xsl:call-template>
  437. </p>
  438. </xsl:if>
  439. </xsl:template>
  440. </xsl:stylesheet>