File: components.rst

package info (click to toggle)
taskflow 3.9.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 45,948 kB
  • sloc: cpp: 39,058; xml: 35,572; python: 12,935; javascript: 1,732; makefile: 59; sh: 16
file content (403 lines) | stat: -rw-r--r-- 12,281 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
..
    This file is part of m.css.

    Copyright © 2017, 2018, 2019, 2020, 2021, 2022, 2023
              Vladimír Vondruš <mosra@centrum.cz>

    Permission is hereby granted, free of charge, to any person obtaining a
    copy of this software and associated documentation files (the "Software"),
    to deal in the Software without restriction, including without limitation
    the rights to use, copy, modify, merge, publish, distribute, sublicense,
    and/or sell copies of the Software, and to permit persons to whom the
    Software is furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included
    in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    DEALINGS IN THE SOFTWARE.
..

Components
##########

:breadcrumb: {filename}/plugins.rst Plugins
:footer:
    .. note-dim::
        :class: m-text-center

        `« HTML sanity <{filename}/plugins/htmlsanity.rst>`_ | `Plugins <{filename}/plugins.rst>`_ | `Images » <{filename}/plugins/images.rst>`_

.. role:: html(code)
    :language: html
.. role:: py(code)
    :language: py
.. role:: rst(code)
    :language: rst

Most of m.css `CSS components <{filename}/css/components.rst>`_ are exposed to
Pelican via custom :abbr:`reST <reStructuredText>` directives. Unlike with pure
CSS, the directives are *not* prefixed with ``m-`` to save some typing ---
which is the most important thing when authoring content.

.. contents::
    :class: m-block m-default

`How to use`_
=============

`Pelican`_
----------

Download the `m/components.py <{filename}/plugins.rst>`_ file, put it
including the ``m/`` directory into one of your :py:`PLUGIN_PATHS` and add
:py:`m.components` package to your :py:`PLUGINS` in ``pelicanconf.py``. This
plugin assumes presence of `m.htmlsanity <{filename}/plugins/htmlsanity.rst>`_.

.. code:: python

    PLUGINS += ['m.htmlsanity', 'm.components']

`Python doc theme`_
-------------------

Simply list the plugin in your :py:`PLUGINS`. The `m.htmlsanity`_ plugin is
available always, no need to mention it explicitly:

.. code:: py

    PLUGINS += ['m.components']

`Doxygen theme`_
----------------

Unfortunately, due to a lack of extensibility of the Doxygen markup language,
it's not possible to provide the components through easy-to-use commands. All
you have is the ability to apply CSS classes using ``@m_class``, ``@m_span``
and ``@m_div``. See the
`Doxygen theme-specific commands <http://localhost:8000/documentation/doxygen/#theme-specific-commands>`_
for more information.

`Transitions`_
==============

Use :rst:`.. transition::` directive to create a `transition <{filename}/css/typography.rst#transitions>`_:

.. code-figure::

    .. code:: rst

        Aenean tellus turpis, suscipit quis iaculis ut, suscipit nec magna. Vestibulum
        finibus sit amet neque nec volutpat. Suspendisse sit amet nisl in orci posuere
        mattis.

        .. transition:: ~ ~ ~

        Praesent eu metus sed felis faucibus placerat ut eu quam. Aliquam convallis
        accumsan ante sit amet iaculis. Phasellus rhoncus hendrerit leo vitae lacinia.
        Maecenas iaculis dui ex, eu interdum lacus ornare sit amet.

    Aenean tellus turpis, suscipit quis iaculis ut, suscipit nec magna.
    Vestibulum finibus sit amet neque nec volutpat. Suspendisse sit amet nisl
    in orci posuere mattis.

    .. transition:: ~ ~ ~

    Praesent eu metus sed felis faucibus placerat ut eu quam. Aliquam convallis
    accumsan ante sit amet iaculis. Phasellus rhoncus hendrerit leo vitae
    lacinia. Maecenas iaculis dui ex, eu interdum lacus ornare sit amet.

`Blocks, notes, frame`_
=======================

Use :rst:`.. block-default::`, :rst:`.. block-primary::` etc. directives to create
`blocks <{filename}/css/components.rst#blocks>`_; use :rst:`.. note-default::`,
:rst:`.. note-primary::` etc. or :rst:`.. frame::` directives to create
`notes and frames <{filename}/css/components.rst#notes-frame>`_. Blocks require
title to be present, notes and frames have it optional. Internally, these
elements are represented as a
`topic directive <http://docutils.sourceforge.net/docs/ref/rst/directives.html#topic>`_.
Use the :rst:`:class:` option to specify additional CSS classes.

.. code-figure::

    .. code:: rst

        .. block-danger:: Danger block

            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus ultrices a
            erat eu suscipit. `Link. <#>`_

        .. note-success:: Success note

            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus ultrices a
            erat eu suscipit. `Link. <#>`_

        .. frame:: Frame

            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus ultrices a
            erat eu suscipit. `Link. <#>`_

    .. container:: m-row

        .. container:: m-col-m-4

            .. block-danger:: Danger block

                Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                Vivamus ultrices a erat eu suscipit. `Link. <#>`_

        .. container:: m-col-m-4

            .. note-success:: Success note

                Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                Vivamus ultrices a erat eu suscipit. `Link. <#>`_

        .. container:: m-col-m-4

            .. frame:: Frame

                Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                Vivamus ultrices a erat eu suscipit. `Link. <#>`_

