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 By", ', '.join(sorted(map(inheritsLink, inheritedBy))))
if since:
out += row("Since", since)
out += "</table></div>"
return out
|