-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New features: added an archive page. Made the blog page show only the…
… last 6 post (1 post expanded & 5 previous posts title-only). Made the date element for the posts,index,archives a span instead of a div or just text. Wrapped the title of the posts in a span element.
- Loading branch information
Showing
7 changed files
with
93 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,42 @@ | ||
#!/bin/bash | ||
|
||
if [ "$1" = "init" ];then | ||
echo " init : Creates the blog directory and copies all the 'templates' files (_files) there." | ||
echo " init : Creates the blog directory and copies all the 'templates' files (_files) there." | ||
mkdir blog; ls _*-* | sed 's:_\(.*\):mv _\1 blog/\1:'| bash | ||
echo "You can now add the 'blog' directory to a git repository and save it." | ||
exit | ||
echo "You can now add the 'blog' directory to a git repository and save it.";exit | ||
fi | ||
|
||
if [ "$1" = "new" ];then | ||
echo " new [title] : Creates an blog post at blog/`date +%Y_%m_%d`.[prettified title].md ." | ||
echo "$2" >> blog/`date +%Y_%m_%d.``echo $2 |sed 's:[\ \" \, \.\:\?_]:\-:g' | sed -e "s:':\-:g" | sed -e 's:\-\-*:\-:g'| sed -e 's:\-$::;s:^\-::'`.md | ||
exit | ||
echo " new [title] : Creates an blog post at blog/`date +%Y_%m_%d`.[prettified title].md ." | ||
echo "$2" >> blog/`date +%Y_%m_%d.``echo $2 |sed 's:[\ \" \, \.\:\?_]:\-:g' | sed -e "s:':\-:g" | sed -e 's:\-\-*:\-:g'| sed -e 's:\-$::;s:^\-::'`.md;exit | ||
fi | ||
|
||
if [ "$1" = "clean" ];then | ||
cd blog | ||
echo " clean : Removes the generated html files by removing the date directories" | ||
rm -r `ls *.md | cut -c 1-4 | sort | uniq`;rm index.html | ||
exit | ||
echo " clean : Removes the generated html files by removing the date directories" | ||
cd blog; rm -r `ls *.md | cut -c 1-4 | sort | uniq`;rm index.html archives.html;exit | ||
fi | ||
|
||
if [ "$1" = "gen" ];then | ||
echo " gen : Generates the blog" | ||
cd blog | ||
echo " gen : Generates the blog" | ||
echo "0 - Removing the generated html files by removing the year directories" | ||
rm -r `ls *.md | cut -c 1-4 | sort | uniq`;rm index.html | ||
cd blog; rm -r `ls *.md | cut -c 1-4 | sort | uniq`;rm index.html archives.html | ||
echo "1 - Creating the year/month/day directories" | ||
mkdir -p `ls *.md | cut -c 1-10 | sed 's#_#/#g'|sort | uniq` | ||
echo "2 - Creating the posts" | ||
ls *.md|sort -r| sed 's#\(.\{10\}\)\.\(.*\)\.md#echo \1 \1.\2.html >> titles;head -n 1 TK\1.\2.md|sed "s:\#\*::g" >> titles;cat both-header >> \1.\2.html;head -n 1 TK\1.\2.md |sed "s:\#\*::g" >> \1.\2.html;cat post-body >> \1.\2\.html;echo "<div class=\\"date\\">\1</div><a href=\\"\2.html\\"> ">> \1.\2.html;multimarkdown TK\1.\2.md | sed "1 s:>$:></a>:" >> \1.\2\.html;cat both-footer >> \1.\2\.html;#' |sed 's#_#\/#g'|sed 's# TK\(....\)\/\(..\)\/\(..\)\.# \1_\2_\3.#g' | sed 's: \(....\/..\/..\)\.: \1\/:g'|bash | ||
echo "3 - Creating the index" | ||
ls *.md|sort -r| sed 's#\(.\{10\}\)\.\(.*\)\.md#echo \1 \1.\2.html >> titles;head -n 1 TK\1.\2.md|sed "s:\#\*::g" >> titles;cat both-header >> \1.\2.html;head -n 1 TK\1.\2.md |sed "s:\#\*::g" >> \1.\2.html;cat post-body >> \1.\2\.html;echo "<span class=\\"date\\">\1</span> <a href=\\"\2.html\\"> ">> \1.\2.html;multimarkdown TK\1.\2.md | sed "1 s:>$:></a>:" >> \1.\2\.html;cat both-footer >> \1.\2\.html;#' |sed 's#_#\/#g'|sed 's# TK\(....\)\/\(..\)\/\(..\)\.# \1_\2_\3.#g' | sed 's: \(....\/..\/..\)\.: \1\/:g'|bash | ||
echo "3 - Creating the blog home page" | ||
cat both-header index-body >> index.html | ||
ls *.md|sort -r|head -n 1|sed 's#\(....\).\(..\).\(..\).\(.*\).md#echo "<div class=\"date\">\1\/\2\/\3</div><a href=\\"\1\/\2\/\3\/\4.html\\">";multimarkdown \1\_\2\_\3.\4.md|sed "1 s:>$:></a>:"#'|bash >> index.html | ||
ls *.md|sort -r|head -n 1|sed 's#\(....\).\(..\).\(..\).\(.*\).md#echo "<span class=\"date\">\1\/\2\/\3</span> <a href=\\"\1\/\2\/\3\/\4.html\\">";multimarkdown \1\_\2\_\3.\4.md|sed "1 s:>$:></a>:"#'|bash >> index.html | ||
cat index-middle >>index.html | ||
#Transform the lines of the titles file into the Date Link Title format. | ||
sed -e :a -e '1,2d; /\(\.*\.html\)$/N; s/\n/\"\>/; ta' titles | sed 's:\(.\{11\}\)\.*\(.*\):\<div class=\"index_item\"\>\1 \»\; <a href\=\"\2\<\/a\>\<\/div\>:'>>index.html | ||
cat both-footer >> index.html;rm titles | ||
echo "And voila!" | ||
exit | ||
#Transform last 5 previous posts into the Date Link Title format. | ||
head -n 12 titles | sed -e :a -e '1,2d; /\(\.*\.html\)$/N; s/\n/\"\>/; ta' | sed 's:\(.\{11\}\)\.*\(.*\):\<div class=\"index_item\"\><span class=\"date\">\1</span> <span class=\"date_sep\"> \»\;</span> <span class=\"title\"><a href\=\"\2\<\/a\></span>\<\/div\>:'>>index.html | ||
cat both-footer >> index.html | ||
echo "4 - Creating the blog archive page" | ||
cat both-header >> archives.html | ||
cat archives-body >> archives.html | ||
#Transform all the lines of the titles file into the Date Link Title format. | ||
sed -e :a -e '/\(\.*\.html\)$/N; s/\n/\"\>/; ta' titles | sed 's:\(.\{11\}\)\.*\(.*\):\<div class=\"index_item\"\><span class=\"date\">\1</span> <span class=\"date_sep\"> \»\;</span> <span class=\"title\"><a href\=\"\2\<\/a\></span>\<\/div\>:'>> archives.html | ||
cat both-footer >> archives.html;rm titles | ||
echo "And voila!";exit | ||
fi | ||
echo "usage : ___.sh init new [title] clean gen";cat ___.sh | grep "echo \" " |bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Archives for - My Blog Name Goes Here -</title> | ||
<!-- This will be prepended between the title and the list of posts --> | ||
<link rel="stylesheet" type="text/css" href="common-css.css"> | ||
</head> | ||
<body> | ||
<div class="content"> | ||
<h1>All my posts</h1> | ||
<div class="post"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
</div><!-- closes the "index" or "post" div --> | ||
</div><!-- closes the "content" div --> | ||
<!-- this will be appended at the end of the individual pages for each post and to the generated index file --> | ||
<div class="copy">This blog brought to you by ___ , available at <a href="https://github.com/nicolasH/frankensteins/">https://github.com/nicolasH/frankensteins/</a></div> | ||
<!-- you might want to put your analytics script here. --> | ||
<div class="copy">This blog brought to you by <code>___.sh</code> , available at <a href="https://github.com/nicolasH/frankensteins/">https://github.com/nicolasH/frankensteins/</a></div> | ||
<!-- you might want to put the import of your scripts for analytics and social buttons here. --> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
- My Blog Name Goes Here</title> | ||
- My Blog Name Goes Here -</title> | ||
<!-- This will be prepended between the title and the list of posts --> | ||
<link rel="stylesheet" type="text/css" href="common-css.css"> | ||
</head> | ||
<body> | ||
<div class="content"> | ||
<div class="post"> | ||
<h1>My blog</h1> | ||
<div class="post"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
</div><!-- close the "post" div --> | ||
</div> | ||
<div class="index"> | ||
<h2>The other blog posts</h2> | ||
<h2>Earlier posts</h2> | ||
<p>Here are the previous few posts. A complete list of all the posts on this blog is available in the <a href="archives.html">archives</a>.</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
- My Blog Name Goes Here | ||
- blog for Displayator | ||
</title> | ||
<!-- This will be prepended to each of the post's content --> | ||
<link rel="stylesheet" type="text/css" href="../../../common-css.css"> | ||
</head> | ||
<body> | ||
<div class="content"> | ||
<div class="nav"> | ||
<a href="../../../">Posts List</a> | ||
<a href="../../../../">Home</a> | ||
<ul> | ||
<li><a href="../../../archives.html">blog archives</a></li> | ||
<li><a href="../../../">blog index</a></li> | ||
</ul> | ||
</div> | ||
<div class="post"> | ||
|
||
<div class="content"> | ||
<h1>My Blog</h1> | ||
<div class="post"> |