-+ if ( have_auto && have_ds )
-+ doc = NewStringf("%s%s\n\n%s%s", triple_double, autodoc, str, triple_double);
-+ else if ( !have_auto && have_ds )
-+ doc = NewStringf("%s%s%s", triple_double, str, triple_double);
++ // If there is more than one line then make docstrings like this:
++ //
++ // """
++ // This is line1
++ // And here is line2 followed by the rest of them
++ // """
++ //
++ // otherwise, put it all on a single line
++ //
++ if ( have_auto && have_ds ) { // Both autodoc and docstring are present
++ doc = NewString("");
++ Printv(doc, triple_double, "\n",
++ pythoncode(autodoc, indent), "\n",
++ pythoncode(str, indent),
++ indent, triple_double, NIL);
++ }
++ else if ( !have_auto && have_ds ) { // only docstring
++ if (Strchr(str, '\n') == NULL) {
++ doc = NewStringf("%s%s%s", triple_double, str, triple_double);
++ }
++ else {
++ doc = NewString("");
++ Printv(doc, triple_double, "\n",
++ pythoncode(str, indent),
++ indent, triple_double, NIL);
++ }
++ }
++ else if ( have_auto && !have_ds ) { // only autodoc
++ if (Strchr(autodoc, '\n') == NULL) {
++ doc = NewStringf("%s%s%s", triple_double, autodoc, triple_double);
++ }
++ else {
++ doc = NewString("");
++ Printv(doc, triple_double, "\n",
++ pythoncode(autodoc, indent),
++ indent, triple_double, NIL);
++ }
++ }