Testing Glossary

<% @article.definitions.to_a.sort_by {|k,v| k.downcase }.each do |key,value| %>
<%= key %>
<%= (value['text'] || value).gsub(/\[([^\]]+)\]\(([^\)]+)\)/) { "#{$1}" }.gsub(/\[([^\]]+)\]/) do "#{$1}" end %> <% if value.is_a?(Hash) && syn = value['also'] %> Also called: <%= syn %>. <% end %>
<% end %>