<commit_before>#!/bin/bash
#
# creates the appcache manifest under the assumption that there are no
# unnecessary files

listScripts(){
    find script* -name '*.js'
}

listImages(){
    find images -name '*.png'
    find images -name '*.gif'
}

listHTMLs(){
    find * -name '*.html'
}

listPlainFiles(){
#########################################################################
# re-enable when there's a way to actually view them when being offline #
#########################################################################
#    find * -name '*.md'
#    find * -name '*.txt'
#    ls ChangeLog BUGS LICENSE NEWS TODO
    echo>&2
}

listStylesheets(){
    find style* -name '*.css'
}

createManifest(){
    cat << EOF
CACHE MANIFEST
# Version: `cat Version || echo dev`
# Date: `date`

# the boules program is purely offline
CACHE:
`listHTMLs`
`listScripts`
`listImages`
`listPlainFiles`
`listStylesheets`

# allow player database updates
NETWORK:
http://*
https://*
*

EOF
}

######################
# write the manifest #
######################
manifest="manifest.appcache"
createManifest > $manifest

########################################
# apply the manifest to all html files #
########################################
# add manifest links to all html files
for file in `listHTMLs`; do
    relativepath=`sed -e 's:[^./]*/:../:g' -e 's:\(^\|/\)[^/]*$:\1:' <<< "$file"`
    sed -i '/<html/ s:manifest="[^"]*"::g' $file
    sed -i "/<html/ s:\s*>: manifest=\"$relativepath$manifest\">:" $file
done
<commit_msg>manifest script: only showing top-level html files<commit_after>#!/bin/bash
#
# creates the appcache manifest under the assumption that there are no
# unnecessary files

listScripts(){
    find script* -name '*.js'
}

listImages(){
    find images -name '*.png'
    find images -name '*.gif'
}

listHTMLs(){
#    find * -name '*.html'
    ls *.html
}

listStylesheets(){
    find style* -name '*.css'
}

createManifest(){
    cat << EOF
CACHE MANIFEST
# Version: `[ -s Version ] && cat Version || echo dev`
# Date: `date`

# the boules program is purely offline
CACHE:
`listHTMLs`
`listScripts`
`listImages`
`listStylesheets`

# allow player database updates
NETWORK:
http://*
https://*
*

EOF
}

######################
# write the manifest #
######################
manifest="manifest.appcache"
createManifest > $manifest

########################################
# apply the manifest to all html files #
########################################
# add manifest links to all html files
for file in `listHTMLs`; do
    relativepath=`sed -e 's:[^./]*/:../:g' -e 's:\(^\|/\)[^/]*$:\1:' <<< "$file"`
    sed -i '/<html/ s:manifest="[^"]*"::g' $file
    sed -i "/<html/ s:\s*>: manifest=\"$relativepath$manifest\">:" $file
done

{'fraction_non_alphanumeric': 0.2962016070124178, 'fraction_numerical': 0.001095690284879474, 'mean_word_length': 4.217142857142857, 'pattern_counts': {'":': 2, '<': 17, '<?xml version=': 0, '>': 10, 'https://': 2, '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': '4530148', 'n_tokens_mistral': 886, 'n_tokens_neox': 849, 'n_words': 259}