<commit_before>Base = require "./base"

class QuizChooseMany extends Base
  process: (cb) ->
    [rawContent, trailer] = @splitContentTrailerData()
    content = @renderContentString(rawContent)
    output = """
    <div class="quiz" data-quiz-type="choose-many" data-quiz-data="#{JSON.stringify(trailer)}">
      #{content}
    </div>
    """
    cb(null,output)

module.exports = QuizChooseMany<commit_msg>quiz: normalize choices data<commit_after>Base = require "./base"

class QuizChooseMany extends Base
  process: (cb) ->
    [rawContent, trailer] = @splitContentTrailerData()
    trailer = @normalize(trailer)
    content = @renderContentString(rawContent)
    output = """
    <div class="quiz" data-quiz-type="choose-many" data-quiz-data='#{JSON.stringify(trailer)}'>
      #{content}
    </div>
    """
    cb(null,output)

  normalize: (data) ->
    {
      accept: @normalizeOptions(data.accept)
      reject: @normalizeOptions(data.reject)
    }

  normalizeOptions: (data) ->
    for option in data
      console.log option
      if typeof option == "string"
        {text: option}
      else
        option

module.exports = QuizChooseMany
{'fraction_non_alphanumeric': 0.1412478336221837, 'fraction_numerical': 0.0, 'mean_word_length': 3.3258426966292136, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '4732315', 'n_tokens_mistral': 376, 'n_tokens_neox': 367, 'n_words': 74}