From a8e4b4652b32886b59dba2914f08503aeac7100a Mon Sep 17 00:00:00 2001 From: lowlighter <22963968+lowlighter@users.noreply.github.com> Date: Sat, 24 Apr 2021 21:44:35 +0200 Subject: [PATCH] Fix attachments with empty self-closing tag #224 --- .../partials/base.activity+community.ejs | 118 +++++++++--------- source/templates/classic/partials/tweets.ejs | 5 +- 2 files changed, 64 insertions(+), 59 deletions(-) diff --git a/source/templates/classic/partials/base.activity+community.ejs b/source/templates/classic/partials/base.activity+community.ejs index f5665b26..98554855 100644 --- a/source/templates/classic/partials/base.activity+community.ejs +++ b/source/templates/classic/partials/base.activity+community.ejs @@ -1,59 +1,61 @@ -<% if (account === "user") { %> -
- <% if (base.activity) { %> -
-

- - Activity -

-
- - <%= computed.commits %> Commit<%= s(computed.commits) %> -
-
- - <%= user.contributionsCollection.totalPullRequestReviewContributions %> Pull request<%= s(user.contributionsCollection.totalPullRequestReviewContributions) %> reviewed -
-
- - <%= user.contributionsCollection.totalPullRequestContributions %> Pull request<%= s(user.contributionsCollection.totalPullRequestContributions) %> opened -
-
- - <%= user.contributionsCollection.totalIssueContributions %> Issue<%= s(user.contributionsCollection.totalIssueContributions) %> opened -
-
- - <%= user.issueComments.totalCount %> issue comment<%= s(user.issueComments.totalCount) %> -
-
- <% } %> - <% if (base.community) { %> -
-

- Community stats -

-
- - Member of <%= user.organizations.totalCount %> organization<%= s(user.organizations.totalCount) %> -
-
- - Following <%= user.following.totalCount %> user<%= s(user.followers.totalCount) %> -
-
- - Sponsoring <%= user.sponsorshipsAsSponsor.totalCount %> repositor<%= s(user.sponsorshipsAsSponsor.totalCount, "y") %> -
-
- - Starred <%= user.starredRepositories.totalCount %> repositor<%= s(user.starredRepositories.totalCount, "y") %> -
-
- - Watching <%= user.watching.totalCount %> repositor<%= s(user.watching.totalCount, "y") %> -
-
- <% } %> -
+<% if ((account === "user")&&((base.activity)||(base.community))) { %> +
+
+ <% if (base.activity) { %> +
+

+ + Activity +

+
+ + <%= computed.commits %> Commit<%= s(computed.commits) %> +
+
+ + <%= user.contributionsCollection.totalPullRequestReviewContributions %> Pull request<%= s(user.contributionsCollection.totalPullRequestReviewContributions) %> reviewed +
+
+ + <%= user.contributionsCollection.totalPullRequestContributions %> Pull request<%= s(user.contributionsCollection.totalPullRequestContributions) %> opened +
+
+ + <%= user.contributionsCollection.totalIssueContributions %> Issue<%= s(user.contributionsCollection.totalIssueContributions) %> opened +
+
+ + <%= user.issueComments.totalCount %> issue comment<%= s(user.issueComments.totalCount) %> +
+
+ <% } %> + <% if (base.community) { %> +
+

+ Community stats +

+
+ + Member of <%= user.organizations.totalCount %> organization<%= s(user.organizations.totalCount) %> +
+
+ + Following <%= user.following.totalCount %> user<%= s(user.followers.totalCount) %> +
+
+ + Sponsoring <%= user.sponsorshipsAsSponsor.totalCount %> repositor<%= s(user.sponsorshipsAsSponsor.totalCount, "y") %> +
+
+ + Starred <%= user.starredRepositories.totalCount %> repositor<%= s(user.starredRepositories.totalCount, "y") %> +
+
+ + Watching <%= user.watching.totalCount %> repositor<%= s(user.watching.totalCount, "y") %> +
+
+ <% } %> +
+
<% } %> \ No newline at end of file diff --git a/source/templates/classic/partials/tweets.ejs b/source/templates/classic/partials/tweets.ejs index db809676..d468cff3 100644 --- a/source/templates/classic/partials/tweets.ejs +++ b/source/templates/classic/partials/tweets.ejs @@ -28,10 +28,13 @@ <% for (const {text, createdAt, attachments} of plugins.tweets.list) { %>
<%- text %> - <% if (attachments) { %> + <% if (attachments?.length) { %>
<% for (const {image, title, description, website} of attachments) { %>
+ + Hack to avoid self-closing empty div, do not remove + <% if (title) { %>
<%= title %>