<commit_before>#! /bin/sh
set -e
usage () {
    printf "%s\n\n" "$*"
    printf "usage: %s [-g GitHub_Username]\n" ${0##*/}
    exit 1
}

while getopts g:h flag
do
    case $flag in
        g)  githubuser=${OPTARG};;
        h)  usage "";;
        \?) usage "unrecognized option flag";;
    esac
done

# SVG examples/ regeneration.
go test -run . -v -write

(cd cmd/goat; go install)

if [ "$githubuser" ]
then
    # Github home page README.md, specific to $githubuser:
    linktargetsub="s,{{\.Root}},https://cdn.rawgit.com/${githubuser}/goat/main,"
else
    # by default, build README.md for local inspection
    linktargetsub="s,{{.Root}},.,"
fi
sed "${linktargetsub}" README.md.tmpl >README.md

if [ ! "$githubuser" ]
then
    # build README.html for local inspection
    # See https://github.github.com/gfm/#introduction
    #
    # The @media query from SVG may be verified in Firefox by switching between Themes
    #    "Light" and "Dark" in Firefox's "Add-ons Manager".
    (echo '<!DOCTYPE html>'; marked -gfm README.md) >README.html
fi
<commit_msg>Allow make.sh to pass args to the "go test" run that rebuilds SVG examples<commit_after>#! /bin/sh
set -e
usage () {
    printf "%s\n\n" "$*"
    printf "usage: %s [-g GitHub_Username]\n" ${0##*/}
    exit 1
}

while getopts g:h flag
do
    case $flag in
        g)  githubuser=${OPTARG};;
        h)  usage "";;
        \?) usage "unrecognized option flag";;
    esac
done

# SVG examples/ regeneration.
#
# If the command fails due to expected changes in SVG output, rerun
# this script with "TEST_ARGS=-write" first on the command line.
set -vx
go test -run . -v ${TEST_ARGS}

(cd cmd/goat; go install)

if [ "$githubuser" ]
then
    # Github home page README.md, specific to $githubuser:
    linktargetsub="s,{{\.Root}},https://cdn.rawgit.com/${githubuser}/goat/main,"
else
    # by default, build README.md for local inspection
    linktargetsub="s,{{.Root}},.,"
fi
sed "${linktargetsub}" README.md.tmpl >README.md

if [ ! "$githubuser" ]
then
    # build README.html for local inspection
    # See https://github.github.com/gfm/#introduction
    #
    # The @media query from SVG may be verified in Firefox by switching between Themes
    #    "Light" and "Dark" in Firefox's "Add-ons Manager".
    (echo '<!DOCTYPE html>'; marked -gfm README.md) >README.html
fi
{'fraction_non_alphanumeric': 0.14997851310700472, 'fraction_numerical': 0.0017189514396218307, 'mean_word_length': 3.0416666666666665, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7328442', 'n_tokens_mistral': 818, 'n_tokens_neox': 790, 'n_words': 254}