-
-
Save 100ideas/d10eb730435be5b00e43 to your computer and use it in GitHub Desktop.
Generate GitBook project for Hexo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Setup the directory name | |
DIRNAME=GitBook | |
# Remove the old GitBook directory | |
rm -fr $DIRNAME | |
mkdir $DIRNAME | |
# Generate the README.md | |
cat <<-EOF >$DIRNAME/README.md | |
# My Blog | |
This is auto generated file for editing blog with GitBook. | |
EOF | |
# Generate the SUMMARY.md | |
cat <<-EOF >$DIRNAME/SUMMARY.md | |
# Summary | |
* [Introduction](README.md) | |
EOF | |
for i in `ls -t source/_{drafts,posts}/*.md`; do | |
title=`cat $i | sed -n 's/title: \(.*\)/\1/p'` | |
echo "* [$title](../$i)" >> $DIRNAME/SUMMARY.md | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment