Skip to content

Commit

Permalink
Merge pull request #697 from SDGGiesbrecht/fix-673-duplicate-callouts
Browse files Browse the repository at this point in the history
Fix #673 duplicate callouts
  • Loading branch information
jpsim authored Dec 12, 2016
2 parents efc1603 + 966b180 commit 01724fe
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 25 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
54 changes: 29 additions & 25 deletions lib/jazzy/jazzy_markdown.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,32 @@ def header(text, header_level)
"<h#{header_level} id='#{text_slug}'>#{text}</h#{header_level}>\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
Expand All @@ -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 = '<li>'
Expand Down

0 comments on commit 01724fe

Please sign in to comment.