Compare commits

...

29 Commits

Author SHA1 Message Date
c7b708da77 added a get method 2024-01-15 10:11:22 -06:00
59bd42f185 Finished working on getter methods 2024-01-05 14:23:44 -06:00
b267154316 updated my fastwyre job entry 2024-01-05 12:45:08 -06:00
adcda2f37d Updated fastwyre page 2024-01-04 15:57:25 -06:00
3ed298592f Added jobs section 2024-01-04 15:50:11 -06:00
9009885f53 Had to add to Backgroun section in zfs-upgrade-issue 2023-12-17 17:07:19 -06:00
0acac4dc55 Had to add to Backgroun section in zfs-upgrade-issue 2023-12-17 17:05:28 -06:00
f07e6fae57 Added new post 2023-12-17 16:12:44 -06:00
22326e7000 Added new post 2023-12-07 13:54:35 -06:00
07a1cddc9f fixed formatting 2023-12-02 13:35:10 -06:00
33edb5def8 Added new post 2023-12-02 13:34:37 -06:00
722c02db7a Added new post 2023-12-02 13:34:14 -06:00
cb7bc1d4c9 Added my journal repo to about-me 2023-11-25 17:46:49 -06:00
4a421ac4bd Specified that I work on projects to setup new servers 2023-11-25 17:37:09 -06:00
f388992436 Removed un-necessary section of post 2023-11-25 17:35:55 -06:00
108721eb0c Changed wording 2023-11-25 17:34:07 -06:00
e012077ecd Removed "& Admin" from header in about-me 2023-11-25 17:33:13 -06:00
b9b71f5f02 added line below contact in about-me 2023-11-25 17:29:48 -06:00
a507ef5e66 added line below contact in about-me 2023-11-25 17:28:46 -06:00
f46aacc5b7 Corrected formatting in about-me 2023-11-25 17:17:31 -06:00
546dc17057 Updated about-me 2023-11-25 17:01:07 -06:00
778bf9410a Added more content to auvik review 2023-11-25 14:45:29 -06:00
5675c3b814 Added new post and fixed formatting 2023-11-25 14:22:37 -06:00
f59bef3428 Had to fix variable in check to $0 2023-11-24 17:52:36 -06:00
2f51c2dd9d Added a little more info to README 2023-11-18 17:58:56 -06:00
77c5187294 New Posts 2023-11-18 17:11:50 -06:00
ab3dcd56c7 Had to put extra newline between date and author lines to seperate them for when the html is generated from the wiki 2023-11-18 17:11:29 -06:00
f9736ae49a Had to replace call to generate_index with generate_hook 2023-11-18 17:10:17 -06:00
f92e5e9f17 Had to fix an issue with the get-last-5-posts function. It was providing the first 5 posts retrieved instead of the last 2023-11-18 16:10:08 -06:00
8 changed files with 94 additions and 6 deletions

View File

@@ -5,3 +5,5 @@ Hello all, this is a project I put togethor for my Capstone project (not the pro
## Function
The core of this project depends on you having VimWiki installed. The second depends on you having bash installed as a shell.
## What it does
This simply automates the creation of new wiki posts and updating the index page.

2
Site

Submodule Site updated: 20beb7025c...d25ee5b17d

2
blog

Submodule blog updated: 8623acba92...8f59dd1f7b

View File

@@ -37,8 +37,8 @@ function get_last_5_pages (){
VAR=( ${pages[@]} )
else
## Otherwise, itterate through the last 5 blog posts
INDEX=-5
while [[ $INDEX -ne 0 ]]; do
INDEX=0
while [[ $INDEX -ne 5 ]]; do
VAR+=( "${pages[$INDEX]}" )
## Increment the index so that we get closer and closer to end of the list
((INDEX++))

View File

@@ -39,6 +39,7 @@ echo -e $TITLES
`
*Date:* `date +'%Y/%m/%d'`
*Author:* Tristan Ancelet
= $PAGE_TITLE =

85
utils/libs/get.sh Normal file
View File

@@ -0,0 +1,85 @@
#!/usr/bin/bash
function get_category_names () {
local -n OUTPUT_CATEGORY_NAMES_VAR="${1:?"get_category_names : Output variable not provided"}"
local CATEGORY_NAME
for category_path in $BLOG_DIR/posts/*; do
CATEGORY_NAME="${category_path/*\//}"
OUTPUT_CATEGORY_NAMES_VAR+=( "$CATEGORY_NAME" )
done
}
function get_category_paths () {
local -a CATEGORY_PATHS=( $BLOG_DIR/posts/* ) CATEGORY_NAMES
local -n OUTPUT_CATEGORY_VAR="${1:?"get_categories : No category variable provided"}"
for path in ${CATEGORY_PATHS[@]}; do
OUTPUT_CATEGORY_VAR[${path/*\//}]=$path
done
}
function get_posts_in_category () {
local -A CATEGORIES
local CATEGORY_NAME="${1:?"get_posts_in_category : Category name not provided"}"
local -n OUTPUT_POST_VAR="${2:?"get_posts_in_category : Output variable not provided"}"
get_category_paths CATEGORIES
if [[ "${!CATEGORIES[@]}" != *$CATEGORY_NAME* ]]; then
echo "get_posts_in_category : There is no category by that name"
exit
fi
CATEGORY_PATH="${CATEGORIES[$CATEGORY_NAME]}"
for post in ${CATEGORY_PATH}/*.wiki; do
FULLPATH=$post
FILENAME="${post/*\/}"
TIMESTAMP=`cut -d '-' -f 1 <<< "$FILENAME"`
DATE=`date -d @$TIMESTAMP +"$DATE_FORMAT"`
WIKI_PATH=/posts/$CATEGORY_NAME/$FILENAME
POST_TITLE="`grep '%title' $FULLPATH | cut -d ' ' -f 2-` ($DATE)"
DATA="$FULLPATH:$WIKI_PATH:$POST_TITLE"
OUTPUT_POST_VAR+=( "$DATA" )
done
}
function get_posts_by_category () {
local -a CATEGORY_NAMES POSTS
local -A POST_BY_CATEGORY
local post_string
local -n OUTPUT_POST_ASSOCIATIVE_ARRAY="${1:?"get_posts_by_category : Output variable not provided"}"
get_category_names CATEGORY_NAMES
for name in ${CATEGORY_NAMES[@]}; do
get_posts_in_category $name POSTS
for i in ${!POSTS[@]}; do
post="${POSTS[$i]}"
if [[ "$post_string" ]]; then
post_string+="${POST_DELIMITER}${post}"
else
post_string="$post"
fi
done
OUTPUT_POST_ASSOCIATIVE_ARRAY[$name]="$post_string"
post_string=""
unset POSTS
done
}
function deserialize_posts () {
local -n OUTPUT_POST_ARRAY="${1:?"deserialize_posts : Output variable not provided"}"
local SERIALIZED_POSTS="${2:?"deserialize_posts : Serialized posts not provided"}"
OIFS=$IFS
IFS="$POST_DELIMITER"
read -a OUTPUT_POST_ARRAY <<< "$SERIALIZED_POSTS"
}

View File

@@ -30,7 +30,7 @@ while [[ $# -ne 0 ]]; do
FILENAME="${2:?"main.sh : Filename was not provided"}"
generate_blog_post "$TITLE" "$DATESTAMP-$FILENAME"
sync
generate_index
generate_hook
break
;;

View File

@@ -3,7 +3,7 @@
## If user is not running this in the root of the project dir
if [[ ! -d utils ]]; then
## Change directory to project dir
cd `dirname $1`
cd `dirname $0`
cd ..
fi