diff --git a/CHANGELOG.md b/CHANGELOG.md index 69ab73b6a..1b51acb55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ [Thibaud Robelain](https://github.com/thibaudrobelain) [#600](https://github.com/realm/jazzy/issues/600) +* Fix issue where parameter and return callouts were duplicated in documentation. + [Jeremy David Giesbrecht](https://github.com/SDGGiesbrecht) + [#673](https://github.com/realm/jazzy/issues/673) + ## 0.7.3 ##### Breaking diff --git a/lib/jazzy/jazzy_markdown.rb b/lib/jazzy/jazzy_markdown.rb index 1f8192913..9ca3159d6 100644 --- a/lib/jazzy/jazzy_markdown.rb +++ b/lib/jazzy/jazzy_markdown.rb @@ -19,30 +19,32 @@ def header(text, header_level) "#{text}\n" end - SPECIAL_LIST_TYPES = %w(Attention - Author - Authors - Bug - Complexity - Copyright - Date - Experiment - Important - Invariant - Note - Parameter - Postcondition - Precondition - Remark - Requires - Returns - See - SeeAlso - Since - TODO - Throws - Version - Warning).freeze + UNIQUELY_HANDLED_CALLOUTS = %w(Parameters + Parameter + Returns).freeze + GENERAL_CALLOUTS = %w(Attention + Author + Authors + Bug + Complexity + Copyright + Date + Experiment + Important + Invariant + Note + Postcondition + Precondition + Remark + Requires + See + SeeAlso + Since + TODO + Throws + Version + Warning).freeze + SPECIAL_LIST_TYPES = (UNIQUELY_HANDLED_CALLOUTS + GENERAL_CALLOUTS).freeze SPECIAL_LIST_TYPE_REGEX = %r{ \A\s* # optional leading spaces @@ -57,7 +59,9 @@ def header(text, header_level) def list_item(text, _list_type) if text =~ SPECIAL_LIST_TYPE_REGEX type = Regexp.last_match(2) - return ELIDED_LI_TOKEN if type =~ /parameter|returns/ + if UNIQUELY_HANDLED_CALLOUTS.include? type.capitalize + return ELIDED_LI_TOKEN + end return render_aside(type, text.sub(/#{Regexp.escape(type)}:\s+/, '')) end str = '
  • '