#!/bin/sh
# Extract body images from all .*.html source files in the current directory.
# Lists unique static body files (IMG) from under img/ with CSS class.
# TODO: Gallery files.

# To build desktop body images (mobile/lite built recursively):
# If width and height are not available then they can be "".
#     script/get_hero_img_inline floatImg $src .X.html ./ false $width $height $class

# Can be used to drive eager image rebuilds independent of page rebuilds.

# May collect too many, since:
#   * This may pick up too many input files including stale ones.

# May collect too few, since:
#   * This ignores width and height (and position in file).
#   * This ignores out/ images.
#   * This ignores Gallery images.

cat .*.html | \
    awk '/^ *<IMG  *src="img\/[^ "]*"  *class="[a-zA-Z][^ "]*" .*\/> *$/ {
    print substr($2,6,length($2)-6), substr($3,8,length($3)-8)
    }' | \
    sort -u
