Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion lib/yard/docstring.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ def summary
end
end
@summary = stripped[0..idx]
if [email protected]? && @summary !~ /\A\s*\{include:.+\}\s*\Z/
if [email protected]? &&
@summary !~ /\A\s*\{include:.+\}\s*\Z/ && # Summary is copied using +{include:...}+
@summary !~ /[!?]\s*\Z/ # Summary ends in a terminal punctuation
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like you probably want to include other punctuation marks here (: ; etc)

@summary += '.'
end
@summary
Expand Down
8 changes: 8 additions & 0 deletions spec/docstring_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@
Registry.clear
end

it "does not attach period if summary ends with '?'" do
expect(Docstring.new("Is this object correctly configured?").summary).to eq "Is this object correctly configured?"
end

it "does not attach period if summary ends with '!'" do
expect(Docstring.new("Invoke this method first!").summary).to eq "Invoke this method first!"
end

it "handles references embedded in summary" do
expect(Docstring.new("Aliasing {Test.test}. Done.").summary).to eq "Aliasing {Test.test}."
end
Expand Down
2 changes: 1 addition & 1 deletion spec/templates/examples/class001.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ <h2>



<span class="summary_desc"><div class='inline'>constructor method!.</div></span>
<span class="summary_desc"><div class='inline'>constructor method!</div></span>

</li>

Expand Down