<commit_before>from __future__ import with_statement
import sys
import re
import cgi
import os
import os.path

from screenplain.types import *


types = {
    Slug: 'slug',
    Dialog: 'dialog',
    DualDialog: 'dual',
    Action: 'action',
    Transition: 'transition',
}


def to_html(text):
    return re.sub('  ', '&nbsp; ', text.to_html())


def format_dialog(dialog, out):
    out.write(
        '<p class="character">'
    )
    out.write(to_html(dialog.character))
    out.write('</p>')

    for parenthetical, text in dialog.blocks:
        if parenthetical:
            out.write('<p class="parenthetical">')
            out.write(to_html(text))
            out.write('</p>')
        else:
            out.write('<p>')
            out.write(to_html(text))
            out.write('</p>')


def format_dual(dual, out):
    out.write(
        '<div class="left dialog">'
    )
    format_dialog(dual.left, out)
    out.write(
        '</div>'
        '<div class="right dialog">'
    )
    format_dialog(dual.right, out)
    out.write(
        '</div>'
        '<br />'
    )


def format_slug(slug, out):
    out.write('<h2>')
    out.write(to_html(slug.line))
    out.write('</h2>')


def format_action(para, out):
    if para.centered:
        out.write('<div class="action centered">')
    else:
        out.write('<div class="action">')
    for line in para.lines:
        out.write('<p>')
        out.write(to_html(line))
        out.write('</p>')
    out.write('</div>')<commit_msg>Cleaned up a little CSS.<commit_after>from __future__ import with_statement
import sys
import re
import cgi
import os
import os.path

from screenplain.types import *


types = {
    Slug: 'slug',
    Dialog: 'dialog',
    DualDialog: 'dual',
    Action: 'action',
    Transition: 'transition',
}


def to_html(text):
    return re.sub('  ', '&nbsp; ', text.to_html())


def format_dialog(dialog, out):
    out.write(
        '<p class="character">'
    )
    out.write(to_html(dialog.character))
    out.write('</p>')

    for parenthetical, text in dialog.blocks:
        if parenthetical:
            out.write('<p class="parenthetical">')
            out.write(to_html(text))
            out.write('</p>')
        else:
            out.write('<p>')
            out.write(to_html(text))
            out.write('</p>')


def format_dual(dual, out):
    out.write(
        '<div class="left">'
    )
    format_dialog(dual.left, out)
    out.write(
        '</div>'
        '<div class="right">'
    )
    format_dialog(dual.right, out)
    out.write(
        '</div>'
        '<br />'
    )


def format_slug(slug, out):
    out.write('<h2>')
    out.write(to_html(slug.line))
    out.write('</h2>')


def format_action(para, out):
    if para.centered:
        out.write('<div class="action centered">')
    else:
        out.write('<div class="action">')
    for line in para.lines:
        out.write('<p>')
        out.write(to_html(line))
        out.write('</p>')
    out.write('</div>')
{'fraction_non_alphanumeric': 0.17040508871777704, 'fraction_numerical': 0.0013391362571141614, 'mean_word_length': 2.3273942093541202, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, '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': '5688308', 'n_tokens_mistral': 1036, 'n_tokens_neox': 1027, 'n_words': 203}