squeeze

A static site generator that can put the toothpaste back in the tube.
git clone https://git.mulligrubs.me/squeeze
Log | Files | Refs | README | LICENSE

unsqueeze.sh (859B)


      1 #!/usr/bin/env sh
      2 
      3 export SITE_PATH=$1
      4 
      5 export OUTPUT_PATH="$SITE_PATH/output"
      6 export SOURCE_PATH="$SITE_PATH/source"
      7 
      8 # Copy everything that's not HTML.
      9 # Excludes the RSS folder, which we create ourselves upon generation.
     10 # This will also create the folder structure for the destination Markdown files.
     11 rsync --archive --delete --verbose \
     12        --exclude "*.html" --exclude "feeds" \
     13        "$OUTPUT_PATH/" "$SOURCE_PATH/"
     14 
     15 # Parse and create all the Markdown files.
     16 find "$OUTPUT_PATH" -type f -name "*.html" -printf "%P\0" |
     17 	xargs --null --max-procs 99 -I % sh generate_markdown.sh "%" "$SITE_PATH"
     18 
     19 # Unsmarten the punctuation.
     20 find "$SOURCE_PATH" -type f -name "*.md" \
     21 	-exec sed -i "s/ / /g" {} + \
     22 	-exec sed -E -i "s/('|‘|’|’|‘)/'/g" {} + \
     23 	-exec sed -E -i "s/(“|”|”|“|")/\"/g" {} +