From 0595b3a81a5e952b8675ac00cec21f74d0457978 Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Sun, 9 Jul 2023 11:42:36 +0800 Subject: IMPORTANT UPDATE: NO LONGER DEVELOPING THIS SITE --- build/website/index.html | 199 ++++++++++++++++++++++++++++------------------- process_file | 59 ++++++-------- website/index.html | 181 +++++++++++++++++++++++++----------------- 3 files changed, 256 insertions(+), 183 deletions(-) diff --git a/build/website/index.html b/build/website/index.html index d5e4492..a9063ae 100644 --- a/build/website/index.html +++ b/build/website/index.html @@ -10,109 +10,152 @@ -Preston Pan - - - - - -

Preston Pan (aka LiCoO2)

- -

- Hi! I'm Preston Pan, and this is my v3 of my website. - I've got it to work with a shell script that I made. - In the future, I might release the shell script as a separate - thing, but for now it's a part of the - Null Identity website - and this one. -

- +

Hi! I'm Preston Pan, and this is my v3 of my website. I've got +it to work with a shell script that I made. In the future, I might +release the shell script as a separate thing, but for now it's a +part of the Null +Identity website and this one.

+

NOTICE: I AM NOT USING THIS WEBSITE ANYMORE. My new one can be +found at https://ret2pop.nullring.xyz, as I have moved my website +to using org-mode. Yes, I am an emacs user now.

Some things about myself:

- -

- Of course, those are rather surface level things, but the point is that - you will find things related to the topics above on this website. - The website is structured in a hiearchical format just like in filesystems - because I find that to be the easiest balance between user simplicity - and developer simplicity. -

- -

- Note: most things on this website will 404 right now simply because of the - fact that I have a limited amount of time and have just changed the backend - for this website. -

- +

Of course, those are rather surface level things, but the point +is that you will find things related to the topics above on this +website. The website is structured in a hiearchical format just +like in filesystems because I find that to be the easiest balance +between user simplicity and developer simplicity.

+

Note: most things on this website will 404 right now simply +because of the fact that I have a limited amount of time and have +just changed the backend for this website.

Topics

- -

Here, you will find topics related to:

+

Here, you will find topics related to:

-

Many articles will be written in groff and compiled to pdf.

-

Services

-

Here are the services that I run on my server/socially:

-

Webrings

-

This website is a part of the following webrings:

The Null Webring

-

prev Nullring next

- +

prev Nullring next

Donating

-

- Basically, if you like any of what I am doing, donate! My servers aren't free, and I do run a lot of stuff - for the tech related community in our school, and I also try to write good software. I like monero as a - donation method because: -

+

Basically, if you like any of what I am doing, donate! My +servers aren't free, and I do run a lot of stuff for the tech +related community in our school, and I also try to write good +software. I like monero as a donation method because:

-

Here are some methods of donating I support:

-

- Thanks a lot for your support! -

