File: macros.py

package info (click to toggle)
qcoro 0.12.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,700 kB
  • sloc: cpp: 8,573; python: 32; xml: 26; makefile: 23; sh: 15
file content (38 lines) | stat: -rw-r--r-- 946 bytes parent folder | download | duplicates (2)
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
def define_env(env):

    @env.macro
    def doctable(module, include, inherits=None, inheritedBy=[], since=None):
        def row(th, td):
            return f"<tr><th>{ th }</th><td>{ td }</td></tr>"

        def inheritsLink(inherits):
            return f"""<a href="../../{inherits[0]}">{inherits[1]}</a>"""

        out = """<div class="doctable"><table>"""
        out += row("Module", module)
        out += row("Include", f"""
```cpp
#include <{include}>
```
""")
        out += row("CMake", f"""
```cpp
target_link_libraries(myapp QCoro::{module})
```
""")
        out += row("QMake", f"""
```cpp
QT += QCoro{module}
```
""")
        if inherits:
            out += row("Inherits", inheritsLink(inherits))

        if inheritedBy:
            out += row("Inherited&nbsp;By", ', '.join(sorted(map(inheritsLink, inheritedBy))))

        if since:
            out += row("Since", since)

        out += "</table></div>"
        return out