From 0a86cfaee60215120361c5d20186c5f4bc0dffe1 Mon Sep 17 00:00:00 2001 From: Dejvino Date: Sat, 17 Oct 2020 19:51:20 +0200 Subject: [PATCH] Add post title extraction --- config.sh.template | 2 +- post.sh | 40 +++++++++++++++++++++++++++++++--------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/config.sh.template b/config.sh.template index ce44cc0..1909f3f 100755 --- a/config.sh.template +++ b/config.sh.template @@ -1,6 +1,6 @@ #!/bin/bash EDITOR=vim -TRANSFORM="" # '' / 'markdown' +TRANSFORM=('title' 'markdown') # empty or a subset of: 'title' 'markdown' USER="" # WP user to create the post PASSWORD="" # application password generated for your WP user SERVER="" # server hostname, optionally with subdirectories diff --git a/post.sh b/post.sh index cc99be8..31ea4d0 100755 --- a/post.sh +++ b/post.sh @@ -3,7 +3,7 @@ # config: EDITOR=vim -TRANSFORM="" # '' / 'markdown' +TRANSFORM=() # empty or a subset of: 'title' 'markdown' USER="" # WP user to create the post PASSWORD="" # application password generated for your WP user SERVER="" # server hostname, optionally with subdirectories @@ -19,19 +19,40 @@ $EDITOR $TMPFILE || exit 1 [[ -e $TMPFILE ]] || exit 1 # transformations -if [[ $TRANSFORM -eq "markdown" ]]; then - python >$TMPFILE.trans <$TMPFILE.trans2 <$TMPFILE.trans2 <