Skip to content

Commit 87200eb

Browse files
committed
Update March writing.
1 parent 87d59dd commit 87200eb

File tree

9 files changed

+498
-251
lines changed

9 files changed

+498
-251
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## start "dev server"
44

55
```
6-
npx --yes chokidar-cli "**/*.{erb,json,md,rb}" -c "ruby generate.rb"
6+
npx --yes chokidar-cli "**/*.{erb,json,md,rb,ebr}" -c "ruby generate.rb"
77
```
88

99
## build

_post.html.erb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
<span class="avatar-text-group">
77
By
88
<img
9-
id="avatar-photo"
10-
src="<%= @writing[:author_avatar_url] %>"
11-
/>
12-
<%= @writing[:author] %><%= @writing[:released_at] %><%= @writing[:place] %>
9+
id="avatar-photo"
10+
src="<%= @writing[:author_avatar_url] %>"
11+
/>
12+
<a href="<%= @writing[:author_url] %>" target="_blank"><%= @writing[:author] %></a><%= @writing[:released_at] %><%= @writing[:place] %>
1313
</span>
1414
</p>
1515
</header>

css/writings.css

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
--line-height-base: 1.5;
4848
--gap-base: 1.25rem;
49-
--gap-large: 3.125rem;
49+
--gap-large: 1.125rem;
5050
}
5151

5252
* {
@@ -55,7 +55,7 @@
5555

5656
body {
5757
font-family: var(--font-base);
58-
font-size: 1.125rem;
58+
font-size: 1.3rem;
5959
color: var(--color-text);
6060
background: var(--color-bg);
6161
line-height: 1.5;
@@ -136,7 +136,7 @@ pre {
136136
color: hsl(0, 0%, 40%);
137137
}
138138

139-
.post-meta img {
139+
.post-meta img, img.avatar {
140140
width: 1.5em;
141141
height: 1.5em;
142142
border-radius: 50%;
@@ -145,6 +145,11 @@ pre {
145145
box-shadow: 0 0 0 2px black;
146146
}
147147

148+
img.avatar {
149+
position: relative;
150+
top: 8px;
151+
}
152+
148153
.avatar-text-group {
149154
display: inline-flex;
150155
align-items: center;
@@ -231,3 +236,24 @@ pre {
231236
color: hsl(0, 0%, 40%);
232237
font-size: var(--font-size-meta);
233238
}
239+
240+
hr {
241+
display: flex;
242+
align-items: center;
243+
justify-content: center;
244+
border: 0;
245+
}
246+
hr:before {
247+
content: "";
248+
background: transparent url("../assets/img/divider.svg") no-repeat center;
249+
width: 10.4rem;
250+
height: 2.8rem;
251+
}
252+
253+
ul {
254+
list-style: none; /* hide default bullets */
255+
padding-left: 1.2em; /* space for the arrow */
256+
}
257+
ul li::marker {
258+
content: "→ ";
259+
}

generate.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
require 'bundler/inline'
22

3-
gemfile do
3+
gemfile(true) do
44
gem "json"
55
gem "erb"
66
gem "kramdown"
7+
gem "nokogiri"
78
end
89

910
require 'json'
1011
require 'erb'
1112
require 'date'
1213
require 'fileutils'
1314
require 'kramdown'
15+
require 'nokogiri'
1416

1517
# Load writings.json
1618
writings_data = JSON.parse(File.read('writings.json'))
@@ -27,6 +29,7 @@
2729
slug: w['slug'],
2830
published_at: w['published_at'],
2931
author: w['author'],
32+
author_url: w['author_url'],
3033
author_avatar_url: w['author_avatar_url'],
3134
place: w['place']
3235
}
@@ -59,6 +62,17 @@
5962
# Now inject post content into layout
6063
full_html = ERB.new(layout_template).result(binding)
6164

65+
# Outside links to new window
66+
full_html = Nokogiri::HTML.fragment(full_html).tap do |doc|
67+
doc.css('a').each do |node|
68+
node['href'] ||= '#'
69+
# Add attributes to external links only:
70+
if node['href'] =~ %r{\A(?:\w+:)?//}
71+
node['target'] = '_blank'
72+
node['rel'] = 'nofollow noopener'
73+
end
74+
end
75+
end.to_html
6276
# Write to file
6377
File.write("writings/#{w[:slug]}.html", full_html)
6478
puts "Generated writings/#{w[:slug]}.html"

md/popular-gems-1.md

Lines changed: 147 additions & 47 deletions
Large diffs are not rendered by default.

writings.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ <h1>Latest writings</h1>
6666
<ul class="post-list">
6767

6868
<li>
69-
<a href="writings/popular-gems-1.html">Helping Popular RubyGems Stay Healthy</a>
70-
<time datetime="2025-06-15">June 15, 2025</time>
69+
<a href="writings/2025-03-we-love-ruby-march-2025.html">We ❤️ Ruby — March 2025: Our First Deep Dive into the RubyGems.org Ecosystem</a>
70+
<time datetime="2025-08-11">August 11, 2025</time>
7171
</li>
7272

7373
</ul>

writings.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
[
22
{
33
"source": "md/popular-gems-1.md",
4-
"title": "Helping Popular RubyGems Stay Healthy",
5-
"published_at": "15.6.2025",
6-
"slug": "popular-gems-1",
4+
"title": "We ❤️ Ruby — March 2025: Our First Deep Dive into the RubyGems.org Ecosystem",
5+
"published_at": "11.8.2025",
6+
"slug": "2025-03-we-love-ruby-march-2025",
77
"author": "simi",
88
"author_avatar_url": "https://avatars.githubusercontent.com/u/193936?v=4",
9+
"author_url": "https://github.com/simi",
910
"place": "Praha, Žižkov"
1011
}
1112
]

writings/2025-03-we-love-ruby-march-2025.html

Lines changed: 296 additions & 0 deletions
Large diffs are not rendered by default.

writings/popular-gems-1.html

Lines changed: 0 additions & 190 deletions
This file was deleted.

0 commit comments

Comments
 (0)