Skip to content

Script to help preparing new newswletters #1457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions newsletter-template.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
+++
title = "This Month in Rust GameDev #{TODO} - {TODO} {TODO}"
title = "This Month in Rust GameDev #{TODO_id} - {TODO_month} {TODO_day}"
transparent = true
date = TODO
date = {TODO_date}
draft = true
+++

<!-- no toc -->

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

Welcome to the {TODO}th issue of the Rust GameDev Workgroup's
Welcome to the {TODO_id}th issue of the Rust GameDev Workgroup's
monthly newsletter.
[Rust] is a systems language pursuing the trifecta:
safety, concurrency, and speed.
Expand All @@ -35,8 +35,8 @@ Feel free to send PRs about your own projects!
- [Learning Material Updates](#learning-material-updates)
- [Tooling Updates](#tooling-updates)
- [Library Updates](#library-updates)
- [Other News](#other-news)
- [Popular Workgroup Issues in Github](#popular-workgroup-issues-in-github)
- [Other News](#other-news)
- [Meeting Minutes](#meeting-minutes)
- [Discussions](#discussions)
- [Requests for Contribution](#requests-for-contribution)
Expand Down
24 changes: 24 additions & 0 deletions scripts/prepare_newsletter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh

# This scripts parses existing news, and copies the newsletter template
# alongside the others, with its incremented id number.
# This script also replaces the TODOs related to the news id number.

read -r -d '\n' -a news <<< `find content/news/ -type d -printf "%f\n"`

last_news=`echo ${news[-1]} | sed -r s/0//`
echo $last_news
news_to_create_simple=$((last_news+1))
news_to_create=`printf "%#03s" $news_to_create_simple`

read -e -p "Do you want to create issue $news_to_create? (y/n): " choice

[[ "$choice" != [Yy]* ]] && exit

echo "accepted"

new_file="content/news/$news_to_create/index.md"

mkdir -p content/news/$news_to_create && cp -r newsletter-template.md $new_file

sed -i 's/{TODO_id}/'$news_to_create_simple'/g' $new_file