Exemplo n.º 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')
Exemplo n.º 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)
Exemplo n.º 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)