Reply To: Non-breaking space in items?

PennController for IBEX Forums Support Non-breaking space in items? Reply To: Non-breaking space in items?

#11008
mawilson
Participant

I ended up figuring something out; here’s the code I used in case it’s of use to anyone else.

PennController.ResetPrefix(null)

Sequence(
    'example',
    SendResults()
)

Template('example.csv', item => {
    var sentence = item.sentence.split(' ')
    var s_array = []
    for (var word of sentence) {
        word = word.replace(' ', ' ')
        s_array.push(word)
    }
    sentence = s_array
    
    return [
        'example',
        'DashedSentence', 
        {s: sentence, display: 'in place'}
    ] 
})

The basic idea is to modify the item prior to running each trial. I split the sentence on spaces (which won’t split the literal  ). Replace the  s with actual spaces, and then pass that array to the controller instead of the sentence stored in the csv.

  • This reply was modified 4 months ago by mawilson. Reason: make MWE more minimal
  • This reply was modified 4 months ago by mawilson. Reason: fix formatting
  • This reply was modified 4 months ago by mawilson.
  • This reply was modified 4 months ago by mawilson.