<commit_before># @author          <NAME>
# @copyright       Copyright (c) 2008-2015, <NAME> aka LONGMAN (<EMAIL>)
# @link            http://longman.me
# @license         The MIT License (MIT)

import os
import sys
import re
import sublime
import subprocess

directory = os.path.dirname(os.path.realpath(__file__))
libs_path = os.path.join(directory, "lib")
libs_path = os.path.join(libs_path, "htmlbeautifier")

print(libs_path)

if libs_path not in sys.path:
    sys.path.append(libs_path)

from bs4 import BeautifulSoup

class HtmlFormatter:
    def __init__(self, formatter):
        self.formatter = formatter
        self.opts = formatter.settings.get('codeformatter_html_options')

    def format(self, text):
        text = text.decode("utf-8")
        stderr = ""
        stdout = ""

        p_indent_size = 4
        if "indent_size" in self.opts:
            p_indent_size = self.opts["indent_size"]

        try:
            soup = BeautifulSoup(text, 'html.parser')
            stdout = soup.prettify(indent_size=p_indent_size)<commit_msg>Fixed html formatter regression<commit_after># @author          <NAME>
# @copyright       Copyright (c) 2008-2015, <NAME> aka LONGMAN (<EMAIL>)
# @link            http://longman.me
# @license         The MIT License (MIT)

import os
import sys
import re
import sublime
import subprocess

directory = os.path.dirname(os.path.realpath(__file__))
libs_path = os.path.join(directory, "lib")
libs_path = os.path.join(libs_path, "htmlbeautifier")

if libs_path not in sys.path:
    sys.path.append(libs_path)

from bs4 import BeautifulSoup

class HtmlFormatter:
    def __init__(self, formatter):
        self.formatter = formatter
        self.opts = formatter.settings.get('codeformatter_html_options')

    def format(self, text):
        text = text.decode("utf-8")
        stderr = ""
        stdout = ""

        p_indent_size = 4
        if "indent_size" in self.opts:
            p_indent_size = self.opts["indent_size"]

        try:
            soup = BeautifulSoup(text, 'html.parser')
            stdout = soup.prettify(formatter=None,indent_size=p_indent_size)
{'fraction_non_alphanumeric': 0.11137328928739972, 'fraction_numerical': 0.010382255781028787, 'mean_word_length': 2.8686131386861313, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '6587957', 'n_tokens_mistral': 716, 'n_tokens_neox': 667, 'n_words': 155}