def render_plain(self, input_string): """ Render a plain version of the description, no markdown """ plain = As.markup_convert_simple(input_string) plain = plain.replace(""", "\"").replace("'", "'").replace("&", "&") return plain
def update_description(self): # I have become GTK - Destroyer Of Children for child in self.description_box.get_children(): child.destroy() id = self.item.get_id() fallback = self.item.get_description() desc = self.context.appsystem.get_description(id, fallback) plain = As.markup_convert(desc, As.MarkupConvertFormat.MARKDOWN) lines = [] try: self.parser.consume(plain) lines = self.parser.emit() except Exception as e: print("Parsing error: {}".format(e)) plain = As.markup_convert_simple(desc) lines = plain.split("\n") for line in lines: lab = Gtk.Label(line) lab.set_use_markup(True) lab.set_halign(Gtk.Align.START) lab.set_line_wrap(True) lab.set_property("xalign", 0.0) lab.set_property("margin", 2) lab.set_margin_bottom(4) self.description_box.pack_start(lab, False, False, 0) lab.show_all()
def update_description(self): # I have become GTK - Destroyer Of Children for child in self.description_box.get_children(): child.destroy() id = self.item.get_id() fallback = self.item.get_description() store = self.item.get_store() desc = self.context.appsystem.get_description(id, fallback, store) plain = As.markup_convert(desc, As.MarkupConvertFormat.MARKDOWN) lines = [] try: self.parser.consume(plain) lines = self.parser.emit() except Exception as e: print("Parsing error: {}".format(e)) plain = As.markup_convert_simple(desc) lines = plain.split("\n") for line in lines: lab = Gtk.Label(line) lab.set_use_markup(True) lab.set_halign(Gtk.Align.START) lab.set_line_wrap(True) lab.set_property("xalign", 0.0) lab.set_property("margin", 2) lab.set_margin_bottom(4) self.description_box.pack_start(lab, False, False, 0) lab.show_all()
def test_markup(desc): m = AS.markup_convert_simple(desc) return m
def render_plain(input_string): """ Render a plain version of the description, no markdown """ plain = As.markup_convert_simple(input_string) plain = plain.replace(""", "\"").replace("'", "'").replace("&", "&") return plain