Skip to content

Commit 3fa633a

Browse files
committed
script to help preparing new newswletters
1 parent 8e0cc6a commit 3fa633a

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

newsletter-template.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
+++
2-
title = "This Month in Rust GameDev #{TODO} - {TODO} {TODO}"
2+
title = "This Month in Rust GameDev #{TODO_id} - {TODO_month} {TODO_day}"
33
transparent = true
4-
date = TODO
4+
date = {TODO_date}
55
draft = true
66
+++
77

88
<!-- no toc -->
99

1010
<!-- Check the post with markdownlint-->
1111

12-
Welcome to the {TODO}th issue of the Rust GameDev Workgroup's
12+
Welcome to the {TODO_id}th issue of the Rust GameDev Workgroup's
1313
monthly newsletter.
1414
[Rust] is a systems language pursuing the trifecta:
1515
safety, concurrency, and speed.
@@ -35,8 +35,8 @@ Feel free to send PRs about your own projects!
3535
- [Learning Material Updates](#learning-material-updates)
3636
- [Tooling Updates](#tooling-updates)
3737
- [Library Updates](#library-updates)
38-
- [Other News](#other-news)
3938
- [Popular Workgroup Issues in Github](#popular-workgroup-issues-in-github)
39+
- [Other News](#other-news)
4040
- [Meeting Minutes](#meeting-minutes)
4141
- [Discussions](#discussions)
4242
- [Requests for Contribution](#requests-for-contribution)

scripts/prepare_newsletter.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
3+
# This scripts parses existing news, and copies the newsletter template
4+
# alongside the others, with its incremented id number.
5+
# This script also replaces the TODOs related to the news id number.
6+
7+
read -r -d '\n' -a news <<< `find content/news/ -type d -printf "%f\n"`
8+
9+
last_news=`echo ${news[-1]} | sed -r s/0//`
10+
echo $last_news
11+
news_to_create_simple=$((last_news+1))
12+
news_to_create=`printf "%#03s" $news_to_create_simple`
13+
14+
read -e -p "Do you want to create issue $news_to_create? (y/n): " choice
15+
16+
[[ "$choice" != [Yy]* ]] && exit
17+
18+
echo "accepted"
19+
20+
new_file="content/news/$news_to_create/index.md"
21+
22+
mkdir -p content/news/$news_to_create && cp -r newsletter-template.md $new_file
23+
24+
sed -i 's/{TODO_id}/'$news_to_create_simple'/g' $new_file

0 commit comments

Comments
 (0)