From 45bbbdd54e52f76ac3d9c1a03b807f9337d0a559 Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Wed, 25 Nov 2020 00:23:10 -0500 Subject: [PATCH] couple fixes + docs --- README.md | 4 +++- blog/templates/index_entry.html | 2 -- blog/templates/rolling_entry.html | 3 --- blog/templates/rss_entry.html | 5 ----- pb | 12 ++++++------ 5 files changed, 9 insertions(+), 17 deletions(-) delete mode 100644 blog/templates/index_entry.html delete mode 100644 blog/templates/rolling_entry.html delete mode 100644 blog/templates/rss_entry.html diff --git a/README.md b/README.md index 455cc74..bed46c7 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,13 @@ In each of these files, you need to include the comments: # Usage ### n / new +Takes in a name for your blog post, put the name inside quotations if you want to have spaces. Also, only alphanumeric characters, underscores, dashes and spaces are allowed in the blog name (at this point). ### p / publish +Publishes a draft, which means that it takes the html snippet you wrote and shoves it inside your template file. ### d / delete - +Deletes an already published blog post, this does not delete your draft. # Configuration For more fine tuned configuration, navigate to the data\_dir directory that was created (by default it's blog/) and find the templates folder. diff --git a/blog/templates/index_entry.html b/blog/templates/index_entry.html deleted file mode 100644 index b460195..0000000 --- a/blog/templates/index_entry.html +++ /dev/null @@ -1,2 +0,0 @@ -

{{TITLE}}

-

antoher line

diff --git a/blog/templates/rolling_entry.html b/blog/templates/rolling_entry.html deleted file mode 100644 index 89d7419..0000000 --- a/blog/templates/rolling_entry.html +++ /dev/null @@ -1,3 +0,0 @@ -
-

{{TITLE}}

-

{{DATE}}

diff --git a/blog/templates/rss_entry.html b/blog/templates/rss_entry.html deleted file mode 100644 index 3aa997a..0000000 --- a/blog/templates/rss_entry.html +++ /dev/null @@ -1,5 +0,0 @@ - -{{TITLE}} - -<\description> -<\item> diff --git a/pb b/pb index 6497287..3bc32e9 100755 --- a/pb +++ b/pb @@ -22,8 +22,8 @@ init() { mkdir -p "$data_dir/drafts" "$data_dir/published" "$data_dir/html" "$data_dir/templates" - echo '

{{TITLE}}

' >> "$data_dir/templates/$index_template" - echo -e '
\n

{{TITLE}}

\n

{{DATE}}

' >> "$data_dir/templates/$rolling_template" + echo '

{{TITLE}}

' >> "$data_dir/templates/$index_template" + echo -e '
\n

{{TITLE}}

\n

{{DATE}}

\n

{{BODY}}

\n
' >> "$data_dir/templates/$rolling_template" echo -e '\n{{TITLE}}\n\n<\description>\n<\item>' \ >> "$data_dir/templates/$rss_template" @@ -33,19 +33,19 @@ init() { refresh() { read -p "Are you sure you want to refresh? [y/n] " ask - [ "$ask" != "y" ] && exit 0 + [ "$ask" != "y" ] && echo "Aborting..." && exit 0 # delete everything between tokens (remove dupe code) echo -e "$blog_index_file\n$rolling_file\n$rss_file" | xargs sed -i "//,//{//!{//!d}}" # deletes all html files and republishes all published files - - echo "Refreshed." + echo "Successfully refreshed." } new() { [ -z "$1" ] && echo "Please give your blog post a name (you should put it inside quotations)" && exit 1 - sanitized=`echo -n "$1" | sed -e 's/[^A-Za-z0-9 _-]//g'| sed -e 's/ /-/g'` + sanitized=`echo -n "$1" | sed -e 's/[^A-Za-z0-9 _-]//g'` + [ -f "$data_dir/drafts/$sanitized.draft.html" ] && echo "Blog of that name already exists." && exit 1 $EDITOR "$data_dir/drafts/$sanitized.draft.html" } -- 2.20.1