// Generated by CoffeeScript 1.10.0 (function() { window.Editor = Backbone.D3View.extend({ namespace: null, tagName: 'div', events: { input: 'compile' }, initialize: function(conf) { this.d3el.classed('editor', true); this.textarea = this.d3el.append('textarea'); this.status_bar = this.d3el.append('div').attr({ "class": 'status_bar' }); this.parser = PEG.buildParser(conf.grammar); this.textarea.node().value = 'This is <B>, a language that can be used to select portions of text for <A>.\n\n<1> are allowed>2>, as well as <N>. Moreover, <B> <33> for overlapping spans>4>.\n\nActual annotations are based on RDF triples, and are included in one or more sections like the following one:\n+++\nA foaf:page https://en.wikipedia.org/wiki/Annotation\n+++'; return this.compile(); }, compile: function() { var data, e, error; this.status_bar.text('All ok.'); this.status_bar.classed('error', false); try { data = this.parser.parse(this.textarea.node().value); return this.model.set('annotations', data.spans); } catch (error) { e = error; this.status_bar.text("Line " + e.location.start.line + ": " + e.message); return this.status_bar.classed('error', true); } } }); }).call(this);