<commit_before>#!/usr/bin/python3

import argparse
import json
#from pprint import pprint

from board import Board


release = "0.3pre"


def main():
    parser = argparse.ArgumentParser(description='Print Trello.com JSON file')
    parser.add_argument('-f', '--format', choices=["text", "markdown", "html"],
         default="markdown")
    parser.add_argument('source', metavar="json_file")
    parser.add_argument('-v', '--version', action='version',
        version='TrelloPrint ' + release)
    args = parser.parse_args()

    filename = args.source

    f = open(filename)
    data = json.load(f)
    f.close()

    b = Board(data)
    if (args.format == "text"):
        print(b)

    md_string = b.get_md()
    if (args.format == "markdown"):
        print(md_string)

if __name__ == "__main__":
    main()<commit_msg>Added html support through markdown external program<commit_after>#!/usr/bin/python3

import os

import argparse
import json

from board import Board


RELEASE = "0.3pre"

TEMP_FILE_NAME = "/tmp/tp.md"


def main():
    parser = argparse.ArgumentParser(description='Print Trello.com JSON file')
    parser.add_argument('-f', '--format', choices=["text", "markdown", "html"],
         default="markdown")
    parser.add_argument('source', metavar="json_file")
    parser.add_argument('-v', '--version', action='version',
        version='TrelloPrint ' + RELEASE)
    args = parser.parse_args()

    filename = args.source

    f = open(filename)
    data = json.load(f)
    f.close()

    b = Board(data)
    if (args.format == "text"):
        print(b)
        exit

    md_string = b.get_md()
    if (args.format == "markdown"):
        print(md_string)
        exit

    if (args.format == "html"):
        temp_fd = open(TEMP_FILE_NAME, "w")
        temp_fd.write(md_string)
        temp_fd.close()
        os.system("markdown " + TEMP_FILE_NAME)
        os.remove(TEMP_FILE_NAME)


if __name__ == "__main__":
    main()
{'fraction_non_alphanumeric': 0.15084658799384298, 'fraction_numerical': 0.0030785017957927143, 'mean_word_length': 3.020618556701031, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '6151760', 'n_tokens_mistral': 660, 'n_tokens_neox': 643, 'n_words': 138}