-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenvsetup.sh
More file actions
50 lines (44 loc) · 1.19 KB
/
envsetup.sh
File metadata and controls
50 lines (44 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh
# need to make a function that replaces the following links
# in markdown files:
# 
# with
# 
# but not include links like:
# 
siot_projects="go hw fw"
siot_find_md_files() {
for p in $siot_projects; do
for f in "docs/$p/"*.md; do
ret="${ret} ${f}"
done
done
echo "$ret"
}
siot_update_image_links() {
file=$1
project=$(echo "$1" | sed 's/docs\/\(.*\)\/.*/\1/')
echo "project: $project"
# FIXME this is still replacing all links, even external
sed -i "s/\(!\[.*\]\)(\(.*\))/\1(\/img\/projects\/${project}\/\2)/g" "$file"
}
siot_update_docs() {
echo "updating docs"
img_dest=static/img/projects
rm -rf docs/go docs/hw docs/fw "img_dest"
for project in $siot_projects; do
src=projects/$project/docs
dest=docs/$project
mkdir "$dest"
mkdir -p "$img_dest/$project"
cp "$src"/*.md "$dest/"
cp "$src"/*.png "$img_dest/$project"
cp "$src"/*.jpg "$img_dest/$project"
done
md_files=$(siot_find_md_files)
echo "updating links in files $md_files"
for f in $md_files; do
echo "processing $f"
siot_update_image_links "$f"
done
}