String::__defineGetter__ 'escaped', () -> this.replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') // rosettacode doesn't like " text = ''' Character,Speech The multitude,The messiah! Show us the messiah! Brians mother,Now you listen here! He's not the messiah; he's a very naughty boy! Now go away! The multitude,Who are you? Brians mother,I'm his mother; that's who! The multitude,Behold his mother! Behold his mother! ''' lines = (line.split ',' for line in text.split /[\n\r]+/g) header = lines.shift() console.log """ """ for line in lines [character, speech] = line console.log """ """ console.log """
#{header[0]} #{header[1]}
#{character} #{speech.escaped}
"""