From: Vladimír Vondruš Date: Tue, 27 Aug 2019 11:08:07 +0000 (+0200) Subject: documentation/python: verify that HTML escaping is done for pybind as well. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=99db6663f3fa2332cd53f0dff98f12a6541dba98;p=blog.git documentation/python: verify that HTML escaping is done for pybind as well. It is, even though I felt like it wasn't. Good to have to avoid double-escaping accidents in the future. --- diff --git a/documentation/test_python/pybind_signatures/pybind_signatures.cpp b/documentation/test_python/pybind_signatures/pybind_signatures.cpp index 62a9f655..a982f2b1 100644 --- a/documentation/test_python/pybind_signatures/pybind_signatures.cpp +++ b/documentation/test_python/pybind_signatures/pybind_signatures.cpp @@ -63,6 +63,8 @@ PYBIND11_MODULE(pybind_signatures, m) { .def("duck", &duck, "A function taking args/kwargs directly") .def("takes_a_function", &takesAFunction, "A function taking a Callable") .def("takes_a_function_returning_none", &takesAFunctionReturningVoid, "A function taking a Callable that returns None") + .def("escape_docstring", &voidFunction, "A docstring that should be escaped") + .def("failed_parse_docstring", &crazySignature, "A failed parse should also escape the docstring") .def("tenOverloads", &tenOverloads, "Ten overloads of a function") .def("tenOverloads", &tenOverloads, "Ten overloads of a function") diff --git a/documentation/test_python/pybind_signatures/pybind_signatures.html b/documentation/test_python/pybind_signatures/pybind_signatures.html index 43fd799a..2ff53e07 100644 --- a/documentation/test_python/pybind_signatures/pybind_signatures.html +++ b/documentation/test_python/pybind_signatures/pybind_signatures.html @@ -55,6 +55,14 @@ def duck(*args, **kwargs) -> None
A function taking args/kwargs directly
+
+ def escape_docstring(arg0: int, /) -> None +
+
A docstring that <em>should</em> be escaped
+
+ def failed_parse_docstring(…) +
+
A failed parse should <strong>also</strong> escape the docstring
def overloaded(arg0: int, /) -> str