Compare commits
No commits in common. "0c89da7c3d9ecfccfb3027e6915d262471c963c4" and "c36ce7dd2055e23781b3e5c830f80f87e7ad0552" have entirely different histories.
0c89da7c3d
...
c36ce7dd20
2
host.sh
2
host.sh
@ -1,3 +1,3 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
python3 -m http.server --directory ./html/ & xdg-open http://0.0.0.0:8000/
|
python3 -m http.server --directory ./html/
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set +e
|
|
||||||
|
|
||||||
printf "%s" "Enter title: "
|
|
||||||
read title
|
|
||||||
|
|
||||||
printf "%s" "Enter directory name: "
|
|
||||||
read directory
|
|
||||||
|
|
||||||
if [ -d "./articles/$directory/" ]; then
|
|
||||||
echo "Directory already exists, aborted."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf "%s" "Enter brief: "
|
|
||||||
read brief
|
|
||||||
|
|
||||||
printf "%s" "Enter tags: "
|
|
||||||
read tags
|
|
||||||
|
|
||||||
mkdir "./articles/$directory/"
|
|
||||||
|
|
||||||
mask=$(cat <<-format
|
|
||||||
Title: %s
|
|
||||||
Brief: %s
|
|
||||||
Date: %s
|
|
||||||
Tags: %s
|
|
||||||
CSS: /style.css
|
|
||||||
|
|
||||||
format
|
|
||||||
)
|
|
||||||
date=$(date +%s)
|
|
||||||
|
|
||||||
printf "$mask" "$title" "$brief" "$date" "$tags" \
|
|
||||||
> "./articles/$directory/page.mmd"
|
|
||||||
|
|
||||||
if which xdg-open &> /dev/null; then
|
|
||||||
xdg-open "./articles/$directory/page.mmd"
|
|
||||||
fi
|
|
@ -2,7 +2,7 @@ import time, subprocess
|
|||||||
|
|
||||||
def the_line_after_metadata(lines: []) -> int:
|
def the_line_after_metadata(lines: []) -> int:
|
||||||
i = 0
|
i = 0
|
||||||
while i < len(lines) and lines[i].strip():
|
while lines[i].strip():
|
||||||
i += 1
|
i += 1
|
||||||
return i
|
return i
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ def parse_metadata(filepath: str) -> {}:
|
|||||||
result["Date"] = time.gmtime(int(val))
|
result["Date"] = time.gmtime(int(val))
|
||||||
elif key == "Tags":
|
elif key == "Tags":
|
||||||
result["Tags"] = [v.strip() for v in val.split(",")]
|
result["Tags"] = [v.strip() for v in val.split(",")]
|
||||||
elif val:
|
else:
|
||||||
result[key] = val
|
result[key] = val
|
||||||
result["Last Edit"] = time.gmtime(int(subprocess.getoutput(r"stat -c %Y " + filepath)))
|
result["Last Edit"] = time.gmtime(int(subprocess.getoutput(r"stat -c %Y " + filepath)))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user