hopefully stable
authorDaniel Liu <mr.picklepinosaur@gmail.com>
Wed, 6 Jan 2021 01:20:43 +0000 (20:20 -0500)
committerDaniel Liu <mr.picklepinosaur@gmail.com>
Wed, 6 Jan 2021 01:20:43 +0000 (20:20 -0500)
.gitignore
blog/templates/index_entry.html [new file with mode: 0644]
blog/templates/rolling_entry.html [new file with mode: 0644]
blog/templates/rss_entry.html [new file with mode: 0644]
blogindex.html
pb
rolling.html
rss.xml

index 4ddfdc4..7ad64e7 100644 (file)
@@ -1 +1,3 @@
-blog/
+blog/backups/
+blog/drafts/
+blog/published/
diff --git a/blog/templates/index_entry.html b/blog/templates/index_entry.html
new file mode 100644 (file)
index 0000000..6c8811d
--- /dev/null
@@ -0,0 +1 @@
+<li><a href="{{URL}}">{{DATE}} - {{TITLE}}</a></li>
diff --git a/blog/templates/rolling_entry.html b/blog/templates/rolling_entry.html
new file mode 100644 (file)
index 0000000..a4dd991
--- /dev/null
@@ -0,0 +1,5 @@
+<div>
+<h2>{{TITLE}}</h2>
+<p>{{DATE}}</p>
+<p>{{BODY}}</p>
+</div>
diff --git a/blog/templates/rss_entry.html b/blog/templates/rss_entry.html
new file mode 100644 (file)
index 0000000..ef5ae1a
--- /dev/null
@@ -0,0 +1,6 @@
+<item>
+<title>{{TITLE}}</title>
+<link>{{URL}}</link>
+<description></description>
+{{BODY}}
+</item>
index de1cfe2..e9ebf04 100644 (file)
@@ -9,6 +9,9 @@
         <h1>Blog index page</h1>
 
         <!-- BLOG START -->
         <h1>Blog index page</h1>
 
         <!-- BLOG START -->
+<!-- ID:lol START -->
+<a href="https://www.youtube.com/watch?v=oHg5SJYRHA0//lol">lol</a>
+<!-- ID:lol END -->
         <!-- BLOG END -->
     </body>
 </html>
         <!-- BLOG END -->
     </body>
 </html>
diff --git a/pb b/pb
index 6b9a6b4..5f85f3c 100755 (executable)
--- a/pb
+++ b/pb
@@ -2,7 +2,7 @@
 # pinosaur's blog script
 
 data_dir="blog"
 # pinosaur's blog script
 
 data_dir="blog"
-website_url="https://www.youtube.com/watch?v=oHg5SJYRHA0/" 
+website_url="https://www.youtube.com/watch?v=oHg5SJYRHA0/" # no ending slash
 blog_index_file="blogindex.html"
 rolling_file="rolling.html"
 rss_file="rss.xml"
 blog_index_file="blogindex.html"
 rolling_file="rolling.html"
 rss_file="rss.xml"
@@ -18,7 +18,7 @@ init() {
     [ "$ask" != "y" ] && echo "Cancelled init" && exit 0
 
     mkdir -p "$data_dir/drafts" "$data_dir/published" "$data_dir/html" "$data_dir/templates" "$data_dir/backups"
     [ "$ask" != "y" ] && echo "Cancelled init" && exit 0
 
     mkdir -p "$data_dir/drafts" "$data_dir/published" "$data_dir/html" "$data_dir/templates" "$data_dir/backups"
-    echo '<p>{{TITLE}}</p>' >> "$data_dir/templates/$index_template"
+    echo '<a href="{{URL}}">{{TITLE}}</a>' >> "$data_dir/templates/$index_template"
     echo -e '<div>\n<h2>{{TITLE}}</h2>\n<p>{{DATE}}</p>\n<p>{{BODY}}</p>\n</div>' >> "$data_dir/templates/$rolling_template"
     echo -e '<item>\n<title>{{TITLE}}</title>\n<link></link>\n<description><\description>\n<\item>' \
         >> "$data_dir/templates/$rss_template"
     echo -e '<div>\n<h2>{{TITLE}}</h2>\n<p>{{DATE}}</p>\n<p>{{BODY}}</p>\n</div>' >> "$data_dir/templates/$rolling_template"
     echo -e '<item>\n<title>{{TITLE}}</title>\n<link></link>\n<description><\description>\n<\item>' \
         >> "$data_dir/templates/$rss_template"
@@ -53,8 +53,8 @@ sub() {
         sed  "\$a <!-- ID:$1 END -->" |\
         sed "s|{{TITLE}}|$1|g;
             s|{{DATE}}|`date +'%a, %b %d %H:%M'`|g;
         sed  "\$a <!-- ID:$1 END -->" |\
         sed "s|{{TITLE}}|$1|g;
             s|{{DATE}}|`date +'%a, %b %d %H:%M'`|g;
-            s|{{URL}}|$website_url/$1|g" |\
-        sed "/{{BODY}}/r $data_dir/drafts/$1" |\
+            s|{{URL}}|$website_url/blog/html/$1.html|g" |\
+        sed "/{{BODY}}/r $data_dir/drafts/$1.draft.html" |\
         sed "/{{BODY}}/d" 
 }
 
         sed "/{{BODY}}/d" 
 }
 
@@ -105,7 +105,7 @@ delete() {
 }
 
 # check to see if all required files are present
 }
 
 # check to see if all required files are present
-[ -f $blog_index_file ] && [ -f $rolling_file ] && [ -f $blog_template ] && [ -f $rss_file ] || { echo "You are missing a file, please check that you have $blog_index_file, $template_file, $rolling_file and $rss_file in your home directory" && exit 1; }
+[ -f $blog_index_file ] && [ -f $rolling_file ] && [ -f $blog_template ] && [ -f $rss_file ] || { echo "You are missing a file, please check that you have $blog_index_file, $blog_template, $rolling_file and $rss_file in your home directory" && exit 1; }
 
 # check if blog dir exists
 [ ! -d $data_dir ]  && init && exit 0
 
 # check if blog dir exists
 [ ! -d $data_dir ]  && init && exit 0
index 63a39d5..de68198 100644 (file)
@@ -9,6 +9,13 @@
         <h1>Rolling index page</h1>
 
         <!-- BLOG START -->
         <h1>Rolling index page</h1>
 
         <!-- BLOG START -->
+<!-- ID:lol START -->
+<div>
+<h2>lol</h2>
+<p>Wed, Nov 25 23:57</p>
+<h1>sdkjsaldk</h1>
+</div>
+<!-- ID:lol END -->
         <!-- BLOG END -->
 
     </body>
         <!-- BLOG END -->
 
     </body>
diff --git a/rss.xml b/rss.xml
index cec4b85..b94e613 100644 (file)
--- a/rss.xml
+++ b/rss.xml
@@ -7,6 +7,13 @@
 <description>Description</description>
 
 <!-- BLOG START -->
 <description>Description</description>
 
 <!-- BLOG START -->
+<!-- ID:lol START -->
+<item>
+<title>lol</title>
+<link></link>
+<description><\description>
+<\item>
+<!-- ID:lol END -->
 <!-- BLOG END -->
 
 </channel>
 <!-- BLOG END -->
 
 </channel>