Created
August 23, 2016 18:17
-
-
Save austinjp/c71b71dcd0869a33c66d3f854af7d39d to your computer and use it in GitHub Desktop.
Creates a single page that includes every file. Outputs "onepage.md". You need to add this to your SUMMARY.md (or equivalent) for gitbook to render it.
This file contains 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/bash | |
# Expand current directory to absolute path: | |
declare wd="." | |
declare wd=$( cd $(dirname $wd) ; pwd -P ) | |
declare filelistfile="/tmp/onepager.txt" | |
# FIXME use $wd in redirect | |
# cat "$wd/SUMMARY.md" | perl -ne "s/^.+\((.+)\)$/$wd/$1/msg; s/^\#.*$//msg; s/\s+/ /msg; //; print;" > "$filelistfile" | |
cat "$wd/SUMMARY.md" | perl -ne 's/^.*\((.+)\).*$/$1/msg; s/^\#.*$//msg; s/\s+/ /msg; print $_."\n" if($_);' > "$filelistfile" | |
declare gitbook_files=`cat "$filelistfile"` | |
cat "$filelistfile" | perl -ne 'chomp; print "{% include \"".$_."\" %}\n\n" if (/[a-zA-Z0-9]/msg)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment