<commit_before>#!/bin/sh

OUT="$HOME/htdocs/hdocs"
PKG_DB="$HOME/.ghc/x86_64-freebsd-7.8.2/package.conf.d"
DIR="/tmp/standalone-haddock"

CMD="standalone-haddock -o $OUT --package-db $PKG_DB --hyperlink-source"

# input

PKGS="$@"

# run

mkdir "$DIR" 2>/dev/null

cd $DIR

for pkg in $PKGS; do

  if [ ! -d $pkg ]; then

    # get package from haddock
    cabal unpack $pkg
    $CMD $pkg*

  else

    # run standalone-haddock in directory
    $CMD $pkg

  fi

done
<commit_msg>Fix for local directories<commit_after>#!/bin/sh

OUT="$HOME/htdocs/hdocs"
PKG_DB="$HOME/.ghc/x86_64-freebsd-7.8.2/package.conf.d"

TMP="/tmp/standalone-haddock"
PWD=`pwd`

CMD="standalone-haddock -o $OUT --package-db $PKG_DB --hyperlink-source"

# input

PKGS="$@"

# run

for pkg in $PKGS; do

  if [ -d ${pkg} -a -f ${pkg}/*.cabal ]; then

    # run standalone-haddock in directory
    $CMD $pkg

  else

    echo "Downloading $pkg from haddock"

    mkdir "$TMP" 2>/dev/null
    cd $TMP
    # get package from haddock
    cabal unpack $pkg
    $CMD $pkg*
    cd $PWD

  fi

done

{'fraction_non_alphanumeric': 0.160075329566855, 'fraction_numerical': 0.015065913370998116, 'mean_word_length': 2.851449275362319, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4296938', 'n_tokens_mistral': 472, 'n_tokens_neox': 440, 'n_words': 104}