PennController for IBEX › Forums › Support › Non-breaking space in items? › Reply To: Non-breaking space in items?
March 26, 2024 at 6:27 pm
#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.