1 Star 0 Fork 24

a2a/system-design-primer

forked from egege/system-design-primer 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
generate-epub.sh 1.16 KB
一键复制 编辑 原始数据 按行查看 历史
Kian-Meng Ang 提交于 2022-04-23 21:14 . Fix typos (#661)
#! /usr/bin/env bash
generate_from_stdin() {
outfile=$1
language=$2
echo "Generating '$language' ..."
pandoc --metadata-file=epub-metadata.yaml --metadata=lang:$2 --from=markdown -o $1 <&0
echo "Done! You can find the '$language' book at ./$outfile"
}
generate_with_solutions () {
tmpfile=$(mktemp /tmp/sytem-design-primer-epub-generator.XXX)
cat ./README.md >> $tmpfile
for dir in ./solutions/system_design/*; do
case $dir in *template*) continue;; esac
case $dir in *__init__.py*) continue;; esac
: [[ -d "$dir" ]] && ( cd "$dir" && cat ./README.md >> $tmpfile && echo "" >> $tmpfile )
done
cat $tmpfile | generate_from_stdin 'README.epub' 'en'
rm "$tmpfile"
}
generate () {
name=$1
language=$2
cat $name.md | generate_from_stdin $name.epub $language
}
# Check if dependencies exist
check_dependencies () {
for dependency in "${dependencies[@]}"
do
if ! [ -x "$(command -v $dependency)" ]; then
echo "Error: $dependency is not installed." >&2
exit 1
fi
done
}
dependencies=("pandoc")
check_dependencies
generate_with_solutions
generate README-ja ja
generate README-zh-Hans zh-Hans
generate README-zh-TW zh-TW
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hjn94/system-design-primer.git
git@gitee.com:hjn94/system-design-primer.git
hjn94
system-design-primer
system-design-primer
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385