<commit_before>require 'rexml/document'
require 'open-uri'
require 'rubypants'
require 'rdiscount'

class BibleML

  VERSION_IDS = {
    'cev' => 46,
    'niv' => 31,
    'nasb' => 49,
    'message' => 65,
    'amp' => 45,
    'nlt' => 51,
    '21st century kjv' => 48,
    'asv' => 8,
    'darby' => 16,
    'douay-rheims' => 63,
    'esv' => 47,
    'holman' => 77,
    'kjv' => 9,
    'ncv' => 78,
    'nkjv' => 50,
    'new life' => 74,
    'wycliffe' => 53,
    "young" => 15
  }

  def initialize(input)
    @xml = REXML::Document.new("<fg:body xmlns:fg='http://fromgenesis.org'>#{input}</fg:body>")
  end
  
  def to_html
    txt = self.
      primary_passage.
      strip_comments.
      block_quotes.
      inline_quotes.
      wikipedia_links.
      to_s
    txt = RubyPants.new(txt).to_html
    txt = RDiscount.new(txt).to_html
  end
  <commit_msg>Update BibleML#to_html to get rid of &amp;amp;'s<commit_after>require 'rexml/document'
require 'open-uri'
require 'rubypants'
require 'rdiscount'

class BibleML

  VERSION_IDS = {
    'cev' => 46,
    'niv' => 31,
    'nasb' => 49,
    'message' => 65,
    'amp' => 45,
    'nlt' => 51,
    '21st century kjv' => 48,
    'asv' => 8,
    'darby' => 16,
    'douay-rheims' => 63,
    'esv' => 47,
    'holman' => 77,
    'kjv' => 9,
    'ncv' => 78,
    'nkjv' => 50,
    'new life' => 74,
    'wycliffe' => 53,
    "young" => 15
  }

  def initialize(input)
    @xml = REXML::Document.new("<fg:body xmlns:fg='http://fromgenesis.org'>#{input}</fg:body>")
  end
  
  def to_html
    txt = self.
      primary_passage.
      strip_comments.
      block_quotes.
      inline_quotes.
      wikipedia_links.
      to_s
    txt = RubyPants.new(txt).to_html
    txt = RDiscount.new(txt).to_html
    txt.gsub(/&amp;amp;/, '&amp;') # Get rid of double &amp's
  end
  
{'fraction_non_alphanumeric': 0.1790633608815427, 'fraction_numerical': 0.03966942148760331, 'mean_word_length': 2.37546468401487, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '4975637', 'n_tokens_mistral': 837, 'n_tokens_neox': 747, 'n_words': 155}