From 32dcded10e6bbdb02e8aa54df8a15748d574c89b Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 25 Sep 2018 19:15:29 +0200 Subject: Re-writing templates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- script/new.sh | 67 ----------------------------------------------------------- 1 file changed, 67 deletions(-) delete mode 100755 script/new.sh (limited to 'script') diff --git a/script/new.sh b/script/new.sh deleted file mode 100755 index 04d61be..0000000 --- a/script/new.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env bash -# Copyright (C) 2018 Miquel Sabaté Solà -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -set -e - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" -pushd $DIR - -## -# Ask basic stuff like language and the file name. - -catalan=0 - -while true; do - read -p "Catalan only (Y/n)? " choice - case "$choice" in - n|N ) - break - ;; - * ) - catalan=1 - break - ;; - esac -done - -read -p "File name (with dashes but without the date): " base -file="$(date +%Y-%m-%d)-$base.org" - -## -# Copy template and sed away stuff. - -mkdir -p org/ca/_posts -dst=org/ca/_posts/$file -cp templates/post.org $dst -sed -i '/catalan_available/g' $dst - -if [[ $catalan == 0 ]]; then - mkdir -p org/en/_posts - dst=org/en/_posts/$file - cp templates/post.org $dst - sed -i 's/lang: ca/lang: en/g' $dst - sed -i '/english_available/g' $dst -else - sed -i 's/english_available: true/english_available: false/g' $dst -fi - -## -# Final output. - -echo "* Created file: $DIR/org/ca/_posts/$file" -if [[ $catalan == 0 ]]; then - echo "* Created file: $DIR/org/en/_posts/$file" -fi -- cgit v1.2.3