<commit_before>open Type
open Render
open TomlType
open Unix

let greek_letters = [
  'a', "alpha";
  'b', "beta";
  'g', "gamma";
  'd', "delta";
  'e', "epsilon";
  'z', "zeta";
  't', "tau";
  'i', "iota";
  'k', "kappa";
  'l', "lambda";
  'm', "mu";
  'n', "nu";
  'o', "omicron";
  'p', "pi";
  'r', "rho";
  's', "sigma";
  'u', "upsilon";
  'c', "chi";
  'w', "omega";
  'y', "#968"
]

class render_html (mode : Render.mode) (config : TomlType.tomlTable) =
object(self)

  inherit render mode config as super

  method private add_char = Buffer.add_char buffer

  method private add_string = Buffer.add_string buffer

  method private esc_add_str str =
    let rep = [ "&", "&amp;"; "<", "&lt;"; ">", "&gt;";] in
    self#add_string
    @@ List.fold_left (fun str (reg, rep) ->
                       Str.global_replace (Str.regexp reg) rep str) str rep
                                     
  method private add_strings = List.iter self#add_string

  method private render_inlines = fun inlines ->
    let render_inline = function
      | Plain(str) -> self#esc_add_str str
      | InlineCode(str) ->
         self#add_string "<code>";
         self#esc_add_str str;
         self#add_string "</code>"
      | InlineSource(str) -> self#add_string str
      | InlineMath(inlines) ->
         self#add_string "<span class=\"inline_math\">";
         self#render_inlines inlines;
         self#add_string "<span class=\"inline_math\">";<commit_msg>closing HTML tag for inline math fixed<commit_after>open Type
open Render
open TomlType
open Unix

let greek_letters = [
  'a', "alpha";
  'b', "beta";
  'g', "gamma";
  'd', "delta";
  'e', "epsilon";
  'z', "zeta";
  't', "tau";
  'i', "iota";
  'k', "kappa";
  'l', "lambda";
  'm', "mu";
  'n', "nu";
  'o', "omicron";
  'p', "pi";
  'r', "rho";
  's', "sigma";
  'u', "upsilon";
  'c', "chi";
  'w', "omega";
  'y', "#968"
]

class render_html (mode : Render.mode) (config : TomlType.tomlTable) =
object(self)

  inherit render mode config as super

  method private add_char = Buffer.add_char buffer

  method private add_string = Buffer.add_string buffer

  method private esc_add_str str =
    let rep = [ "&", "&amp;"; "<", "&lt;"; ">", "&gt;";] in
    self#add_string
    @@ List.fold_left (fun str (reg, rep) ->
                       Str.global_replace (Str.regexp reg) rep str) str rep
                                     
  method private add_strings = List.iter self#add_string

  method private render_inlines = fun inlines ->
    let render_inline = function
      | Plain(str) -> self#esc_add_str str
      | InlineCode(str) ->
         self#add_string "<code>";
         self#esc_add_str str;
         self#add_string "</code>"
      | InlineSource(str) -> self#add_string str
      | InlineMath(inlines) ->
         self#add_string "<span class=\"inline_math\">";
         self#render_inlines inlines;
         self#add_string "</span>";
{'fraction_non_alphanumeric': 0.17307692307692307, 'fraction_numerical': 0.0020604395604395605, 'mean_word_length': 2.701397712833545, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2313070', 'n_tokens_mistral': 1052, 'n_tokens_neox': 1021, 'n_words': 266}