1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-10 00:12:09 +00:00

Compare commits

...

3 commits

Author SHA1 Message Date
Rohan Kumar
1eedc95339
Fix whitespace with XHTML parser
Remove leading whitespace in codeblocks that only appears when using
browser XHTML parsers for some reason.
2023-12-03 23:47:35 -08:00
Rohan Kumar
319051e126
Add simple list extensions to atom feed
I use this to instruct feed readers on how to sort items. See
<https://learn.microsoft.com/en-us/previous-versions/windows/desktop/gg427659(v=vs.85)>
2023-12-03 21:55:40 -08:00
Rohan Kumar
be791111df
Improve use of threading extensions in Atom feeds
- Add content-type metadata
- Follow recommendation to add rel-related links for unsupported clients
- Replace slash:comments with rel-replies containing thr:count metadata
  and thr:total elements.
2023-12-03 07:34:04 -08:00
2 changed files with 19 additions and 6 deletions

View file

@ -16,17 +16,23 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed <feed
xmlns="http://www.w3.org/2005/Atom" xmlns="http://www.w3.org/2005/Atom"
xml:lang="{{ .Site.LanguageCode }}"
xmlns:activity="http://activitystrea.ms/spec/1.0/" xmlns:activity="http://activitystrea.ms/spec/1.0/"
xmlns:admin="http://webns.net/mvcb/" xmlns:admin="http://webns.net/mvcb/"
xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005"
xmlns:media="http://search.yahoo.com/mrss/" xmlns:media="http://search.yahoo.com/mrss/"
xmlns:ostatus="http://ostatus.org/schema/1.0" xmlns:ostatus="http://ostatus.org/schema/1.0"
xmlns:poco="http://portablecontacts.net/spec/1.0" xmlns:poco="http://portablecontacts.net/spec/1.0"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:thr="http://purl.org/syndication/thread/1.0"
xmlns:webfeeds="http://webfeeds.org/rss/1.0"> xmlns:webfeeds="http://webfeeds.org/rss/1.0"
xml:lang="{{ .Site.LanguageCode }}">
<cf:treatAs>list</cf:treatAs>
<cf:listinfo>
<cf:sort
ns="http://www.w3.org/2005/Atom"
element="published" data-type="date" label="Date published" default="true"/>
</cf:listinfo>
<title>{{ $title }} on {{ .Site.Title }}</title> <title>{{ $title }} on {{ .Site.Title }}</title>
<subtitle> <subtitle>
{{- if .Params.Description -}} {{- if .Params.Description -}}
@ -73,12 +79,14 @@
<rights type="text">Copyright © {{ now.Year }} Rohan Kumar</rights> <rights type="text">Copyright © {{ now.Year }} Rohan Kumar</rights>
<link rel="license" type="application/rdf+xml" href="https://creativecommons.org/licenses/by-sa/4.0/rdf" /> <link rel="license" type="application/rdf+xml" href="https://creativecommons.org/licenses/by-sa/4.0/rdf" />
{{- with .Params.replyURI -}} {{- with .Params.replyURI -}}
<thr:in-reply-to ref="{{ . }}" href="{{ . }}" /> <thr:in-reply-to ref="{{ . }}" href="{{ . }}" type="text/html" />
<link rel="related" type="text/html" href="{{ . }}" />
{{- end -}} {{- end -}}
{{- with .Params.replyAuthorURI -}} {{- with .Params.replyAuthorURI -}}
<link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/person" href="{{ . }}"/> <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/person" href="{{ . }}"/>
{{- end -}} {{- end -}}
{{- $type := "article" -}} {{- $type := "article" -}}
{{- /* TODO: add bookmark type and convert bookmarks to their own post types. */ -}}
{{- if eq .Section "notes" -}} {{- if eq .Section "notes" -}}
{{- $type = "note" -}} {{- $type = "note" -}}
{{- end -}} {{- end -}}
@ -99,7 +107,12 @@
{{ partial "processed-content.html" . | replaceRE `(?: )?(?:item(type|scope|prop|id|ref)="[^"]*"|class="language-figure")` "" | replaceRE `<meta content="true" ?/>` "" | safeHTML -}} {{ partial "processed-content.html" . | replaceRE `(?: )?(?:item(type|scope|prop|id|ref)="[^"]*"|class="language-figure")` "" | replaceRE `<meta content="true" ?/>` "" | safeHTML -}}
</div> </div>
</content> </content>
<slash:comments>{{ .Page.Scratch.Get "webmentionCount" }}</slash:comments> {{- /* TODO: add application/atom+xml version of comments. */ -}}
<link
rel="replies" type="text/html"
href="{{ .Permalink }}#webmentions"
thr:count="{{ .Page.Scratch.Get "webmentionCount" }}" />
<thr:total>{{ .Page.Scratch.Get "webmentionCount" }}</thr:total>
</entry> </entry>
{{ end -}} {{ end -}}
{{- end }} {{- end }}

View file

@ -52,5 +52,5 @@ sed 7d "$html_file" | run_xmllint | tail -n +2 >"$tmp_file"
-e 's#</span>(<a[^>]*rel="(nofollow ugc|ugc nofollow)"([^>]*)?>liked</a>)#</span> \1#' \ -e 's#</span>(<a[^>]*rel="(nofollow ugc|ugc nofollow)"([^>]*)?>liked</a>)#</span> \1#' \
-e 's#^[\t\s]*<(code|/pre)#<\1#' \ -e 's#^[\t\s]*<(code|/pre)#<\1#' \
"$tmp_file" \ "$tmp_file" \
| awk '/^<\/code>/{printf "%s",$0;next}7' | awk '/(^<\/code>|<pre tabindex="0">)/{printf "%s",$0;next}7'
} >"$html_file" } >"$html_file"