`Code, math and graph figure`_
==============================

Use :rst:`.. code-figure::` to denote a `code figure <{filename}/css/components.rst#code-figure>`_.
Then put a literal code block denoted by :rst:`::` or a :rst:`.. code::`
directive as the first element inside. Use the :rst:`:class:` option to specify
additional CSS classes. The optional directive parameter can be used for a
figure caption.

.. code-figure::

    .. code:: rst

        .. code-figure::

            ::

                Some
                    sample
                code

            And a resulting output.

    .. code-figure::

        ::

            Some
                sample
            code

        And a resulting output.

Use :rst:`.. console-figure::` to denote code figure styled for a
`console listing <{filename}/css/components.rst#colored-terminal-output>`_.
Similarly, :rst:`.. math-figure::` denotes a `math figure <{filename}/css/components.rst#math-figure>`_
and :rst:`.. graph-figure::` denotes a `graph figure <{filename}/css/components.rst#graph-figure>`_.

`Text`_
=======

Use :rst:`.. text-default::`, :rst:`.. text-primary::` etc. directives to
`color a block of text <{filename}/css/components.rst#text>`_. Internally,
these elements are represented as a `container directive <http://docutils.sourceforge.net/docs/ref/rst/directives.html#container>`_.
Use the :rst:`:class:` option to specify additional CSS classes.

.. code-figure::

    .. code:: rst

        .. text-info::
            :class: m-text-center

            Info text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus
            ultrices a erat eu suscipit. Aliquam pharetra imperdiet tortor sed
            vehicula. `Link. <#>`_

    .. text-info::
        :class: m-text-center

        Info text. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
        Vivamus ultrices a erat eu suscipit. Aliquam pharetra imperdiet tortor
        sed vehicula. `Link. <#>`_

There are no interpreted text roles provided for inline colored text, but you
can define a custom one and add the CSS classes to it, potentially deriving it
from either the :rst:`:emphasis:` or :rst:`:strong:` role to combine color with
emphasis or strong text:

.. code-figure::

    .. code:: rst

        .. role:: text-dim
            :class: m-text m-dim

        .. role:: text-warning-strong(strong)
            :class: m-text m-warning

        Aenean id elit posuere, consectetur magna congue, sagittis est.
        :text-dim:`Dim inline text.` Pellentesque est neque, aliquet nec consectetur
        in, mattis ac diam. :text-warning-strong:`Warning strong text.`

    .. role:: text-dim
        :class: m-text m-dim

    .. role:: text-warning-strong(strong)
        :class: m-text m-warning

    Aenean id elit posuere, consectetur magna congue, sagittis est.
    :text-dim:`Dim inline text.` Pellentesque est neque, aliquet nec
    consectetur in, mattis ac diam. :text-warning-strong:`Warning strong text.`

`Button links`_
===============

Use :rst:`.. button-default::`, :rst:`.. button-primary::` etc. or
:rst:`.. button-flat::` directives to create a
`button link <{filename}/css/components.rst#button-links>`_. Directive argument
is the URL, directive contents are button title. Use the :rst:`:class:` option
to specify additional CSS classes. Use two paragraphs of content to create a
button with title and description.

.. code-figure::

    .. code:: rst

            .. button-danger:: #

                Order now!

            .. button-primary:: #

                Download the thing

                Any platform, 5 kB.

    .. container:: m-text-center

        .. button-danger:: #

            Order now!

        .. container:: m-clearfix-t

            ..

        .. button-primary:: #

            Download the thing

            Any platform, 5 kB.

`Tables`_
=========

Mark your reST table with :rst:`..class:: m-table` to give it styling.

.. code-figure::

    .. code:: rst

        .. class:: m-table

        = ============= ================
        # Heading       Second heading
        = ============= ================
        1 Cell          Second cell
        2 2nd row cell  2nd row 2nd cell
        = ============= ================

    .. class:: m-table m-center-t

    = ============= ================
    # Heading       Second heading
    = ============= ================
    1 Cell          Second cell
    2 2nd row cell  2nd row 2nd cell
    = ============= ================

.. 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`_
=======================

You can use :rst:`.. container::` directive to add a wrapping :html:`<div>`
around most elements. Parameters of the directive are CSS classes. For example,
arranging content in three-column grid can be done like this:

.. code-figure::

    .. code:: rst

        .. container:: m-row

            .. container:: m-col-m-4

                Left column content.

            .. container:: m-col-m-4

                Middle column content.

            .. container:: m-col-m-4

                Right column content.

    .. container:: m-row

        .. container:: m-col-m-4 m-text-center

            Left column content.

        .. container:: m-col-m-4 m-text-center

            Middle column content.

        .. container:: m-col-m-4 m-text-center

            Right column content.

For inline components not mentioned above, derive a custom role with additional
CSS classes. For example:

.. code-figure::

    .. code:: rst

        .. role:: text-em-strong
            :class: m-text m-em m-strong

        You *should* be **very** aware of the :text-em-strong:`potential danger`.

    .. role:: text-em-strong
        :class: m-text m-em m-strong

    You *should* be **very** aware of the :text-em-strong:`potential danger`.