shoreditch 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,102 @@
1
+ /*
2
+ * Shoreditch's only script: the light/dark toggle.
3
+ *
4
+ * Shipped as a static file through the gem's source manifest, so consuming
5
+ * sites do not have to import anything into their esbuild entry points.
6
+ *
7
+ * The initial theme is applied by a small inline script in the <head> so it
8
+ * lands before first paint; this file only handles clicks afterwards.
9
+ */
10
+ (function () {
11
+ "use strict";
12
+
13
+ var STORAGE_KEY = "shoreditch-theme";
14
+
15
+ function systemTheme() {
16
+ return window.matchMedia("(prefers-color-scheme: dark)").matches
17
+ ? "dark"
18
+ : "light";
19
+ }
20
+
21
+ function currentTheme() {
22
+ return document.documentElement.dataset.theme || systemTheme();
23
+ }
24
+
25
+ function apply(theme) {
26
+ document.documentElement.dataset.theme = theme;
27
+ try {
28
+ localStorage.setItem(STORAGE_KEY, theme);
29
+ } catch (e) {
30
+ /* Private browsing, quota, or storage disabled — the toggle still works
31
+ for this page view, it just will not be remembered. */
32
+ }
33
+ }
34
+
35
+ function label(button, theme) {
36
+ var next = theme === "dark" ? "light" : "dark";
37
+ button.setAttribute("aria-label", "Switch to " + next + " theme");
38
+ button.textContent = next === "dark" ? "Dark theme" : "Light theme";
39
+ }
40
+
41
+ /* The Giscus iframe loads with the OS preference and cannot see our toggle,
42
+ so it would sit light on a dark page. Its postMessage API is the only way
43
+ to change it after load. No-op when there is no comment thread. */
44
+ function syncComments(theme) {
45
+ var frame = document.querySelector("iframe.giscus-frame");
46
+ if (!frame || !frame.contentWindow) return;
47
+ frame.contentWindow.postMessage(
48
+ { giscus: { setConfig: { theme: theme } } },
49
+ "https://giscus.app"
50
+ );
51
+ }
52
+
53
+ /* The contact panel ships the address in two halves so it never appears
54
+ whole in the HTML. Joining them here is the only place it exists complete,
55
+ which is the trade the Jekyll version made with document.write. */
56
+ function revealEmail() {
57
+ document.querySelectorAll(".sd-email").forEach(function (link) {
58
+ var user = link.dataset.sdEmailUser;
59
+ var host = link.dataset.sdEmailHost;
60
+ if (!user || !host) return;
61
+ link.href = "mailto:" + user + host;
62
+ link.hidden = false;
63
+ });
64
+ }
65
+
66
+ document.addEventListener("DOMContentLoaded", function () {
67
+ revealEmail();
68
+
69
+ var buttons = document.querySelectorAll("[data-shoreditch-theme-toggle]");
70
+ if (!buttons.length) return;
71
+
72
+ buttons.forEach(function (button) {
73
+ label(button, currentTheme());
74
+
75
+ button.addEventListener("click", function () {
76
+ var next = currentTheme() === "dark" ? "light" : "dark";
77
+ apply(next);
78
+ syncComments(next);
79
+ buttons.forEach(function (b) {
80
+ label(b, next);
81
+ });
82
+ });
83
+ });
84
+
85
+ // Follow the OS while the reader has not made an explicit choice.
86
+ window
87
+ .matchMedia("(prefers-color-scheme: dark)")
88
+ .addEventListener("change", function () {
89
+ var stored;
90
+ try {
91
+ stored = localStorage.getItem(STORAGE_KEY);
92
+ } catch (e) {
93
+ stored = null;
94
+ }
95
+ if (!stored) {
96
+ buttons.forEach(function (b) {
97
+ label(b, systemTheme());
98
+ });
99
+ }
100
+ });
101
+ });
102
+ })();
@@ -0,0 +1,89 @@
1
+ <!doctype html>
2
+ <html lang="<%= site.locale %>">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+
7
+ <% page_title = strip_html(strip_newlines(data.title.to_s)) %>
8
+ <%# Prototype pages all share one front-matter title, so every generated
9
+ tag page was called "Tagged". The term the page was generated for
10
+ distinguishes them. %>
11
+ <% page_title = "#{page_title}: #{data.tag}" if data.tag %>
12
+ <title><%= page_title.empty? ? "#{site.metadata.title}: #{site.metadata.tagline}" : "#{page_title} | #{site.metadata.title}" %></title>
13
+
14
+ <% description = data.description || site.metadata.description %>
15
+ <meta name="description" content="<%= strip_html(description.to_s).strip %>" />
16
+
17
+ <meta property="og:title" content="<%= page_title.empty? ? site.metadata.title : page_title %>" />
18
+ <meta property="og:description" content="<%= strip_html(description.to_s).strip %>" />
19
+ <%# Paginated index pages are PaginationPage, which has no #collection. %>
20
+ <% is_post = resource.respond_to?(:collection) && resource.collection&.label == "posts" %>
21
+ <meta property="og:type" content="<%= is_post ? "article" : "website" %>" />
22
+ <% if data.cover %>
23
+ <meta property="og:image" content="<%= data.cover %>" />
24
+ <% end %>
25
+ <meta name="twitter:card" content="<%= data.cover ? "summary_large_image" : "summary" %>" />
26
+
27
+ <%# Set `noindex: true` in front matter, or from a Roda route's
28
+ render_with, to keep a page out of search results. %>
29
+ <% if data.noindex %>
30
+ <meta name="robots" content="noindex, nofollow" />
31
+ <% end %>
32
+
33
+ <link rel="alternate" type="application/atom+xml" href="/feed.xml" title="<%= site.metadata.title %>" />
34
+
35
+ <%# Both ship with the gem via the source manifest, so a consuming site
36
+ needs no esbuild wiring to get the theme's styles or its toggle. %>
37
+ <link rel="stylesheet" href="/shoreditch/shoreditch.css" />
38
+ <script src="/shoreditch/shoreditch.js" defer></script>
39
+
40
+ <%# The accent option is applied here rather than in the stylesheet, which
41
+ ships as a static file and so cannot know a site's configuration. After
42
+ the theme's CSS so it overrides the default, and before the site's own
43
+ bundle so the site still has the last word. %>
44
+ <style>:root { --sd-accent: <%= Shoreditch.css_colour(site.config.shoreditch[:accent]) %>; }</style>
45
+
46
+ <%# The site's own bundle loads afterwards and therefore overrides. %>
47
+ <link rel="stylesheet" href="<%= asset_path :css %>" />
48
+ <script src="<%= asset_path :js %>" defer></script>
49
+ <%= live_reload_dev_js %>
50
+
51
+ <%# Inline and render-blocking on purpose: applies the stored preference
52
+ before first paint, so there is no flash of the wrong scheme. %>
53
+ <script>
54
+ (function () {
55
+ try {
56
+ var stored = localStorage.getItem("shoreditch-theme");
57
+ if (stored === "light" || stored === "dark") {
58
+ document.documentElement.dataset.theme = stored;
59
+ }
60
+ } catch (e) {}
61
+ })();
62
+ </script>
63
+
64
+ <%= render Shoreditch::HeadIcons.new(site: site) %>
65
+ </head>
66
+
67
+ <%# `data.class` here called Ruby's Object#class, putting
68
+ "HashWithDotAccess::Hash" on every page. The front matter key is read
69
+ with [] instead. The layout name is slash-separated, which is not a
70
+ usable CSS class, so it is hyphenated. %>
71
+ <% body_classes = [data.layout.to_s.tr("/", "-"), data[:class].to_s].reject(&:empty?) %>
72
+ <body class="<%= body_classes.join(" ") %>">
73
+ <a class="sd-skip-link" href="#sd-content">Skip to content</a>
74
+
75
+ <div class="sd-shell" data-sidebar="<%= site.config.shoreditch[:sidebar_side] %>">
76
+ <%= render Shoreditch::Sidebar.new(site: site, resource: resource) %>
77
+
78
+ <main class="sd-main">
79
+ <% if data.cover %>
80
+ <img class="sd-cover" src="<%= data.cover %>" alt="" />
81
+ <% end %>
82
+
83
+ <div class="sd-content" id="sd-content">
84
+ <%= yield %>
85
+ </div>
86
+ </main>
87
+ </div>
88
+ </body>
89
+ </html>
@@ -0,0 +1,27 @@
1
+ ---
2
+ layout: shoreditch/default
3
+ ---
4
+
5
+ <article class="sd-page">
6
+ <% if data.title %>
7
+ <h1><%= data.title %></h1>
8
+ <% end %>
9
+
10
+ <%= yield %>
11
+ </article>
12
+
13
+ <% if data.credits&.any? %>
14
+ <footer class="sd-credits">
15
+ <% data.credits.each do |credit| %>
16
+ <p>
17
+ <%= credit["label"] %>:
18
+ <% if credit["via_link"] %>
19
+ <a href="<%= credit["via_link"] %>" rel="noopener"><%= credit["name"] %></a>
20
+ <% else %>
21
+ <%= credit["name"] %>
22
+ <% end %>
23
+ <%= credit["via"] %>
24
+ </p>
25
+ <% end %>
26
+ </footer>
27
+ <% end %>
@@ -0,0 +1,72 @@
1
+ ---
2
+ layout: shoreditch/default
3
+ ---
4
+
5
+ <article class="sd-post">
6
+ <header class="sd-post-header">
7
+ <h1 class="sd-post-title"><%= data.title %></h1>
8
+
9
+ <p class="sd-post-dates">
10
+ <span>
11
+ Posted
12
+ <time datetime="<%= resource.date.strftime("%Y-%m-%d") %>">
13
+ <%= resource.date.strftime("%-d %B %Y") %>
14
+ </time>
15
+ </span>
16
+
17
+ <%# last_updated and last_verified let a technical post say how stale it
18
+ is likely to be — the reason the original theme had them. %>
19
+ <% if data.last_updated %>
20
+ <span>Updated <time datetime="<%= data.last_updated %>"><%= data.last_updated %></time></span>
21
+ <% end %>
22
+
23
+ <% if data.last_verified %>
24
+ <span>Verified <time datetime="<%= data.last_verified %>"><%= data.last_verified %></time></span>
25
+ <% end %>
26
+ </p>
27
+ </header>
28
+
29
+ <%= yield %>
30
+ </article>
31
+
32
+ <% if data.tags&.any? %>
33
+ <nav class="sd-tags" aria-label="Tags">
34
+ <% data.tags.each do |tag| %>
35
+ <a class="sd-tag" href="/tag/<%= tag %>/"><%= tag %></a>
36
+ <% end %>
37
+ </nav>
38
+ <% end %>
39
+
40
+ <% if data.related_posts&.any? %>
41
+ <aside class="sd-related">
42
+ <h2>Related posts</h2>
43
+ <ul>
44
+ <% data.related_posts.each do |post| %>
45
+ <li>
46
+ <a href="<%= post.relative_url %>"><%= post.data.title %></a>
47
+ <time datetime="<%= post.date.strftime("%Y-%m-%d") %>">
48
+ <%= post.date.strftime("%-d %B %Y") %>
49
+ </time>
50
+ </li>
51
+ <% end %>
52
+ </ul>
53
+ </aside>
54
+ <% end %>
55
+
56
+ <%= render Shoreditch::Comments.new(site: site, resource: resource) %>
57
+
58
+ <% if data.credits&.any? %>
59
+ <footer class="sd-credits">
60
+ <% data.credits.each do |credit| %>
61
+ <p>
62
+ <%= credit["label"] %>:
63
+ <% if credit["via_link"] %>
64
+ <a href="<%= credit["via_link"] %>" rel="noopener"><%= credit["name"] %></a>
65
+ <% else %>
66
+ <%= credit["name"] %>
67
+ <% end %>
68
+ <%= credit["via"] %>
69
+ </p>
70
+ <% end %>
71
+ </footer>
72
+ <% end %>
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Inline SVG path data for the sidebar's contact panel.
4
+ #
5
+ # Brand marks are from Simple Icons (https://simpleicons.org), CC0 1.0.
6
+ # They are vendored rather than pulled from a CDN so the theme keeps its
7
+ # no-external-dependency promise — the 0.9.0 version loaded a Font Awesome
8
+ # kit over the network on every page.
9
+ #
10
+ # `link` is the fallback for any network with no bundled mark. LinkedIn uses
11
+ # it: Simple Icons removed that mark at the trademark holder's request, and
12
+ # shipping a lookalike would raise the same problem.
13
+ #
14
+ # email, phone, file and link are drawn here — plain geometry, no marks.
15
+ module Shoreditch
16
+ ICONS = {
17
+ artstation: "M0 17.723l2.027 3.505h.001a2.424 2.424 0 0 0 2.164 1.333h13.457l-2.792-4.838H0zm24 .025c0-.484-.143-.935-.388-1.314L15.728 2.728a2.424 2.424 0 0 0-2.142-1.289H9.419L21.598 22.54l1.92-3.325c.378-.637.482-.919.482-1.467zm-11.129-3.462L7.428 4.858l-5.444 9.428h10.887z",
18
+ deviantart: "M19.207 4.794l.23-.43V0H15.07l-.436.44-2.058 3.925-.646.436H4.58v5.993h4.04l.36.436-4.175 7.98-.24.43V24H8.93l.436-.44 2.07-3.925.644-.436h7.35v-5.993h-4.05l-.36-.438 4.186-7.977z",
19
+ email: "M1.5 4.5h21v15h-21v-15zm1.8 1.8v.3l8.7 6 8.7-6v-.3H3.3zm17.4 3.1-7.9 5.4a1.5 1.5 0 0 1-1.6 0L3.3 9.4v8.3h17.4V9.4z",
20
+ file: "M5 1.5h9.2L19 6.3v16.2H5V1.5zm1.8 1.8v17.4h10.4V7.9h-4V3.3H6.8zm5.8.9v2.9h2.9l-2.9-2.9z",
21
+ github: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12",
22
+ instagram: "M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228 1.3877-.6652.6677-1.075 1.3368-1.3802 2.127-.2954.7638-.4956 1.6365-.552 2.914-.0564 1.2775-.0689 1.6882-.0626 4.947.0062 3.2586.0206 3.6671.0825 4.9473.061 1.2765.264 2.1482.5635 2.9107.308.7889.72 1.4573 1.388 2.1228.6679.6655 1.3365 1.0743 2.1285 1.38.7632.295 1.6361.4961 2.9134.552 1.2773.056 1.6884.069 4.9462.0627 3.2578-.0062 3.668-.0207 4.9478-.0814 1.28-.0607 2.147-.2652 2.9098-.5633.7889-.3086 1.4578-.72 2.1228-1.3881.665-.6682 1.0745-1.3378 1.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982 1.33 20.628.9208 19.8378.6165 19.074.321 18.2017.1197 16.9244.0645 15.6471.0093 15.236-.005 11.977.0014 8.718.0076 8.31.0215 7.0301.0839m.1402 21.6932c-1.17-.0509-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.05-1.169.2456-1.805.408-2.2282.216-.5613.4762-.96.895-1.3816.4188-.4217.8184-.6814 1.3783-.9003.423-.1651 1.0575-.3614 2.227-.4171 1.2655-.06 1.6447-.072 4.848-.079 3.2033-.007 3.5835.005 4.8495.0608 1.169.0508 1.8053.2445 2.228.408.5608.216.96.4754 1.3816.895.4217.4194.6816.8176.9005 1.3787.1653.4217.3617 1.056.4169 2.2263.0602 1.2655.0739 1.645.0796 4.848.0058 3.203-.0055 3.5834-.061 4.848-.051 1.17-.245 1.8055-.408 2.2294-.216.5604-.4763.96-.8954 1.3814-.419.4215-.8181.6811-1.3783.9-.4224.1649-1.0577.3617-2.2262.4174-1.2656.0595-1.6448.072-4.8493.079-3.2045.007-3.5825-.006-4.848-.0608M16.953 5.5864A1.44 1.44 0 1 0 18.39 4.144a1.44 1.44 0 0 0-1.437 1.4424M5.8385 12.012c.0067 3.4032 2.7706 6.1557 6.173 6.1493 3.4026-.0065 6.157-2.7701 6.1506-6.1733-.0065-3.4032-2.771-6.1565-6.174-6.1498-3.403.0067-6.156 2.771-6.1496 6.1738M8 12.0077a4 4 0 1 1 4.008 3.9921A3.9996 3.9996 0 0 1 8 12.0077",
23
+ lastfm: "M10.584 17.21l-.88-2.392s-1.43 1.594-3.573 1.594c-1.897 0-3.244-1.649-3.244-4.288 0-3.382 1.704-4.591 3.381-4.591 2.42 0 3.189 1.567 3.849 3.574l.88 2.749c.88 2.666 2.529 4.81 7.285 4.81 3.409 0 5.718-1.044 5.718-3.793 0-2.227-1.265-3.381-3.63-3.931l-1.758-.385c-1.21-.275-1.567-.77-1.567-1.595 0-.934.742-1.484 1.952-1.484 1.32 0 2.034.495 2.144 1.677l2.749-.33c-.22-2.474-1.924-3.492-4.729-3.492-2.474 0-4.893.935-4.893 3.932 0 1.87.907 3.051 3.189 3.601l1.87.44c1.402.33 1.869.907 1.869 1.704 0 1.017-.99 1.43-2.86 1.43-2.776 0-3.93-1.457-4.59-3.464l-.907-2.75c-1.155-3.573-2.997-4.893-6.653-4.893C2.144 5.333 0 7.89 0 12.233c0 4.18 2.144 6.434 5.993 6.434 3.106 0 4.591-1.457 4.591-1.457z",
24
+ link: "M10.6 13.4a5 5 0 0 0 7.1 0l3-3a5 5 0 0 0-7.1-7.1l-1.7 1.7 1.4 1.4 1.7-1.7a3 3 0 0 1 4.3 4.3l-3 3a3 3 0 0 1-4.3 0l-1.4 1.4zm2.8-2.8a5 5 0 0 0-7.1 0l-3 3a5 5 0 0 0 7.1 7.1l1.7-1.7-1.4-1.4-1.7 1.7a3 3 0 0 1-4.3-4.3l3-3a3 3 0 0 1 4.3 0l1.4-1.4z",
25
+ mastodon: "M23.268 5.313c-.35-2.578-2.617-4.61-5.304-5.004C17.51.242 15.792 0 11.813 0h-.03c-3.98 0-4.835.242-5.288.309C3.882.692 1.496 2.518.917 5.127.64 6.412.61 7.837.661 9.143c.074 1.874.088 3.745.26 5.611.118 1.24.325 2.47.62 3.68.55 2.237 2.777 4.098 4.96 4.857 2.336.792 4.849.923 7.256.38.265-.061.527-.132.786-.213.585-.184 1.27-.39 1.774-.753a.057.057 0 0 0 .023-.043v-1.809a.052.052 0 0 0-.02-.041.053.053 0 0 0-.046-.01 20.282 20.282 0 0 1-4.709.545c-2.73 0-3.463-1.284-3.674-1.818a5.593 5.593 0 0 1-.319-1.433.053.053 0 0 1 .066-.054c1.517.363 3.072.546 4.632.546.376 0 .75 0 1.125-.01 1.57-.044 3.224-.124 4.768-.422.038-.008.077-.015.11-.024 2.435-.464 4.753-1.92 4.989-5.604.008-.145.03-1.52.03-1.67.002-.512.167-3.63-.024-5.545zm-3.748 9.195h-2.561V8.29c0-1.309-.55-1.976-1.67-1.976-1.23 0-1.846.79-1.846 2.35v3.403h-2.546V8.663c0-1.56-.617-2.35-1.848-2.35-1.112 0-1.668.668-1.67 1.977v6.218H4.822V8.102c0-1.31.337-2.35 1.011-3.12.696-.77 1.608-1.164 2.74-1.164 1.311 0 2.302.5 2.962 1.498l.638 1.06.638-1.06c.66-.999 1.65-1.498 2.96-1.498 1.13 0 2.043.395 2.74 1.164.675.77 1.012 1.81 1.012 3.12z",
26
+ phone: "M7 1.5h10a2 2 0 0 1 2 2v17a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-17a2 2 0 0 1 2-2zm0 1.8a.2.2 0 0 0-.2.2v17a.2.2 0 0 0 .2.2h10a.2.2 0 0 0 .2-.2v-17a.2.2 0 0 0-.2-.2H7zm3.2 15.4h3.6v1.5h-3.6v-1.5z",
27
+ reddit: "M12 0C5.373 0 0 5.373 0 12c0 3.314 1.343 6.314 3.515 8.485l-2.286 2.286C.775 23.225 1.097 24 1.738 24H12c6.627 0 12-5.373 12-12S18.627 0 12 0Zm4.388 3.199c1.104 0 1.999.895 1.999 1.999 0 1.105-.895 2-1.999 2-.946 0-1.739-.657-1.947-1.539v.002c-1.147.162-2.032 1.15-2.032 2.341v.007c1.776.067 3.4.567 4.686 1.363.473-.363 1.064-.58 1.707-.58 1.547 0 2.802 1.254 2.802 2.802 0 1.117-.655 2.081-1.601 2.531-.088 3.256-3.637 5.876-7.997 5.876-4.361 0-7.905-2.617-7.998-5.87-.954-.447-1.614-1.415-1.614-2.538 0-1.548 1.255-2.802 2.803-2.802.645 0 1.239.218 1.712.585 1.275-.79 2.881-1.291 4.64-1.365v-.01c0-1.663 1.263-3.034 2.88-3.207.188-.911.993-1.595 1.959-1.595Zm-8.085 8.376c-.784 0-1.459.78-1.506 1.797-.047 1.016.64 1.429 1.426 1.429.786 0 1.371-.369 1.418-1.385.047-1.017-.553-1.841-1.338-1.841Zm7.406 0c-.786 0-1.385.824-1.338 1.841.047 1.017.634 1.385 1.418 1.385.785 0 1.473-.413 1.426-1.429-.046-1.017-.721-1.797-1.506-1.797Zm-3.703 4.013c-.974 0-1.907.048-2.77.135-.147.015-.241.168-.183.305.483 1.154 1.622 1.964 2.953 1.964 1.33 0 2.47-.81 2.953-1.964.057-.137-.037-.29-.184-.305-.863-.087-1.795-.135-2.769-.135Z",
28
+ tiktok: "M12.525.02c1.31-.02 2.61-.01 3.91-.02.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.05-2.89-.35-4.2-.97-.57-.26-1.1-.59-1.62-.93-.01 2.92.01 5.84-.02 8.75-.08 1.4-.54 2.79-1.35 3.94-1.31 1.92-3.58 3.17-5.91 3.21-1.43.08-2.86-.31-4.08-1.03-2.02-1.19-3.44-3.37-3.65-5.71-.02-.5-.03-1-.01-1.49.18-1.9 1.12-3.72 2.58-4.96 1.66-1.44 3.98-2.13 6.15-1.72.02 1.48-.04 2.96-.04 4.44-.99-.32-2.15-.23-3.02.37-.63.41-1.11 1.04-1.36 1.75-.21.51-.15 1.07-.14 1.61.24 1.64 1.82 3.02 3.5 2.87 1.12-.01 2.19-.66 2.77-1.61.19-.33.4-.67.41-1.06.1-1.79.06-3.57.07-5.36.01-4.03-.01-8.05.02-12.07z",
29
+ x: "M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z",
30
+ youtube: "M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z",
31
+ }.freeze
32
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Shoreditch
4
+ VERSION = "1.1.0"
5
+ end
data/lib/shoreditch.rb ADDED
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bridgetown"
4
+ require "shoreditch/version"
5
+ require "shoreditch/icons"
6
+
7
+ # Shoreditch is a two-column Bridgetown theme aimed at technical blogging.
8
+ #
9
+ # A site opts in with `init :shoreditch` in config/initializers.rb. Everything
10
+ # the theme provides — layouts, components and its stylesheet — arrives through
11
+ # the source manifest below, so `bundle update shoreditch` is enough to take a
12
+ # new version.
13
+ module Shoreditch
14
+ # Defaults a site can override in config/initializers.rb:
15
+ #
16
+ # init :shoreditch do
17
+ # accent "#c7254e"
18
+ # sidebar_side "right"
19
+ # end
20
+ DEFAULTS = {
21
+ # Any CSS colour. Drives links, tag pills and focus rings.
22
+ accent: "#4c7a9c",
23
+ # "left" or "right" — which side the sidebar sits on at desk widths.
24
+ sidebar_side: "left",
25
+ # Shown under the logo. Set to nil to hide the badge entirely.
26
+ logo_legend: nil,
27
+ # "round" or "square".
28
+ logo_shape: "round",
29
+ # "round" or "straight" — the badge under the logo, shaped independently.
30
+ logo_legend_shape: "round",
31
+ # Comments, off by default. A hash of Giscus settings turns them on — see
32
+ # components/shoreditch/comments.rb. Override that component to use any
33
+ # other provider.
34
+ comments: nil,
35
+ }.freeze
36
+
37
+ # A CSS colour we are willing to interpolate into a declaration: hex, an
38
+ # rgb()/hsl() function, or a bare keyword. Deliberately strict — `accent`
39
+ # comes from a site's config and is written straight into a <style> block,
40
+ # so a value containing a brace or semicolon could inject rules of its own.
41
+ CSS_COLOUR = %r{\A(?:
42
+ \#[0-9a-fA-F]{3,8}
43
+ | (?:rgb|hsl)a?\([0-9a-zA-Z.,%\s/+-]*\)
44
+ | [a-zA-Z]+
45
+ )\z}x
46
+
47
+ # Falls back to the default rather than emitting CSS we cannot vouch for.
48
+ def self.css_colour(value, fallback = DEFAULTS[:accent])
49
+ candidate = value.to_s.strip
50
+ candidate.match?(CSS_COLOUR) ? candidate : fallback
51
+ end
52
+ end
53
+
54
+ # @param config [Bridgetown::Configuration::ConfigurationDSL]
55
+ Bridgetown.initializer :shoreditch do |config, **options|
56
+ config.shoreditch ||= {}
57
+ Shoreditch::DEFAULTS.each do |key, value|
58
+ config.shoreditch[key] = options.fetch(key, config.shoreditch[key] || value)
59
+ end
60
+
61
+ # `content` ships the stylesheet as a static file, which is why the theme
62
+ # needs no npm package and no esbuild wiring in the consuming site. The
63
+ # layout links it directly.
64
+ config.source_manifest(
65
+ origin: Shoreditch,
66
+ components: File.expand_path("../components", __dir__),
67
+ layouts: File.expand_path("../layouts", __dir__),
68
+ content: File.expand_path("../content", __dir__)
69
+ )
70
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/shoreditch/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "shoreditch"
7
+ spec.version = Shoreditch::VERSION
8
+ spec.author = "Mark Coleman"
9
+ spec.email = "shoreditch@protected.mehcoleman.com"
10
+ spec.summary = "A two-column Bridgetown theme for technical blogging"
11
+ spec.description = <<~TEXT
12
+ Shoreditch is a Bridgetown theme built for technical writing: a fixed
13
+ sidebar, optional cover images, a content column wide enough for
14
+ 80-character code samples, and light/dark support. Adapted from Mark
15
+ Otto's Hyde theme for Jekyll.
16
+ TEXT
17
+ spec.homepage = "https://github.com/MEHColeman/shoreditch"
18
+ spec.license = "MIT"
19
+
20
+ spec.metadata = {
21
+ "source_code_uri" => "https://github.com/MEHColeman/shoreditch",
22
+ "changelog_uri" => "https://github.com/MEHColeman/shoreditch/blob/master/CHANGELOG.md",
23
+ "homepage_uri" => "https://shoreditch.mehcoleman.com",
24
+ }
25
+
26
+ # `content` is included deliberately: it carries the stylesheet, which the
27
+ # source manifest publishes as a static file. `demo` and `test` are the
28
+ # theme's own development site, `docs` and `scripts` its working notes and
29
+ # tooling — none of them part of the gem.
30
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
31
+ f.match(%r{^(demo|test|scripts?|spec|features|docs)/|^\.git})
32
+ end
33
+ spec.require_paths = ["lib"]
34
+
35
+ spec.required_ruby_version = ">= 3.3"
36
+
37
+ spec.add_dependency "bridgetown", "~> 2.0"
38
+
39
+ spec.add_development_dependency "bundler"
40
+ spec.add_development_dependency "rake", "~> 13.0"
41
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: shoreditch
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Mark Coleman
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: bridgetown
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '2.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '2.0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: bundler
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: rake
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '13.0'
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '13.0'
54
+ description: |
55
+ Shoreditch is a Bridgetown theme built for technical writing: a fixed
56
+ sidebar, optional cover images, a content column wide enough for
57
+ 80-character code samples, and light/dark support. Adapted from Mark
58
+ Otto's Hyde theme for Jekyll.
59
+ email: shoreditch@protected.mehcoleman.com
60
+ executables: []
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - CHANGELOG.md
65
+ - Gemfile
66
+ - LICENSE.md
67
+ - README.md
68
+ - bridgetown.automation.rb
69
+ - components/shoreditch/comments.erb
70
+ - components/shoreditch/comments.rb
71
+ - components/shoreditch/details.erb
72
+ - components/shoreditch/details.rb
73
+ - components/shoreditch/head_icons.erb
74
+ - components/shoreditch/head_icons.rb
75
+ - components/shoreditch/post_summary.erb
76
+ - components/shoreditch/post_summary.rb
77
+ - components/shoreditch/sidebar.erb
78
+ - components/shoreditch/sidebar.rb
79
+ - content/shoreditch/shoreditch.css
80
+ - content/shoreditch/shoreditch.js
81
+ - layouts/shoreditch/default.erb
82
+ - layouts/shoreditch/page.erb
83
+ - layouts/shoreditch/post.erb
84
+ - lib/shoreditch.rb
85
+ - lib/shoreditch/icons.rb
86
+ - lib/shoreditch/version.rb
87
+ - shoreditch.gemspec
88
+ homepage: https://github.com/MEHColeman/shoreditch
89
+ licenses:
90
+ - MIT
91
+ metadata:
92
+ source_code_uri: https://github.com/MEHColeman/shoreditch
93
+ changelog_uri: https://github.com/MEHColeman/shoreditch/blob/master/CHANGELOG.md
94
+ homepage_uri: https://shoreditch.mehcoleman.com
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '3.3'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubygems_version: 3.6.9
110
+ specification_version: 4
111
+ summary: A two-column Bridgetown theme for technical blogging
112
+ test_files: []