fakestache-ssg

[ARCHIVED] A static site generator in Bash 4.
Log | Files | Refs | Submodules | README

build-pandoc-templates (651B)


      1 #!/bin/bash
      2 
      3 # Convert Mustache templates into Pandoc templates
      4 build_pandoc_templates () {
      5     echo "- Convert Mustache templates into Pandoc templates"
      6 
      7     # Purge the $TPL_PANDOC_PATH/ folder before the conversion
      8     rm -Rf "${TPL_PANDOC_PATH:?}/"*
      9 
     10     # HTML Templates
     11     for mustache in "$TPL_MUSTACHE_PATH/"*.mustache; do
     12         # Remove files path
     13         mustachename=$(basename "$mustache")
     14         # And then the convertion without the mustache extension
     15         mo "$mustache" > "$TPL_PANDOC_PATH/${mustachename%.*}".html
     16     done    
     17 
     18     # Feed Template
     19     mo "$TPL_MUSTACHE_PATH/feed/feed.mustache" > "$TPL_PANDOC_PATH/feed.txt"
     20 }