+ + + + + +
+$$VAR CONTENT
diff --git a/process_file b/process_file index 0aa9ea4..996f151 100755 --- a/process_file +++ b/process_file @@ -10,45 +10,39 @@ if [ $# -eq 0 ]; then fi # This function recursively resolves the $$INCLUDE calls -template_replacement() -{ - r_templates="$(< "$TEMPLATE_BUILD_DIR/$(basename "$1")" grep "\$\$INCLUDE")" # this is the future built version of our template. - # We are finding the $$INCLUDE lines. - if [ -z "$r_templates" ] # Base case of recursion: there are no more $$INCLUDE calls. - then +template_replacement() { + r_templates="$(grep <"$TEMPLATE_BUILD_DIR/$(basename "$1")" "\$\$INCLUDE")" # this is the future built version of our template. + # We are finding the $$INCLUDE lines. + if [ -z "$r_templates" ]; then # Base case of recursion: there are no more $$INCLUDE calls. return 0 fi - echo "$r_templates" | while read -r i - do + echo "$r_templates" | while read -r i; do # Escapes special characters from line containing $$INCLUDE call - keyword_regexp="$(printf '%s' "$i" | -e gsed 's/[]\/$*.^|[]/\\&/g' | gsed ':a;N;$!ba;s,\n,\\n,g')" + keyword_regexp="$(printf '%s' "$i" | -e sed 's/[]\/$*.^|[]/\\&/g' | sed ':a;N;$!ba;s,\n,\\n,g')" r_tname="$TEMPLATE_DIR/$(echo "$i" | cut -d ' ' -f 2).html" # Get contents of file then escapes special characters f_contents="$(cat "$r_tname")" - replacement_regexp="$(printf '%s' "$f_contents" | gsed -e 's/[\/&]/\\&/g' | gsed ':a;N;$!ba;s,\n,\\n,g')" + replacement_regexp="$(printf '%s' "$f_contents" | sed -e 's/[\/&]/\\&/g' | sed ':a;N;$!ba;s,\n,\\n,g')" #Finally do the sed replace to replace the $$INCLUDE line with the contents of the included template file - gsed -i "s/$keyword_regexp/$replacement_regexp/g" "$TEMPLATE_BUILD_DIR/$(basename "$1")" # BUG: This shit does not work + sed -i "s/$keyword_regexp/$replacement_regexp/g" "$TEMPLATE_BUILD_DIR/$(basename "$1")" # BUG: This shit does not work # Then we do it all again on the same file. template_replacement "$1" done } -fname="$(basename "$1")" # gets the name of file in question -if [ "${fname##*.}" != "html" ] # If it is not an html file, just copy it over to the build directory, the script does nothing. -then +fname="$(basename "$1")" # gets the name of file in question +if [ "${fname##*.}" != "html" ]; then # If it is not an html file, just copy it over to the build directory, the script does nothing. cp "$1" "$BUILD_DIR/$1" exit 0 fi # We want the first specified template to be the template -template_name="$(< "$1" grep "\$\$TEMPLATE" | head -1)" - +template_name="$(grep <"$1" "\$\$TEMPLATE" | head -1)" # Location of the template that is to be built from template_replacement -if [ -n "$template_name" ] # We get the path of the template and if no template is specified it uses the default. -then +if [ -n "$template_name" ]; then # We get the path of the template and if no template is specified it uses the default. template="$TEMPLATE_DIR/$(echo "$template_name" | cut -d ' ' -f 2 | tr -d '\n').html" else template="$DEFAULT_TEMPLATE" @@ -57,44 +51,41 @@ fi built_template="$TEMPLATE_BUILD_DIR/$(basename "$template")" template_replacement "$template" # replace all the $$TEMPLATE calls. -vars="$(< "$1" grep "\$\$START")" +vars="$(grep <"$1" "\$\$START")" # now we prepare to do the variable substitutions. cp "$built_template" "$BUILD_DIR/$1" -echo "$vars" | while read -r var; -do +echo "$vars" | while read -r var; do # Get the name of the variable name="$(echo "$var" | cut -d ' ' -f 2 | tr -d '\n')" - keyword_regexp="$(printf '%s' "$var" | gsed -e 's/[]\/$*.^|[]/\\&/g' | gsed ':a;N;$!ba;s,\n,\\n,g')" + keyword_regexp="$(printf '%s' "$var" | sed -e 's/[]\/$*.^|[]/\\&/g' | sed ':a;N;$!ba;s,\n,\\n,g')" # Get the endpoint of the variable var_end="\$\$END $name" - end_regexp="$(printf '%s' "$var_end" | gsed -e 's/[\/&]/\\&/g' | gsed ':a;N;$!ba;s,\n,\\n,g')" + end_regexp="$(printf '%s' "$var_end" | sed -e 's/[\/&]/\\&/g' | sed ':a;N;$!ba;s,\n,\\n,g')" # Get the value of the variable - value="$(< "$BUILD_DIR/$1" gsed -n "/$keyword_regexp/,/$end_regexp/p" "$1")" - value_regexp="$(printf '%s' "$value" | gsed -e 's/[]\/$*.^|[]/\\&/g' | gsed ':a;N;$!ba;s,\n,\\n,g')" + value="$(sed <"$BUILD_DIR/$1" -n "/$keyword_regexp/,/$end_regexp/p" "$1")" + value_regexp="$(printf '%s' "$value" | sed -e 's/[]\/$*.^|[]/\\&/g' | sed ':a;N;$!ba;s,\n,\\n,g')" # Get the string to replace replacement="\$\$VAR $name" - replacement_regexp="$(printf '%s' "$replacement" | gsed -e 's/[\/&]/\\&/g' | gsed ':a;N;$!ba;s,\n,\\n,g')" + replacement_regexp="$(printf '%s' "$replacement" | sed -e 's/[\/&]/\\&/g' | sed ':a;N;$!ba;s,\n,\\n,g')" # Then do the replacement - gsed -i "s/$replacement_regexp/$value_regexp/g" "$BUILD_DIR/$1" # BUG: Doesn't work on openBSD + sed -i "s/$replacement_regexp/$value_regexp/g" "$BUILD_DIR/$1" # BUG: Doesn't work on openBSD done # For some reason I can't trim these inside the loop (i tried) so this works. sed -i '/\$\$START/d' "$BUILD_DIR/$1" sed -i '/\$\$END/d' "$BUILD_DIR/$1" -debug="$(< "$BUILD_DIR/$1" grep "\$\$SCRIPT")" +debug="$(grep <"$BUILD_DIR/$1" "\$\$SCRIPT")" printf "$debug\n" -if [ -n "$debug" ] -then - echo "$debug" | while read -r line; - do +if [ -n "$debug" ]; then + echo "$debug" | while read -r line; do name="$(echo "$line" | cut -d ' ' -f 2 | tr -d '\n')" output="$(./"$PLUG_DIR/$name" "$1" "$template")" - keyword_regexp="$(printf '%s' "$line" | gsed -e 's/[]\/$*.^|[]/\\&/g' | gsed ':a;N;$!ba;s,\n,\\n,g')" - replacement_regexp="$(printf '%s' "$output" | gsed -e 's/[\/&]/\\&/g' | gsed ':a;N;$!ba;s,\n,\\n,g')" + keyword_regexp="$(printf '%s' "$line" | sed -e 's/[]\/$*.^|[]/\\&/g' | sed ':a;N;$!ba;s,\n,\\n,g')" + replacement_regexp="$(printf '%s' "$output" | sed -e 's/[\/&]/\\&/g' | sed ':a;N;$!ba;s,\n,\\n,g')" sed -i "s/$keyword_regexp/$replacement_regexp/g" "$BUILD_DIR/$1" # BUG: doesn't work with openBSD done diff --git a/website/index.html b/website/index.html index 587cca0..f4c9353 100644 --- a/website/index.html +++ b/website/index.html @@ -1,96 +1,135 @@ -$$START TITLE -Preston Pan -$$END TITLE - -$$START CONTENT +$$START TITLE Preston Pan $$END TITLE $$START CONTENT

Preston Pan (aka LiCoO2)

- -

- Hi! I'm Preston Pan, and this is my v3 of my website. - I've got it to work with a shell script that I made. - In the future, I might release the shell script as a separate - thing, but for now it's a part of the - Null Identity website - and this one. -

- +

Hi! I'm Preston Pan, and this is my v3 of my website. I've got +it to work with a shell script that I made. In the future, I might +release the shell script as a separate thing, but for now it's a +part of the Null +Identity website and this one.

+

NOTICE: I AM NOT USING THIS WEBSITE ANYMORE. My new one can be +found at https://ret2pop.nullring.xyz, as I have moved my website +to using org-mode. Yes, I am an emacs user now.

Some things about myself:

- -

- Of course, those are rather surface level things, but the point is that - you will find things related to the topics above on this website. - The website is structured in a hiearchical format just like in filesystems - because I find that to be the easiest balance between user simplicity - and developer simplicity. -

- -

- Note: most things on this website will 404 right now simply because of the - fact that I have a limited amount of time and have just changed the backend - for this website. -

- +

Of course, those are rather surface level things, but the point +is that you will find things related to the topics above on this +website. The website is structured in a hiearchical format just +like in filesystems because I find that to be the easiest balance +between user simplicity and developer simplicity.

+

Note: most things on this website will 404 right now simply +because of the fact that I have a limited amount of time and have +just changed the backend for this website.

Topics

- -

Here, you will find topics related to:

+

Here, you will find topics related to:

-

Many articles will be written in groff and compiled to pdf.

-

Services

-

Here are the services that I run on my server/socially:

-

Webrings

-

This website is a part of the following webrings:

The Null Webring

-

prev Nullring next

- +

prev Nullring next

Donating

-

- Basically, if you like any of what I am doing, donate! My servers aren't free, and I do run a lot of stuff - for the tech related community in our school, and I also try to write good software. I like monero as a - donation method because: -

+

Basically, if you like any of what I am doing, donate! My +servers aren't free, and I do run a lot of stuff for the tech +related community in our school, and I also try to write good +software. I like monero as a donation method because:

-

Here are some methods of donating I support:

-

- Thanks a lot for your support! -

-$$END CONTENT +

Thanks a lot for your support!

$$END CONTENT -- cgit