feat(articles): add script for creating new article drafts
- Introduce `scripts/new-article` bash script to generate new article files from a title, using a template, and open in vim/vi. - Add `scripts/article-template.md` as the base structure for new articles. - Update README.md with instructions on using the new script and directory structure. - Include an example draft `articles/drafts/when-not-to-test.md` generated via the script.
This commit is contained in:
parent
65d2e46788
commit
66ec95fce9
19
README.md
19
README.md
@ -33,4 +33,23 @@ assets/
|
|||||||
clipart/ # Illustrative clipart
|
clipart/ # Illustrative clipart
|
||||||
general/ # Screenshots and diagrams
|
general/ # Screenshots and diagrams
|
||||||
memes/ # Memes referenced in articles
|
memes/ # Memes referenced in articles
|
||||||
|
scripts/
|
||||||
|
new-article # Creates new article from title and opens in vim
|
||||||
|
article-template.md # Template used by the script
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Creating New Articles
|
||||||
|
|
||||||
|
You can quickly create a new article with proper front-matter using the helper script:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
scripts/new-article "The Telos of Test Automation"
|
||||||
|
```
|
||||||
|
|
||||||
|
This will:
|
||||||
|
- Generate a clean slug from the title
|
||||||
|
- Create the file in `articles/drafts/`
|
||||||
|
- Populate it with the current front-matter standard and template structure
|
||||||
|
- Open the file in `vim` (falls back to `vi`)
|
||||||
|
|
||||||
|
See `scripts/article-template.md` and `GROK.md` for the current conventions.
|
||||||
|
|||||||
25
articles/drafts/when-not-to-test.md
Normal file
25
articles/drafts/when-not-to-test.md
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
title: When Not To Test
|
||||||
|
date: 2026-04-07
|
||||||
|
topics: [philosophy, craft]
|
||||||
|
related: []
|
||||||
|
abstract: >
|
||||||
|
How do you decide when not to test something? This article offers some food for thought.
|
||||||
|
---
|
||||||
|
|
||||||
|
# When Not To Test
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
(Opening provocation or observation goes here.)
|
||||||
|
|
||||||
|
## Main Argument
|
||||||
|
|
||||||
|
(Develop the core idea, sustained analogy, or philosophical connection here.)
|
||||||
|
|
||||||
|
## Conclusion
|
||||||
|
|
||||||
|
(Grounded reflection — no generic summary or call to action.)
|
||||||
|
|
||||||
|
---
|
||||||
|
This is a template. Replace or delete sections as needed. Keep front-matter consistent with the standard in GROK.md.
|
||||||
22
scripts/article-template.md
Normal file
22
scripts/article-template.md
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
title: {{TITLE}}
|
||||||
|
date: {{DATE}}
|
||||||
|
topics: [philosophy, craft]
|
||||||
|
related: []
|
||||||
|
abstract: >
|
||||||
|
A short but dense abstract that captures the central provocation or philosophical thesis of the article.
|
||||||
|
---
|
||||||
|
|
||||||
|
# {{TITLE}}
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
(Opening provocation or observation goes here.)
|
||||||
|
|
||||||
|
## Main Argument
|
||||||
|
|
||||||
|
(Develop the core idea, sustained analogy, or philosophical connection here.)
|
||||||
|
|
||||||
|
## Conclusion
|
||||||
|
|
||||||
|
(Grounded reflection — no generic summary or call to action.)
|
||||||
38
scripts/new-article
Executable file
38
scripts/new-article
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# new-article — Creates a new article from a title and opens it in vim
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Usage: $0 \"Article Title\""
|
||||||
|
echo "Example: $0 \"The Telos of Test Automation\""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
TITLE="$1"
|
||||||
|
DATE=$(date +%Y-%m-%d)
|
||||||
|
SLUG=$(echo "$TITLE" | tr '[:upper:]' '[:lower:]' | sed -e 's/[^a-z0-9]/-/g' -e 's/--*/-/g' -e 's/^-//g' -e 's/-$//g')
|
||||||
|
FILENAME="articles/drafts/${SLUG}.md"
|
||||||
|
TEMPLATE="scripts/article-template.md"
|
||||||
|
|
||||||
|
if [ ! -f "$TEMPLATE" ]; then
|
||||||
|
echo "Error: Template $TEMPLATE not found."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$FILENAME" ]; then
|
||||||
|
echo "Error: $FILENAME already exists."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Generate the file from template
|
||||||
|
sed -e "s/{{TITLE}}/$TITLE/g" -e "s/{{DATE}}/$DATE/g" "$TEMPLATE" > "$FILENAME"
|
||||||
|
|
||||||
|
echo "Created $FILENAME"
|
||||||
|
|
||||||
|
# Open in vim (fallback to vi)
|
||||||
|
if command -v vim >/dev/null 2>&1; then
|
||||||
|
vim "$FILENAME"
|
||||||
|
else
|
||||||
|
vi "$FILENAME"
|
||||||
|
fi
|
||||||
Loading…
Reference in New Issue
Block a user