.. todo: cell coloring, footer etc.
+`Labels`_
+=========
+
+Use :rst:`:label-default:` etc. or :rst:`:label-flat-default:` etc. to create
+inline `text labels <{filename}/css/components.rst#labels>`_.
+
+.. code-figure::
+
+ .. code:: rst
+
+ - Design direction and project goals :label-success:`done`
+ - Automated testing :label-danger:`missing`
+ :label-flat-warning:`in progress`
+
+ - Design direction and project goals :label-success:`done`
+ - Automated testing :label-danger:`missing`
+ :label-flat-warning:`in progress`
+
`Other m.css features`_
=======================
Right column content.
-For inline components, derive a custom role with additional CSS classes. For
-example:
+For inline components not mentioned above, derive a custom role with additional
+CSS classes. For example:
.. code-figure::
.. code:: rst
- .. role:: label-success
- :class: m-label m-success
- .. role:: label-danger
- :class: m-label m-danger
+ .. role:: text-em-strong
+ :class: m-text m-em m-strong
- - Design direction and project goals :label-success:`done`
- - Automated testing :label-danger:`missing`
+ You *should* be **very** aware of the :text-em-strong:`potential danger`.
- .. role:: label-success
- :class: m-label m-success
- .. role:: label-danger
- :class: m-label m-danger
+ .. role:: text-em-strong
+ :class: m-text m-em m-strong
- - Design direction and project goals :label-success:`done`
- - Automated testing :label-danger:`missing`
+ You *should* be **very** aware of the :text-em-strong:`potential danger`.
class FlatButton(Button):
style_class = 'm-flat'
+def label(style_classes, name, rawtext, text, lineno, inliner, options, content):
+ return [nodes.inline(rawtext, text, classes=['m-label'] + style_classes)], []
+
+def label_default(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ return label(['m-default'], name, rawtext, text, lineno, inliner, options, content)
+
+def label_primary(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ return label(['m-primary'], name, rawtext, text, lineno, inliner, options, content)
+
+def label_success(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ return label(['m-success'], name, rawtext, text, lineno, inliner, options, content)
+
+def label_warning(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ return label(['m-warning'], name, rawtext, text, lineno, inliner, options, content)
+
+def label_danger(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ return label(['m-danger'], name, rawtext, text, lineno, inliner, options, content)
+
+def label_info(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ return label(['m-info'], name, rawtext, text, lineno, inliner, options, content)
+
+def label_dim(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ return label(['m-dim'], name, rawtext, text, lineno, inliner, options, content)
+
+def label_flat_default(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ return label(['m-flat', 'm-default'], name, rawtext, text, lineno, inliner, options, content)
+
+def label_flat_primary(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ return label(['m-flat', 'm-primary'], name, rawtext, text, lineno, inliner, options, content)
+
+def label_flat_success(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ return label(['m-flat', 'm-success'], name, rawtext, text, lineno, inliner, options, content)
+
+def label_flat_warning(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ return label(['m-flat', 'm-warning'], name, rawtext, text, lineno, inliner, options, content)
+
+def label_flat_danger(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ return label('m-flat', ['m-danger'], name, rawtext, text, lineno, inliner, options, content)
+
+def label_flat_info(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ return label(['m-flat', 'm-info'], name, rawtext, text, lineno, inliner, options, content)
+
+def label_flat_dim(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ return label(['m-flat', 'm-dim'], name, rawtext, text, lineno, inliner, options, content)
+
def register():
rst.directives.register_directive('transition', Transition)
rst.directives.register_directive('button-info', InfoButton)
rst.directives.register_directive('button-dim', DimButton)
rst.directives.register_directive('button-flat', FlatButton)
+
+ rst.roles.register_canonical_role('label-default', label_default)
+ rst.roles.register_canonical_role('label-primary', label_primary)
+ rst.roles.register_canonical_role('label-success', label_success)
+ rst.roles.register_canonical_role('label-warning', label_warning)
+ rst.roles.register_canonical_role('label-danger', label_danger)
+ rst.roles.register_canonical_role('label-info', label_info)
+ rst.roles.register_canonical_role('label-dim', label_dim)
+
+ rst.roles.register_canonical_role('label-flat-default', label_flat_default)
+ rst.roles.register_canonical_role('label-flat-primary', label_flat_primary)
+ rst.roles.register_canonical_role('label-flat-success', label_flat_success)
+ rst.roles.register_canonical_role('label-flat-warning', label_flat_warning)
+ rst.roles.register_canonical_role('label-flat-danger', label_flat_danger)
+ rst.roles.register_canonical_role('label-flat-info', label_flat_info)
+ rst.roles.register_canonical_role('label-flat-dim', label_flat_dim)