Function unDecorateComment

Removes "decoration" such as leading whitespace, leading + and * characters, and places the result into the given output range

void unDecorateComment(T) (
  string comment,
  auto ref T outputRange
)
if (isOutputRange!(T, string));

Example

import std.array:array, appender;
import std.stdio:stderr;
stderr.writeln("Running unittest for unDecorateComment...");


string[] inputs = [
    "/***************\n*******************/",
    "/***************\n *\n ******************/",
    "/**\n*/",
    "/** */",
    "/***/",
    "/** abcde */",
    "/// abcde\n/// abcde",
    "/**\n * stuff\n */",
    "/**\n *\n * stuff\n */",
    "/**\n *\n * stuff\n *\n */",
    "/**\n *\n * stuff\n *\n*/",
    "/**\n *  abcde\n *    abcde \n */",
    "/**\n * abcde\n *\n * abcde\n */",
];
string[] outputs = [
    "",
    "",
    "",
    "",
    "",
    "abcde",
    "abcde\nabcde",
    "stuff",
    "stuff",
    "stuff",
    "stuff",
    "abcde\n  abcde",
    "abcde\n\nabcde"
];
assert(inputs.length == outputs.length);
foreach (pair; zip(inputs, outputs))
{
    foreach (b; [true, false])
    {
        auto app = appender!string();
        unDecorateComment(b ? pair[0] : pair[0].replace("*", "+"), app);
        assert(pair[1] == app.data, "[[" ~ pair[0] ~ "]] => [[" ~ app.data ~ "]]");
    }
}
stderr.writeln("Unittest for unDecorateComment passed.");