Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
H
hugo-theme-refined
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kaushal Modi
hugo-theme-refined
Commits
1f2f99ef
Commit
1f2f99ef
authored
Aug 25, 2018
by
Kaushal Modi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support link-only mentions where the author_obj is nil
parent
863536c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
55 deletions
+68
-55
layouts/partials/webmention_rcv.html
layouts/partials/webmention_rcv.html
+68
-55
No files found.
layouts/partials/webmention_rcv.html
View file @
1f2f99ef
...
...
@@ -35,69 +35,82 @@
{{ $activity_type := (index $activity "type") }}
{{ $data := (index $wm "data") }}
{{/* partial "debugprint.html" $data */}}
{{ $author_obj := (index $data "author") }}
{{ $author_name := (index $author_obj "name") }}
{{ $author_photo := (index $author_obj "photo") }}
{{ $author_url := (index $author_obj "url") }}
{{ $mention_content := (index $data "content") }}
{{ $mention_url := (index $data "url") }}
{{ $mention_content := (index $data "content") }}
{{ with (index $data "published") }}
{{ $.Scratch.Set "__published_date" ((time .).Local | dateFormat "Mon Jan 2, 2006") }}
{{ end }}
{{ with (index $wm "verified_date") }}
<!-- Webmention received date -->
{{ $.Scratch.Set "__verified_date" ((time .).Local | dateFormat "Mon Jan 2, 2006 15:04 MST") }}
{{ end }}
{{ if (eq $activity_type "reply") }}
{{/* partial "debugprint.html" $data */}}
<dl
class=
"webmention comment"
>
<dt>
Comment by
<a
href=
"{{ $author_url }}"
class=
"no-text-decoration"
>
{{ $author_name }}
</a>
{{ printf `
<a
href=
"%s"
class=
"no-text-decoration"
>
` $mention_url | safeHTML }}
{{ with $.Scratch.Get "__verified_date" }}on {{ . }}{{ end }}
{{ printf "
</a>
" | safeHTML }}
</dt>
<dd>
{{ if (findRE "^https://commentpara\\.de" $mention_url) }}
<!-- Webmentions originated from commentpara.de -->
<!--
- Remove the HTML line-breaks, else the markdown code blocks won't work.
- commentpara.de transmits the data encoded in HTML. So the markdown blockquote
markers ">" would get converted to ">", so convert them back to ">".
-->
{{ $mention_content | replaceRE "
<br
/>
" "" | replaceRE "(^|\\n)
>
" "\n> " | replaceRE " -
>
" " -> " | replaceRE "
<
- " "
<-
"
|
markdownify
|
safeHTML
}}
{{
else
}}
<!
--
Webmentions
originated
from
elsewhere
like
someone
'
s
site
.
--
>
{{ $mention_content | safeHTML }}
{{ end }}
</dd>
</dl>
{{ else if (eq $activity_type "link") }}
{{/* partial "debugprint.html" $wm */}}
<dl
class=
"webmention mention"
>
<dt>
Mentioned by
<a
href=
"{{ $author_url }}"
class=
"no-text-decoration"
>
{{ $author_name }}
</a>
{{ printf `
<a
href=
"%s"
class=
"no-text-decoration"
>
` $mention_url | safeHTML }}
{{ with $.Scratch.Get "__verified_date" }}on {{ . }}{{ end }}
{{ printf "
</a>
" | safeHTML }}
</dt>
<dd>
{{ $mention_title := (index $data "name") }}
{{ with $mention_title }}
{{ printf `
<strong><a
href=
"%s"
>
%s
</a></strong>
` $mention_url . | safeHTML }}
<br
/>
{{ with $.Scratch.Get "__published_date" }}—Published on {{ . }}{{ end }}
<hr
/>
{{ end }}
<!-- Limit the mention content to 250 characters. -->
{{ $mention_content | safeHTML | truncate 250 }}
</dd>
</dl>
{{ else if (eq $activity_type "like") }}
{{ $.Scratch.Add "__like_cnt" 1 }}
{{ else if (eq $activity_type "repost") }}
{{ $.Scratch.Add "__repost_cnt" 1 }}
{{ $author_obj := (index $data "author") }}
{{ with $author_obj }}
{{ $author_name := (index . "name") }}
{{ $author_photo := (index . "photo") }}
{{ $author_url := (index . "url") }}
{{ if (eq $activity_type "reply") }}
{{/* partial "debugprint.html" $data */}}
<dl
class=
"webmention comment"
>
<dt>
Comment by
<a
href=
"{{ $author_url }}"
class=
"no-text-decoration"
>
{{ $author_name }}
</a>
{{ printf `
<a
href=
"%s"
class=
"no-text-decoration"
>
` $mention_url | safeHTML }}
{{ with $.Scratch.Get "__verified_date" }}on {{ . }}{{ end }}
{{ printf "
</a>
" | safeHTML }}
</dt>
<dd>
{{ if (findRE "^https://commentpara\\.de" $mention_url) }}
<!-- Webmentions originated from commentpara.de -->
<!--
- Remove the HTML line-breaks, else the markdown code blocks won't work.
- commentpara.de transmits the data encoded in HTML. So the markdown blockquote
markers ">" would get converted to ">", so convert them back to ">".
-->
{{ $mention_content | replaceRE "
<br
/>
" "" | replaceRE "(^|\\n)
>
" "\n> " | replaceRE " -
>
" " -> " | replaceRE "
<
- " "
<-
"
|
markdownify
|
safeHTML
}}
{{
else
}}
<!
--
Webmentions
originated
from
elsewhere
like
someone
'
s
site
.
--
>
{{ $mention_content | safeHTML }}
{{ end }}
</dd>
</dl>
{{ else if (eq $activity_type "link") }}
{{/* partial "debugprint.html" $wm */}}
<dl
class=
"webmention mention"
>
<dt>
Mentioned by
<a
href=
"{{ $author_url }}"
class=
"no-text-decoration"
>
{{ $author_name }}
</a>
{{ printf `
<a
href=
"%s"
class=
"no-text-decoration"
>
` $mention_url | safeHTML }}
{{ with $.Scratch.Get "__verified_date" }}on {{ . }}{{ end }}
{{ printf "
</a>
" | safeHTML }}
</dt>
<dd>
{{ $mention_title := (index $data "name") }}
{{ with $mention_title }}
{{ printf `
<strong><a
href=
"%s"
>
%s
</a></strong>
` $mention_url . | safeHTML }}
<br
/>
{{ with $.Scratch.Get "__published_date" }}—Published on {{ . }}{{ end }}
<hr
/>
{{ end }}
<!-- Limit the mention content to 250 characters. -->
{{ $mention_content | safeHTML | truncate 250 }}
</dd>
</dl>
{{ else if (eq $activity_type "like") }}
{{ $.Scratch.Add "__like_cnt" 1 }}
{{ else if (eq $activity_type "repost") }}
{{ $.Scratch.Add "__repost_cnt" 1 }}
{{ else }}
{{ $activity }}
{{ end }}
{{ else }}
{{ $activity }}
{{ end }}
{{ end }}
<!-- ends the range within "with $webmentions_rcv.links" -->
{{ end }}
<!-- ends "with $webmentions_rcv.links" -->
{{ with $mention_url }}
<dl
class=
"webmention mention"
>
<dt>
Mentioned at
</dt>
<dd>
{{ printf `
<a
href=
"%s"
class=
"no-text-decoration"
>
%s
</a>
` . . | safeHTML }}
</dd>
</dl>
{{ end }}
{{ end }}
<!-- ends "with $author_obj"-->
{{ end }}
<!-- ends the range within "with $webmentions_rcv.links" -->
{{ end }}
<!-- ends "with $webmentions_rcv.links" -->
<!-- Show comments from Disqus-exported archive. -->
{{ partial "disqus-json.html" $page }}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment