#!/bin/sh
read -p "File name: " file_name
read -p "URL alias: " url_alias
read -p "Summary: " summ
# Get title from the first line of the file
title=$(sed -n '1s/^#\s*//p' "${file_name}")
# Old way, decided to use less stuff but left it here cuz why not
#title=$(cat "${file_name}" | head -1 | cut -c 3-)
# Get the post header from the "head" file
headerContent=$(cat blogposts/head)
# Get the post abstract from the second line of the file
postTitle=$(cat ${file_name} | grep --line-number \#\# | grep 2 | cut -c 6-)
# Convert markdown content to HTML
htmlContent=$(md2html "${file_name}")
# Get the current date and time in the RFC 3339 format and regular format
postDate=$(date +"%a, %d %b. %Y - %r")
xmlDate=$(date --rfc-3339=seconds | sed 's/ /T/')
remNums=$(cat atom.xml | wc -l)
# Write the HTML file
{
echo ""
echo ""
echo "