Skip to content

Commit

Permalink
New experimental tooling for handling drafts. Fixes #20
Browse files Browse the repository at this point in the history
  • Loading branch information
themkat committed Sep 23, 2024
1 parent 000692a commit 5a828cd
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
29 changes: 29 additions & 0 deletions scripts/new_draft.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# Creates a new draft with populated header

if [ -z $1 ] || [ -z $2 ]
then
echo "Usage:\n./scripts/new_draft.sh name.org first-tag"
exit 1
fi

DRAFT=$1
FIRST_TAG=$2

mkdir -p org/_drafts
touch org/_drafts/$DRAFT
cat <<FILE_CONTENTS >> org/_drafts/$DRAFT
#+OPTIONS: toc:nil num:nil
#+STARTUP: showall indent
#+STARTUP: hidestars
#+BEGIN_EXPORT html
---
layout: blogpost
title: "$DRAFT"
tags: $FIRST_TAG
---
#+END_EXPORT
Once upon a time there was...
FILE_CONTENTS
14 changes: 14 additions & 0 deletions scripts/promote_draft.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

if [ -z $1 ]
then
echo -e "Usage:\n./scripts/promote_draft.sh org/_drafts/my_draft.org"
exit 1
fi


DRAFT=$1
DATE=$(date +"%Y-%m-%d")
FILENAME="$DATE-$(echo $DRAFT | sed 's!org/_drafts/!!')"

mv $DRAFT org/_posts/$FILENAME

0 comments on commit 5a828cd

Please sign in to comment.