40namespace welder::inline v0::rods::python {
49 std::string_view indent) {
50 for (
const char* c{text}; *c; ++c) {
52 if (*c ==
'\n' && c[1] !=
'\0')
62 if (out.back() !=
'\n')
71 for (
const auto& p : d.params)
96 static constexpr std::string
format(const ::welder::detail::function_doc& d) {
104 for (
const auto& p : d.params)
107 out += p.name ? p.name :
"?";
116 out +=
"Returns:\n ";
128 static constexpr std::string
format_enum(const ::welder::detail::enum_doc& e) {
133 if (!e.members.empty()) {
135 out +=
"Attributes:\n";
136 for (
const auto& m : e.members) {
148static_assert(::welder::doc_style<google_style>);
168 static constexpr std::string
format(const ::welder::detail::function_doc& d) {
172 auto section = [&out](std::string_view title) {
176 out.append(title.size(),
'-');
184 section(
"Parameters");
185 for (
const auto& p : d.params)
187 out += p.name ? p.name :
"?";
207 static constexpr std::string
format_enum(const ::welder::detail::enum_doc& e) {
212 if (!e.members.empty()) {
214 out +=
"Attributes\n";
215 out.append(std::string_view{
"Attributes"}.size(),
'-');
217 for (
const auto& m : e.members) {
228static_assert(::welder::doc_style<numpy_style>);
245 static constexpr std::string
format(const ::welder::detail::function_doc& d) {
254 for (
const auto& p : d.params)
257 out += p.name ? p.name :
"?";
276 static constexpr std::string
format_enum(const ::welder::detail::enum_doc& e) {
281 if (!e.members.empty())
284 for (
const auto& m : e.members) {
295static_assert(::welder::doc_style<sphinx_style>);
Language-agnostic documentation layer: read [[=welder::doc(...)]] annotations off reflected entities ...
constexpr bool any_param_doc(const ::welder::detail::function_doc &d)
Whether d has at least one documented parameter (so a params block is worth opening).
constexpr void append_indented(std::string &out, const char *text, std::string_view indent)
Append text to out, indenting every continuation line by indent so a multiline param/returns doc stay...
constexpr void blank_line(std::string &out)
Separate a new block from preceding content in out by exactly one blank line, whether or not that con...
Google-style docstring assembly (the default).
static constexpr std::string format_enum(const ::welder::detail::enum_doc &e)
Assemble enum e into a Google-style docstring: the summary, then an Attributes: block listing each do...
static constexpr std::string format(const ::welder::detail::function_doc &d)
Assemble d into a Google-style docstring.
NumPy-style docstring assembly (numpydoc).
static constexpr std::string format_enum(const ::welder::detail::enum_doc &e)
Assemble enum e into a NumPy-style docstring: the summary, then an underlined Attributes section list...
static constexpr std::string format(const ::welder::detail::function_doc &d)
Assemble d into a NumPy-style docstring.
Sphinx-style docstring assembly (reStructuredText field lists).
static constexpr std::string format(const ::welder::detail::function_doc &d)
Assemble d into a Sphinx (reStructuredText) docstring.
static constexpr std::string format_enum(const ::welder::detail::enum_doc &e)
Assemble enum e into a Sphinx (reStructuredText) docstring: the summary, then a :var Name: text field...