def define_env(env):
@env.macro
def doctable(module, include, inherits=None, inheritedBy=[], since=None):
def row(th, td):
return f"
{ th } | { td } |
"
def inheritsLink(inherits):
return f"""{inherits[1]}"""
out = """"""
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 += "
"
return out