<commit_before>#-------------------------------------------------------------------------------
# htmlize-ast-dump.py: Turn a Clang AST dump (-ast-dump) into cross-linked HTML.
#
# Run with --help for usage information.
#
# Note: this script requires Python 3.4
#
# <NAME> (<EMAIL>)
# This code is in the public domain
#-------------------------------------------------------------------------------
import argparse
import enum
import html
import io
import pprint
import re
import sys

# Template for full HTML output. This template is filled in with .format;
# therefore, '{' and '}'s need to be escaped.
HTML_OUTPUT_TEMPLATE = r'''
<html>
<head>
    <style>
    html * {{
        background-color: black;
        white-space: nowrap;
    }}

    a:link {{
        text-decoration: underline;
        color: inherit;
    }}

    a:visited {{
        text-decoration: underline;
        color: inherit;
    }}

    a:hover {{
        text-decoration: underline;
        color: #FFFFFF;
    }}

    a:active {{
        text-decoration: underline;
        color: #FFFFFF;
    }}

    .ansi-bold {{
        font-weight: bold;
    }}

    .ansi-black {{
        color: #000000;
    }}

    .ansi-red {{
        color: #d23737;
    }}

    .ansi-green {{
        color: #17b217;
    }}

    .ansi-yellow {{
        color: #b26717;
    }}

    .ansi-blue {{
        color: #2727c2;
    }}

    .ansi-magenta {{
        color: #b217b2;
    }}

    .ansi-cyan {{
        color: #17b2b2;
    }}

    .ansi-white {{
        color: #f2f2f2;
    }}
    </style>
</head>
<body>
<code>
{lines}
</code>
</body>
</html>
'''

SPAN_TEMPLATE = r'<span class="{klass}">{text}</span>'


class Color(enum.Enum):
    """Colors with values corresponding to the ANSI codes.<commit_msg>Use fixed-width font and whitespace preservation<commit_after>#-------------------------------------------------------------------------------
# htmlize-ast-dump.py: Turn a Clang AST dump (-ast-dump) into cross-linked HTML.
#
# Run with --help for usage information.
#
# Note: this script requires Python 3.4
#
# <NAME> (<EMAIL>)
# This code is in the public domain
#-------------------------------------------------------------------------------
import argparse
import enum
import html
import io
import pprint
import re
import sys

# Template for full HTML output. This template is filled in with .format;
# therefore, '{' and '}'s need to be escaped.
HTML_OUTPUT_TEMPLATE = r'''
<html>
<head>
    <style>
    html * {{
        background-color: black;
        white-space: nowrap;
    }}

    .my-pre {{
        line-height: 0.8;
        padding: 0px 0px;
        font-family: Consolas,monospace;
        font-size: 80%;
    }}

    a:link {{
        text-decoration: underline;
        color: inherit;
    }}

    a:visited {{
        text-decoration: underline;
        color: inherit;
    }}

    a:hover {{
        text-decoration: underline;
        color: #FFFFFF;
    }}

    a:active {{
        text-decoration: underline;
        color: #FFFFFF;
    }}

    .ansi-bold {{
        font-weight: bold;
        white-space: pre;
    }}

    .ansi-black {{
        color: #000000;
        white-space: pre;
    }}

    .ansi-red {{
        color: #d23737;
        white-space: pre;
    }}

    .ansi-green {{
        color: #17b217;
        white-space: pre;
    }}

    .ansi-yellow {{
        color: #b26717;
        white-space: pre;
    }}

    .ansi-blue {{
        color: #2727c2;
        white-space: pre;
    }}

    .ansi-magenta {{
        color: #b217b2;
        white-space: pre;
    }}

    .ansi-cyan {{
        color: #17b2b2;
        white-space: pre;
    }}

    .ansi-white {{
        color: #f2f2f2;
        white-space: pre;
    }}
    </style>
</head>
<body>
<pre class="my-pre">
{lines}
</pre>
</body>
</html>
'''

SPAN_TEMPLATE = r'<span class="{klass}">{text}</span>'


class Color(enum.Enum):
    """Colors with values corresponding to the ANSI codes.
{'fraction_non_alphanumeric': 0.21410451547437848, 'fraction_numerical': 0.0213089802130898, 'mean_word_length': 1.568729641693811, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, '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': '2852564', 'n_tokens_mistral': 1342, 'n_tokens_neox': 1255, 'n_words': 319}