feat(templates/repository, templates/terminal): additional support (#660)
This commit is contained in:
@@ -32,7 +32,7 @@ export default async function({login, q, imports, data, account}, {enabled = fal
|
||||
await browser.close()
|
||||
|
||||
//Results
|
||||
return {image:await screenshot.getBase64Async("image/png"), title, height:screenshot.bitmap.height, width:screenshot.bitmap.width}
|
||||
return {image:await screenshot.getBase64Async("image/png"), title, height:screenshot.bitmap.height, width:screenshot.bitmap.width, url}
|
||||
}
|
||||
//Handle errors
|
||||
catch (error) {
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
"stargazers",
|
||||
"people",
|
||||
"activity",
|
||||
"posts",
|
||||
"rss",
|
||||
"screenshot",
|
||||
"stock",
|
||||
"contributors",
|
||||
"licenses",
|
||||
"rss"
|
||||
"sponsors",
|
||||
"licenses"
|
||||
]
|
||||
51
source/templates/repository/partials/posts.ejs
Normal file
51
source/templates/repository/partials/posts.ejs
Normal file
@@ -0,0 +1,51 @@
|
||||
<% if (plugins.posts) { %>
|
||||
<section>
|
||||
<h2 class="field">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M4.456.734a1.75 1.75 0 012.826.504l.613 1.327a3.081 3.081 0 002.084 1.707l2.454.584c1.332.317 1.8 1.972.832 2.94L11.06 10l3.72 3.72a.75.75 0 11-1.061 1.06L10 11.06l-2.204 2.205c-.968.968-2.623.5-2.94-.832l-.584-2.454a3.081 3.081 0 00-1.707-2.084l-1.327-.613a1.75 1.75 0 01-.504-2.826L4.456.734zM5.92 1.866a.25.25 0 00-.404-.072L1.794 5.516a.25.25 0 00.072.404l1.328.613A4.582 4.582 0 015.73 9.63l.584 2.454a.25.25 0 00.42.12l5.47-5.47a.25.25 0 00-.12-.42L9.63 5.73a4.581 4.581 0 01-3.098-2.537L5.92 1.866z"></path></svg>
|
||||
Recent articles
|
||||
</h2>
|
||||
<div class="row fill-width">
|
||||
<section>
|
||||
<% if (plugins.posts.error) { %>
|
||||
<div class="field error">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M2.343 13.657A8 8 0 1113.657 2.343 8 8 0 012.343 13.657zM6.03 4.97a.75.75 0 00-1.06 1.06L6.94 8 4.97 9.97a.75.75 0 101.06 1.06L8 9.06l1.97 1.97a.75.75 0 101.06-1.06L9.06 8l1.97-1.97a.75.75 0 10-1.06-1.06L8 6.94 6.03 4.97z"></path></svg>
|
||||
<%= plugins.posts.error.message %>
|
||||
</div>
|
||||
<% } else { %>
|
||||
<div class="field">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M2.002 2.725a.75.75 0 01.797-.699C8.79 2.42 13.58 7.21 13.974 13.201a.75.75 0 11-1.497.098 10.502 10.502 0 00-9.776-9.776.75.75 0 01-.7-.798zM2 13a1 1 0 112 0 1 1 0 01-2 0zm.84-5.95a.75.75 0 00-.179 1.489c2.509.3 4.5 2.291 4.8 4.8a.75.75 0 101.49-.178A7.003 7.003 0 002.838 7.05z"></path></svg>
|
||||
From <%= plugins.posts.source %>
|
||||
</div>
|
||||
<div class="posts largeable-flex-wrap">
|
||||
<% if (plugins.posts.list.length) { %>
|
||||
<% for (const {title, description, image, date} of plugins.posts.list) { %>
|
||||
<div class="field post largeable-width-half">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M4.75 0a.75.75 0 01.75.75V2h5V.75a.75.75 0 011.5 0V2h1.25c.966 0 1.75.784 1.75 1.75v10.5A1.75 1.75 0 0113.25 16H2.75A1.75 1.75 0 011 14.25V3.75C1 2.784 1.784 2 2.75 2H4V.75A.75.75 0 014.75 0zm0 3.5h8.5a.25.25 0 01.25.25V6h-11V3.75a.25.25 0 01.25-.25h2zm-2.25 4v6.75c0 .138.112.25.25.25h10.5a.25.25 0 00.25-.25V7.5h-11z"></path></svg>
|
||||
<div class="infos">
|
||||
<div class="left">
|
||||
<div class="date"><%= f.date(new Date(date), {date:true, timeZone:config.timezone?.name}) %></div>
|
||||
<% if (plugins.posts.covers) { %>
|
||||
<div class="cover" style="background-image: url(<%= image %>);"></div>
|
||||
<% } %>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="title"><%= title %></div>
|
||||
<% if (plugins.posts.descriptions) { %>
|
||||
<div class="description"><%= description %></div>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% } %>
|
||||
<% } else { %>
|
||||
<div class="field">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M1.75 1.5a.25.25 0 00-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 01.75.75v2.19l2.72-2.72a.75.75 0 01.53-.22h6.5a.25.25 0 00.25-.25v-9.5a.25.25 0 00-.25-.25H1.75zM0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0114.25 13H8.06l-2.573 2.573A1.457 1.457 0 013 14.543V13H1.75A1.75 1.75 0 010 11.25v-9.5zM9 9a1 1 0 11-2 0 1 1 0 012 0zm-.25-5.25a.75.75 0 00-1.5 0v2.5a.75.75 0 001.5 0v-2.5z"></path></svg>
|
||||
No recent posts
|
||||
</div>
|
||||
<% } %>
|
||||
</div>
|
||||
<% } %>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
<% } %>
|
||||
20
source/templates/repository/partials/screenshot.ejs
Normal file
20
source/templates/repository/partials/screenshot.ejs
Normal file
@@ -0,0 +1,20 @@
|
||||
<% if (plugins.screenshot) { %>
|
||||
<section>
|
||||
<h2 class="field">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M15 3H7c0-.55-.45-1-1-1H2c-.55 0-1 .45-1 1-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h14c.55 0 1-.45 1-1V4c0-.55-.45-1-1-1zM6 5H2V4h4v1zm4.5 7C8.56 12 7 10.44 7 8.5S8.56 5 10.5 5 14 6.56 14 8.5 12.44 12 10.5 12zM13 8.5c0 1.38-1.13 2.5-2.5 2.5S8 9.87 8 8.5 9.13 6 10.5 6 13 7.13 13 8.5z"></path></svg>
|
||||
<%= plugins.screenshot.title %>
|
||||
</h2>
|
||||
<div class="row">
|
||||
<section class="row center">
|
||||
<% if (plugins.screenshot.error) { %>
|
||||
<div class="field error">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M2.343 13.657A8 8 0 1113.657 2.343 8 8 0 012.343 13.657zM6.03 4.97a.75.75 0 00-1.06 1.06L6.94 8 4.97 9.97a.75.75 0 101.06 1.06L8 9.06l1.97 1.97a.75.75 0 101.06-1.06L9.06 8l1.97-1.97a.75.75 0 10-1.06-1.06L8 6.94 6.03 4.97z"></path></svg>
|
||||
<%= plugins.screenshot.error.message %>
|
||||
</div>
|
||||
<% } else { %>
|
||||
<img class="screenshot autosize" src="<%= plugins.screenshot.image %>" height="<%= plugins.screenshot.height %>" width="<%= plugins.screenshot.width %>" alt=""/>
|
||||
<% } %>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
<% } %>
|
||||
60
source/templates/repository/partials/sponsors.ejs
Normal file
60
source/templates/repository/partials/sponsors.ejs
Normal file
@@ -0,0 +1,60 @@
|
||||
<% if (plugins.sponsors) { %>
|
||||
<section>
|
||||
<h2 class="field">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M4.25 2.5c-1.336 0-2.75 1.164-2.75 3 0 2.15 1.58 4.144 3.365 5.682A20.565 20.565 0 008 13.393a20.561 20.561 0 003.135-2.211C12.92 9.644 14.5 7.65 14.5 5.5c0-1.836-1.414-3-2.75-3-1.373 0-2.609.986-3.029 2.456a.75.75 0 01-1.442 0C6.859 3.486 5.623 2.5 4.25 2.5zM8 14.25l-.345.666-.002-.001-.006-.003-.018-.01a7.643 7.643 0 01-.31-.17 22.075 22.075 0 01-3.434-2.414C2.045 10.731 0 8.35 0 5.5 0 2.836 2.086 1 4.25 1 5.797 1 7.153 1.802 8 3.02 8.847 1.802 10.203 1 11.75 1 13.914 1 16 2.836 16 5.5c0 2.85-2.045 5.231-3.885 6.818a22.08 22.08 0 01-3.744 2.584l-.018.01-.006.003h-.002L8 14.25zm0 0l.345.666a.752.752 0 01-.69 0L8 14.25z"></path></svg>
|
||||
Sponsor me!
|
||||
</h2>
|
||||
<% if (plugins.sponsors.error) { %>
|
||||
<div class="row fill-width">
|
||||
<section>
|
||||
<div class="field error">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M2.343 13.657A8 8 0 1113.657 2.343 8 8 0 012.343 13.657zM6.03 4.97a.75.75 0 00-1.06 1.06L6.94 8 4.97 9.97a.75.75 0 101.06 1.06L8 9.06l1.97 1.97a.75.75 0 101.06-1.06L9.06 8l1.97-1.97a.75.75 0 10-1.06-1.06L8 6.94 6.03 4.97z"></path></svg>
|
||||
<%= plugins.sponsors.error.message %>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<% } else { %>
|
||||
<% for (const section of plugins.sponsors.sections) { %>
|
||||
<% if ((section === "goal")&&(plugins.sponsors.goal)) { %>
|
||||
<div class="fill-width">
|
||||
<section class="sponsors goal">
|
||||
<div class="markdown">
|
||||
<%= plugins.sponsors.goal.description %>
|
||||
</div>
|
||||
<% { const width = 440 * (1 + large) %>
|
||||
<div class="center horizontal-wrap ">
|
||||
<svg class="bar" xmlns="http://www.w3.org/2000/svg" width="<%= width %>" height="8">
|
||||
<mask id="project-bar">
|
||||
<rect x="0" y="0" width="<%= width %>" height="8" fill="white" rx="5"/>
|
||||
</mask>
|
||||
<rect mask="url(#project-bar)" x="0" y="0" width="<%= (plugins.sponsors.goal.progress/100)*width %>" height="8" fill="#ec6cb9"/>
|
||||
<rect mask="url(#project-bar)" x="<%= (plugins.sponsors.goal.progress/100)*width %>" y="0" width="<%= ((100-plugins.sponsors.goal.progress)/100)*width %>" height="8" fill="#d1d5da"/>
|
||||
</svg>
|
||||
</div>
|
||||
<% } %>
|
||||
<div class="goal-text">
|
||||
<span>
|
||||
<% if (plugins.sponsors.count) { %>
|
||||
<%= plugins.sponsors.count %> sponsor<%= plugins.sponsors.count !== 1 ? "s are" : " is" %> funding <%= user.login %>'s work
|
||||
<% } %>
|
||||
</span>
|
||||
<span><%= plugins.sponsors.goal.title %></span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<% for (const user of plugins.sponsors.list) { %><img class="avatar" src="<%= user.avatar %>" width="24" height="24" alt="" /><% } %>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<% } else if (section === "about") { %>
|
||||
<div class="row fill-width">
|
||||
<section class="sponsors">
|
||||
<div class="markdown">
|
||||
<%- plugins.sponsors.about %>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<% } %>
|
||||
<% } %>
|
||||
<% } %>
|
||||
</section>
|
||||
<% } %>
|
||||
48
source/templates/repository/partials/stock.ejs
Normal file
48
source/templates/repository/partials/stock.ejs
Normal file
@@ -0,0 +1,48 @@
|
||||
<% if (plugins.stock) { %>
|
||||
<section>
|
||||
<h2 class="field">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M10.75 9a.75.75 0 000 1.5h1.5a.75.75 0 000-1.5h-1.5z"></path><path fill-rule="evenodd" d="M0 3.75C0 2.784.784 2 1.75 2h12.5c.966 0 1.75.784 1.75 1.75v8.5A1.75 1.75 0 0114.25 14H1.75A1.75 1.75 0 010 12.25v-8.5zm14.5 0V5h-13V3.75a.25.25 0 01.25-.25h12.5a.25.25 0 01.25.25zm0 2.75h-13v5.75c0 .138.112.25.25.25h12.5a.25.25 0 00.25-.25V6.5z"></path></svg>
|
||||
Stock prices <%= plugins.stock.symbol ? `for ${plugins.stock.symbol}` : "" %>
|
||||
</h2>
|
||||
<% if (plugins.stock.error) { %>
|
||||
<div class="row fill-width">
|
||||
<section>
|
||||
<div class="field error">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M2.343 13.657A8 8 0 1113.657 2.343 8 8 0 012.343 13.657zM6.03 4.97a.75.75 0 00-1.06 1.06L6.94 8 4.97 9.97a.75.75 0 101.06 1.06L8 9.06l1.97 1.97a.75.75 0 101.06-1.06L9.06 8l1.97-1.97a.75.75 0 10-1.06-1.06L8 6.94 6.03 4.97z"></path></svg>
|
||||
<%= plugins.stock.error.message %>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<% } else { %>
|
||||
<div class="row">
|
||||
<section>
|
||||
<div class="field">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M1.5 14.25c0 .138.112.25.25.25H4v-1.25a.75.75 0 01.75-.75h2.5a.75.75 0 01.75.75v1.25h2.25a.25.25 0 00.25-.25V1.75a.25.25 0 00-.25-.25h-8.5a.25.25 0 00-.25.25v12.5zM1.75 16A1.75 1.75 0 010 14.25V1.75C0 .784.784 0 1.75 0h8.5C11.216 0 12 .784 12 1.75v12.5c0 .085-.006.168-.018.25h2.268a.25.25 0 00.25-.25V8.285a.25.25 0 00-.111-.208l-1.055-.703a.75.75 0 11.832-1.248l1.055.703c.487.325.779.871.779 1.456v5.965A1.75 1.75 0 0114.25 16h-3.5a.75.75 0 01-.197-.026c-.099.017-.2.026-.303.026h-3a.75.75 0 01-.75-.75V14h-1v1.25a.75.75 0 01-.75.75h-3zM3 3.75A.75.75 0 013.75 3h.5a.75.75 0 010 1.5h-.5A.75.75 0 013 3.75zM3.75 6a.75.75 0 000 1.5h.5a.75.75 0 000-1.5h-.5zM3 9.75A.75.75 0 013.75 9h.5a.75.75 0 010 1.5h-.5A.75.75 0 013 9.75zM7.75 9a.75.75 0 000 1.5h.5a.75.75 0 000-1.5h-.5zM7 6.75A.75.75 0 017.75 6h.5a.75.75 0 010 1.5h-.5A.75.75 0 017 6.75zM7.75 3a.75.75 0 000 1.5h.5a.75.75 0 000-1.5h-.5z"></path></svg>
|
||||
<%= plugins.stock.company %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M6 2a.75.75 0 01.696.471L10 10.731l1.304-3.26A.75.75 0 0112 7h3.25a.75.75 0 010 1.5h-2.742l-1.812 4.528a.75.75 0 01-1.392 0L6 4.77 4.696 8.03A.75.75 0 014 8.5H.75a.75.75 0 010-1.5h2.742l1.812-4.529A.75.75 0 016 2z"></path></svg>
|
||||
Valued at <%= plugins.stock.price.toFixed(2) %> <%= plugins.stock.currency %>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<div class="field">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M4.75 0a.75.75 0 01.75.75V2h5V.75a.75.75 0 011.5 0V2h1.25c.966 0 1.75.784 1.75 1.75v10.5A1.75 1.75 0 0113.25 16H2.75A1.75 1.75 0 011 14.25V3.75C1 2.784 1.784 2 2.75 2H4V.75A.75.75 0 014.75 0zm0 3.5h8.5a.25.25 0 01.25.25V6h-11V3.75a.25.25 0 01.25-.25h2zm-2.25 4v6.75c0 .138.112.25.25.25h10.5a.25.25 0 00.25-.25V7.5h-11z"></path></svg>
|
||||
<%= {"1d":"Today", "5d":"Last five days", "1mo":"Last month", "3mo":"Last trimester", "6mo":"Last semester", "1y":"Last year", "2y":"Last two years", "5y":"Last five years", "10y":"Last ten years", ytd:"Year to date", max:"All-time"}[plugins.stock.duration] %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<% if (plugins.stock.delta > 0) { %>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M3.47 7.78a.75.75 0 010-1.06l4.25-4.25a.75.75 0 011.06 0l4.25 4.25a.75.75 0 01-1.06 1.06L9 4.81v7.44a.75.75 0 01-1.5 0V4.81L4.53 7.78a.75.75 0 01-1.06 0z"></path></svg>
|
||||
<% } else { %>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M13.03 8.22a.75.75 0 010 1.06l-4.25 4.25a.75.75 0 01-1.06 0L3.47 9.28a.75.75 0 011.06-1.06l2.97 2.97V3.75a.75.75 0 011.5 0v7.44l2.97-2.97a.75.75 0 011.06 0z"></path></svg>
|
||||
<% } %>
|
||||
<%= f(plugins.stock.delta, {sign:true, fixed:2}) %> <%= plugins.stock.currency %> (<%= f(100*plugins.stock.delta/plugins.stock.price, {sign:true, fixed:2}) %>%)
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<div class="stock-chart">
|
||||
<%- plugins.stock.chart %>
|
||||
</div>
|
||||
<% } %>
|
||||
</section>
|
||||
<% } %>
|
||||
@@ -4,5 +4,7 @@
|
||||
"base.repositories",
|
||||
"gists",
|
||||
"languages",
|
||||
"pagespeed"
|
||||
"pagespeed",
|
||||
"isocalendar",
|
||||
"screenshot"
|
||||
]
|
||||
7
source/templates/terminal/partials/isocalendar.ejs
Normal file
7
source/templates/terminal/partials/isocalendar.ejs
Normal file
@@ -0,0 +1,7 @@
|
||||
<% if (plugins.isocalendar) { %>
|
||||
<div class="stdin"><%- meta.$ %> ncal -MB<%= {"half-year":5, "full-year":11}[plugins.isocalendar.duration] %></div><%# -%>
|
||||
<div class="stdout"><%# -%><div class="isocalendar"><%- plugins.isocalendar.svg %></div>
|
||||
<b><%= `${plugins.isocalendar.streak.current}`.padStart(5) %></b> consecutive day<%= s(plugins.isocalendar.streak.current) %> with commits
|
||||
<b><%= `~${plugins.isocalendar.average}`.padStart(5) %></b> commits per day in average
|
||||
</div>
|
||||
<% } %>
|
||||
4
source/templates/terminal/partials/screenshot.ejs
Normal file
4
source/templates/terminal/partials/screenshot.ejs
Normal file
@@ -0,0 +1,4 @@
|
||||
<% if (plugins.screenshot) { %>
|
||||
<div class="stdin"><%- meta.$ %> wget <%= plugins.screenshot.url %></div><%# -%>
|
||||
<div class="stdout"><%# -%><img class="screenshot autosize" src="<%= plugins.screenshot.image %>" height="<%= plugins.screenshot.height %>" width="<%= plugins.screenshot.width %>" alt=""/></div>
|
||||
<% } %>
|
||||
@@ -63,6 +63,22 @@
|
||||
color: #AE9DA7;
|
||||
}
|
||||
|
||||
/* Isocalendar */
|
||||
.isocalendar svg {
|
||||
margin-top: -20px !important;
|
||||
}
|
||||
|
||||
/* Images */
|
||||
.isocalendar svg, .screenshot {
|
||||
filter: grayscale(1) brightness(.9) opacity(.7);
|
||||
}
|
||||
|
||||
/* Autosize */
|
||||
.autosize {
|
||||
width: auto;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/* Prompt */
|
||||
.ps1-path {
|
||||
color: #7EDA29;
|
||||
|
||||
Reference in New Issue
Block a user