Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #43 #44

Merged
merged 2 commits into from
Jul 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/ddoc/sections.d
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ Section[] splitSections(string text)
// Used to strip trailing newlines / whitespace.
lex.stripWhitespace();
size_t sliceStart = lex.offset - lex.front.text.length;
if (lex.front.type == Type.inlined)
sliceStart -= 2; // opening and closing '`' characters
size_t sliceEnd = sliceStart;
string name;
app ~= Section();
Expand Down Expand Up @@ -280,11 +282,19 @@ unittest

Throws: $(D RegexException) if there were any errors during compilation.`;

const sections = splitSections(comment);
const sections = splitSections(comment);
assert(sections[2].content == "pattern(s) = Regular expression(s) to match\n" ~
" flags = The _attributes (g, i, m and x accepted)");
}

// Handle inlined code properly
unittest
{
immutable comment = "`code` something";
const sections = splitSections(comment);
assert(sections[0].content == "`code` something");
}

private:
/**
* Append a section to the given output or merge it if a section with
Expand Down