Beispiel #1
0
    def OnEditGlosstext(self, evt):
        if not self.freeze:
            self.FitGlosstextWidth()
            glosstext = self.glosstext.GetValue()
            oldgloss = self.as_gloss
            try:
                toks = grammar.str_tokenize(glosstext)
                self.as_gloss = grammar.stringgloss_parser().parse(toks)
                if not self.as_gloss == oldgloss:
                    self.glosstext.SetBackgroundColour(wx.NullColour)
                    self.UpdateInterface(self.as_gloss)
                    self.parent.GetTopLevelParent().processor.dirty = True
                else:
                    self.glosstext.SetBackgroundColour('yellow')

            except (LexerError, NoParseError) as e:
                self.glosstext.SetBackgroundColour('yellow')
Beispiel #2
0
def glosstext_to_html(glosstext, variant=False, **kwargs):
    """Serialize text representation of a gloss into HTML string"""
    toks = grammar.str_tokenize(glosstext)
    gloss = grammar.stringgloss_parser().parse(toks)
    html = gloss_to_html(gloss, variant=variant)
    return e.tostring(html, **kwargs)
Beispiel #3
0
def glosstext_to_html(glosstext, variant=False, **kwargs):
    """Serialize text representation of a gloss into HTML string"""
    toks = grammar.str_tokenize(glosstext)
    gloss = grammar.stringgloss_parser().parse(toks)
    html = gloss_to_html(gloss, variant=variant)
    return e.tostring(html, **kwargs)