diff --git a/folder_template.html b/folder_template.html index 7fddc41ab3343d983c1de560d19ceb2b2b08fee9..566bfc6533befb606eda9f766bdc65a99dc74e87 100644 --- a/folder_template.html +++ b/folder_template.html @@ -10,7 +10,7 @@ <body class="folder"> <h1>Quack <span style="color: #999">${SRC_FOLDER}</span></h1> -<div class="foldersnippet">${SNIPPET_FOLDER}</div> +<div class="foldersnippet">${SNIPPET}</div> <!-- TODO: Create decent bread crumbs --> <p>Parent folder: <a href="../index.html">${PARENT}</a></p> diff --git a/image_template.html b/image_template.html index 469f3965ae9ecfa0b30e0a82c60322656b9ac0f1..eb3f5aa351ad531860cbe738fc8f08a811600bb2 100644 --- a/image_template.html +++ b/image_template.html @@ -19,7 +19,7 @@ ${IDPREVS} <body class="previewpage"> <h1>Quack <span style="color: #999">${SOURCE_SHORT}</span></h1> -<div class="imagesnippet">${SNIPPET_IMAGE}</div> +<div class="imagesnippet">${SNIPPET}</div> <div id="controlpanel" class="control"> <p class="navigation">${NAVIGATION}</p> diff --git a/quack.sh b/quack.sh index b5603bfbbfd96620620f8f714a7f09e57af351ac..8f97172b9e57ae6c7cb9c6152a9a4ed40364096f 100755 --- a/quack.sh +++ b/quack.sh @@ -133,12 +133,23 @@ export OVERLAY_WHITE=FFFF00 # Snippets are inserted verbatim at the top of the folder and the image pages. # Use them for specifying things like delivery date or provider notes. +# Note that these snippet can be overridden on a per-folder and per-image basis +# by creating special files in the source tree (see SPECIFIC_FOLDER_SNIPPET and +# SPECIFIC_IMAGE_SNIPPET_EXTENSION below). export SNIPPET_FOLDER="" export SNIPPET_IMAGE="" # End default settings. User-supplied overrides will be loaded from quack.settings +# If present in a source-folder, the content of the folder will be inserted into +# the generated folder HTML file. +SPECIFIC_FOLDER_SNIPPET="folder.snippet" + +# If a file with image basename + this extension is encountered, the content will +# be inserted into the generated image HTML file. +SPECIFIC_IMAGE_SNIPPET_EXTENSION=".snippet" + pushd `dirname $0` > /dev/null ROOT=`pwd` @@ -590,6 +601,14 @@ function makePreviewPage() { BASE=${SANS_PATH%.*} P="${DEST_FOLDER}/${BASE}.html" + local SSNIP="${BASE}${SPECIFIC_IMAGE_SNIPPET_EXTENSION}" + + if [ -f $SSNIP ]; then + SNIPPET=`cat $SSNIP` + else + SNIPPET="$SNIPPET_FOLDER" + fi + # Used by function caller PAGE_LINK="${BASE}.html" @@ -742,6 +761,11 @@ function makeIndex() { exit fi pushd $SRC_FOLDER > /dev/null + if [ -f $SPECIFIC_FOLDER_SNIPPET ]; then + SNIPPET=`cat $SPECIFIC_FOLDER_SNIPPET` + else + SNIPPET="$SNIPPET_FOLDER" + fi local SRC_FOLDER=`pwd` popd > /dev/null echo "Processing $SRC_FOLDER"