~huyngo/huyngo.srht.site

huyngo.srht.site/add-front-matter.sh -rwxr-xr-x 451 bytes
688410a7Ngô Ngọc Đức Huy Fix conlang link a day ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
if [[ $1 == "temp" ]]; then
  exit
fi

title=$(grep -m1 '#' $1 | grep -o "[^#]*");
new_path=$(echo $1 | sed "s/\//_/g"  | sed "s/\._/.\//g")

{ echo -e "---\ntitle: $title";
echo -e "categories: [ conlang ]";
echo -e "no_feed: true";
echo -e "disable_feed: true\n---\n";
echo "Go to [Table of Contents](/conlang/)"
cat $1; } > temp
mv temp $1
# flatten
if [[ $1 != "./_index.md" ]]; then
  mv $1 $new_path
fi
find -type d | grep "\./[a-z]*$" | rm -rf