How to use the atelier.rstgen.ul function in atelier

To help you get started, we’ve selected a few atelier examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lino-framework / lino / lino / core / renderer.py View on Github external
def menu2rst(self, ar, mnu, level=1):
        """Used by :meth:`show_menu`."""

        if not isinstance(mnu, Menu):
            return str(mnu.label)

        has_submenus = False
        for i in mnu.items:
            if isinstance(i, Menu):
                has_submenus = True
        items = [self.menu2rst(ar, mi, level + 1) for mi in mnu.items]
        if has_submenus:
            s = rstgen.ul(items).strip() + '\n'
            if mnu.label is not None:
                s = str(mnu.label) + ' :\n\n' + s
        else:
            s = ', '.join(items)
            if mnu.label is not None:
                s = str(mnu.label) + ' : ' + s
        return s
github lino-framework / lino / lino / sphinxcontrib / actordoc.py View on Github external
items = []
    for tb in model_reports:
        desc = actor_ref(tb)
        #~ label = str(tb.title or tb.label)
        #~ desc += " (%s)" % str(tb)
        desc += " (%s)" % typeref(tb)
        # mi = find_menu_item(tb.default_action)
        mi = user_type.find_menu_item(tb.default_action)
        if mi is not None:
            desc += _(" (Menu %s)") % menuselection(mi)
            #~ print(unicode(mi.label).strip())
        if tb.help_text:
            desc += " -- " + str(tb.help_text).strip()

        items.append(desc)
    return rstgen.ul(items)
github lino-framework / lino / lino / utils / diag.py View on Github external
p.append((m, fk))

        def fk2str(mfk):
            return "{0}.{1}".format(fmn(mfk[0]), mfk[1].name)

        items1 = []
        for target, dp in list(tdp.items()):
            items2 = []
            for dh, pl in list(dp.items()):
                items2.append(
                    "{0} : {1}".format(
                        dh.__name__, ', '.join([fk2str(mfk) for mfk in pl])))
            if len(items2):
                items2 = sorted(items2)
                items1.append("{0} :\n{1}".format(
                    fmn(target), rstgen.ul(items2)))

        items1 = sorted(items1)
        return rstgen.ul(items1)
github lino-framework / lino / lino / sphinxcontrib / actordoc.py View on Github external
raise Exception("%s is not an actor." % self.content[0])
                desc = "**{0}** (:class:`{1} <{2}>`)".format(
                    force_text(cls.label),
                    cls.__name__,
                    cls.__module__ + '.' + cls.__name__
                )
                mi = user_type.find_menu_item(cls.default_action)
                if mi is not None:
                    desc += _(" (Menu %s)") % menuselection(mi)
                    #~ print(str(mi.label).strip())
                if cls.help_text:
                    desc += "  : " + force_text(cls.help_text).strip()

                # items.append("%s : %s" % (actor_ref(cls), cls.help_text or ''))
                items.append(desc)
            return rstgen.ul(items)
github lino-framework / lino / lino / utils / diag.py View on Github external
def show_window_permissions(self):
        self.analyze()
        items = []
        for ba in analyzer.window_actions:
            items.append(
                "{0} : visible for {1}".format(
                    ba.full_name(), visible_for(ba)))

        return rstgen.ul(items)
github lino-framework / lino / lino / sphinxcontrib / actordoc.py View on Github external
def actions_ul(action_list):
    items = []
    for ba in action_list:
        label = ba.action.label
        desc = "**%s** (" % str(label).strip()
        if ba.action.action_name:
            desc += "``%s``" % ba.action.action_name

        desc += ", %s)" % typeref(ba.action.__class__)
        if ba.action.help_text:
            desc += " -- " + str(ba.action.help_text)
        items.append(desc)
    return rstgen.ul(items)
github lino-framework / lino / lino / sphinxcontrib / actordoc.py View on Github external
helpless.append(s)
        return None

    items = []
    for f in fields:
        if not hasattr(f, '_lino_babel_field'):
            s = field2li(f)
            if s:
                items.append(s)
    #~ items = [ field2li(f) for f in fields if not hasattr(f,'_lino_babel_field')]
    if len(helpless):
        s = ', '.join(helpless)
        if len(items):
            s = _("... and %s") % s
        items.append(s)
    return rstgen.ul(items)
github lino-framework / lino / lino / utils / diag.py View on Github external
def show_fields(self, model, field_names=None, languages=None):
        model = dd.resolve_model(model)
        if field_names is not None:
            field_names = dd.fields_list(model, field_names)
        items = []
        for f in model._meta.fields:
            if field_names is None or f.name in field_names:
                name = f.name
                ref = model.__module__ + '.' + model.__name__ + '.' + name
                verbose_name = force_text(f.verbose_name).strip()
                help_text = force_text(f.help_text).replace('\n', ' ')
                txt = "**{verbose_name}** (:attr:`{name} <{ref}>`) : " \
                      "{help_text}".format(**locals())
                items.append(txt)
        return rstgen.ul(items)
github lino-framework / lino / lino / utils / diag.py View on Github external
def show_action_permissions(self, *classes):
        self.analyze()
        items = []
        for ba in analyzer.custom_actions + analyzer.window_actions:
            if isinstance(ba.action, classes):
                items.append(
                    "{0} : visible for {1}".format(
                        ba.full_name(), visible_for(ba)))

        return rstgen.ul(items)