Compare commits

..

No commits in common. "4759318d299ade0b7c682975b7a8c8aede7fb7af" and "11307f47910c9db0e9eafe8639bd52d90a1f28e1" have entirely different histories.

10 changed files with 60 additions and 82 deletions

View File

@ -1,16 +1,17 @@
#!/opt/homebrew/bin/bash #!/usr/bin/bash
JOURNAL_DIR=~/Journal
cd $JOURNAL_DIR cd $JOURNAL_DIR
UPDATE_ALL=$JOURNAL_DIR/scripts/update_all.sh
DATE=`date +'%Y-%m-%d'` DATE=`date +'%Y-%m-%d'`
FILE="$JOURNAL_DIR/$DATE.wiki" FILE="$JOURNAL_DIR/$DATE.wiki"
[[ -f $SCRIPT_DIR/utils/journals.sh ]] && . $SCRIPT_DIR/utils/journals.sh [[ -f $JOURNAL_DIR/scripts/utils/journals.sh ]] && . $JOURNAL_DIR/scripts/utils/journals.sh
# Getting the last journal entry file # Getting the last journal entry file
declare -a journals declare -a journals
get_journals journals get_journals journals
LAST_JOURNAL_ENTRY="${journals[-1]}" LAST_JOURNAL_ENTRY="${journals[-1]}"
LAST_JOURNAL_ENTRY="${LAST_JOURNAL_ENTRY/*\/}"
declare -A topics declare -A topics
@ -38,31 +39,28 @@ echo "[[$LAST_JOURNAL_ENTRY|Last Journal Entry]]
%title $DATE Journal Entry %title $DATE Journal Entry
--------------------- # Main Topics from previous journal entry
[[/index.wiki|Index]]
---------------------
Main Topics from previous journal entry
---------------------------------------
$( for topic in "${!topics[@]}"; do $( for topic in "${!topics[@]}"; do
level=${topics["$topic"]} level=${topics["$topic"]}
[[ $level -eq 1 ]] && echo "- [[$LAST_JOURNAL_ENTRY#$topic|$topic]]"; [[ $level -eq 1 ]] && echo "[[$LAST_JOURNAL_ENTRY#$topic|$topic]]";
done ) done )
Times # Times
-----
$( for topic in "${!topics[@]}"; do $( for topic in "${!topics[@]}"; do
level=${topics["$topic"]} level=${topics["$topic"]}
[[ $level -eq 2 ]] && echo "- [[$LAST_JOURNAL_ENTRY#$topic|$topic]]"; [[ $level -eq 2 ]] && echo "[[$LAST_JOURNAL_ENTRY#$topic|$topic]]";
done ) done )
Subtopics # Subtopics
---------
$( for topic in "${!topics[@]}"; do $( for topic in "${!topics[@]}"; do
level=${topics["$topic"]} level=${topics["$topic"]}
[[ $level -gt 2 ]] && echo "- [[$LAST_JOURNAL_ENTRY#$topic|$topic]]"; [[ $level -gt 2 ]] && echo "[[$LAST_JOURNAL_ENTRY#$topic|$topic]]";
done ) done )
" > $FILE " > $FILE
[[ -f $UPDATE_ALL ]] && $UPDATE_ALL

View File

@ -1,10 +0,0 @@
#!/usr/local/bin/bash
export PROJECT_DIR=~/Notes
export SCRIPT_DIR=$PROJECT_DIR/scripts
export JOURNAL_DIR=$PROJECT_DIR/wikis
cd $SCRIPT_DIR
./make_new.sh
./update_all.sh

View File

@ -1,11 +1,12 @@
#!/opt/homebrew/bin/bash #!/usr/bin/bash
export PROJ_DIR=~/Notes JOURNAL_DIR=~/Journal
export JOURNAL_DIR=$PROJ_DIR/wikis FILES_DIR=$JOURNAL_DIR/files
export FILES_DIR=$PROJ_DIR/files SCRIPT_DIR=$JOURNAL_DIR/scripts/enabled
export SCRIPT_DIR=$PROJ_DIR/scripts
cd $PROJ_DIR #set -x
for script in $SCRIPT_DIR/enabled/**; do cd $JOURNAL_DIR
for script in $SCRIPT_DIR/*; do
[[ -x $script ]] && $script [[ -x $script ]] && $script
done done

View File

@ -1,9 +1,11 @@
#!/opt/homebrew/bin/bash #!/usr/bin/bash
#set -x #set -x
[[ -f $SCRIPT_DIR/utils/journals.sh ]] && . $SCRIPT_DIR/utils/journals.sh JOURNAL_DIR=~/Journal
JOURNAL_FULL_INDEX=$PROJ_DIR/full_index.wiki JOURNAL_SCRIPT_DIR=$JOURNAL_DIR/scripts
[[ -f $JOURNAL_SCRIPT_DIR/utils/journals.sh ]] && . $JOURNAL_SCRIPT_DIR/utils/journals.sh
JOURNAL_FULL_INDEX=$JOURNAL_DIR/full_index.wiki
declare -a journals declare -a journals
get_journals journals get_journals journals
@ -13,23 +15,21 @@ echo "
# Journals: Times & Topics # Journals: Times & Topics
$( $(
for file_path in ${journals[@]}; do for file in ${journals[@]}; do
file="${file_path/*\/}"
journal_full_path=$PROJ_DIR$file_path
echo -e '\n\n' echo -e '\n\n'
echo "[[$file_path|$(echo $file | cut -d '.' -f 1 | tr '-' '/')]]" echo "[[$file|$(echo $file | cut -d '.' -f 1 | tr '-' ' ')]]"
echo "# Times" echo "# Times"
while read time; do while read time; do
echo " - [[$file_path#$time|$time]]" echo " - [[$file#$time|$time]]"
done <<< "$( grep '== ' $journal_full_path | grep -Eo '[0-9]+:[0-9]+ [A-Za-z]{2} [A-Za-z]{3}')" done <<< "$( grep '== ' $file | grep -Eo '[0-9]+:[0-9]+ [A-Za-z]{2} [A-Za-z]{3}')"
echo echo
echo "# Topics" echo "# Topics"
while read topic; do while read topic; do
echo " - [[$file_path#$topic|$topic]]" echo " - [[$file#$topic|$topic]]"
done <<< "$( grep -Eo '^===[=]* .+ ===[=]*' $journal_full_path | tr '=' ' ' | sort -u)" done <<< "$( grep -Eo '^===[=]* .+ ===[=]*' $file | tr '=' ' ' | sort -u)"
done done
) )

View File

@ -1,24 +1,26 @@
#!/opt/homebrew/bin/bash #!/usr/bin/bash
[[ -f $SCRIPT_DIR/utils/journals.sh ]] && . $SCRIPT_DIR/utils/journals.sh #set -x
JOURNAL_INDEX=$PROJ_DIR/index.wiki
JOURNAL_DIR=/home/tristan/Journal
JOURNAL_SCRIPT_DIR=$JOURNAL_DIR/scripts
[[ -f $JOURNAL_SCRIPT_DIR/utils/journals.sh ]] && . $JOURNAL_SCRIPT_DIR/utils/journals.sh
JOURNAL_INDEX=$JOURNAL_DIR/index.wiki
declare -a journals declare -a journals
get_journals journals get_journals journals
echo " echo "
%title Journal Index %title Journal Index
----------------------------------------------- [[full_index.wiki|Full Index]]
[[/index.wiki|Index]] [[full_index.wiki|Full Index]] [[tasks.wiki|Tasks Index]] [[how-to.wiki|How-To Index]] [[tasks.wiki|Tasks Index]]
----------------------------------------------- [[how-to.wiki|How-To Index]]
Journals # Journals
--------
$( $(
for journal_path in ${journals[@]}; do for journal in ${journals[@]}; do
journal_file="${journal_path/*\/}" echo "- [[$journal|$( echo $journal | cut -d'.' -f 1 | tr '-' ' ')]]"
journal_name="$( echo $journal_file | cut -d '.' -f 1 | tr '-' '/' )"
echo "- [[$journal_path|$journal_name]]"
done done
) )

View File

@ -2,10 +2,10 @@
from pathlib import Path from pathlib import Path
from utils.py.journals import * from utils.py.journals import *
import os
PROJ_DIR=Path(os.getenv("PROJ_DIR")) SCRIPT_DIR=Path.home()/"Journal"/"scripts"
TASK_FILE=PROJ_DIR/"tasks.wiki" SCRIPT_DIR.cwd()
TASK_FILE=Path.home()/"Journal"/"tasks.wiki"
if not TASK_FILE.exists(): if not TASK_FILE.exists():
TASK_FILE.touch() TASK_FILE.touch()
@ -27,17 +27,14 @@ with TASK_FILE.open('a') as file:
file.write(f"[[{filename}|{file_date}]]\n") file.write(f"[[{filename}|{file_date}]]\n")
if len(todo) != 0: if len(todo) != 0:
file.write("TODO\n") file.write("# TODO\n")
file.write("----\n")
for task in todo: for task in todo:
task_string=task.replace('=','').strip() task_string=task.replace('=','').strip()
file.write(f"- [[{filename}#{task_string}|{task_string}]]\n") file.write(f"- [[{filename}#{task_string}|{task_string}]]\n")
file.write("\n") file.write("\n")
if len(done) != 0: if len(done) != 0:
file.write("DONE\n") file.write("# DONE\n")
file.write("----\n")
for task in done: for task in done:
task_string=task.replace('=','').strip() task_string=task.replace('=','').strip()
file.write(f"- [[{filename}#{task_string}|{task_string}]]\n") file.write(f"- [[{filename}#{task_string}|{task_string}]]\n")

View File

@ -1,4 +1,4 @@
#!/opt/homebrew/bin/bash #!/usr/bin/bash
: " : "
get_task_number get_task_number
This function will query sqlite db to either get the number of a task OR create the task and return the number This function will query sqlite db to either get the number of a task OR create the task and return the number

View File

@ -1,18 +1,8 @@
#!/opt/homebrew/bin/bash #!/usr/bin/bash
function get_journals () { function get_journals () {
local JOURNAL_REGEX='[0-9]{4}-[0-9]{2}-[0-9]{2}.wiki' local JOURNAL_REGEX='[0-9]{4}-[0-9]{2}-[0-9]{2}.wiki'
declare -n array="${1:?"get_journals : Variable not passed through"}" [[ "$1" ]] && declare -n hashmap="$1"
array=( $( ls -1 $JOURNAL_DIR | grep -Eo $JOURNAL_REGEX | sort -n ) ) hashmap=( $( ls $JOURNAL_DIR -1 | grep -Eo $JOURNAL_REGEX | sort -n ) )
local file
for i in ${!array[@]}; do
file="${array[$i]}"
DIR=`basename $JOURNAL_DIR`
if [[ "$file" != $DIR/* ]]; then
file="/$DIR/$file"
array[$i]=$file
fi
done
} }

View File

@ -1,5 +1,5 @@
#!/opt/homebrew/bin/bash #!/usr/bin/bash
[[ -f ~/Notes/utils/journals.sh ]] && . ~/Notes/utils/journals.sh [[ -f ~/Journal/utils/journals.sh ]] && . ~/Journal/utils/journals.sh
function get_tasks () { function get_tasks () {
set -x set -x

View File

@ -1,5 +1,5 @@
#!/opt/homebrew/bin/bash #!/usr/bin/bash
[[ -f ~/Notes/utils/journals.sh ]] && . ~/Notes/utils/journals.sh [[ -f ~/Journal/utils/journals.sh ]] && . ~/Journal/utils/journals.sh
function get_tasks () { function get_tasks () {
local -a journals local -a journals