Skip to content

Commit

Permalink
Add citations to wikispecies
Browse files Browse the repository at this point in the history
  • Loading branch information
lmrodriguezr committed Jul 28, 2024
1 parent 065181c commit 52360a0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
21 changes: 17 additions & 4 deletions app/models/publication.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,24 @@ def journal_html
ERB::Util.h(journal || '[%s]' % pub_type.tr('-', ' '))
end

def long_citation(format = :text)
case format.to_sym
when :html
<<~HTML.html_safe
#{authors_et_al(format)} (#{journal_date.year}). #{title_html}.
<i>#{journal_html}</i>. <a href="#{link}" target="_blank">DOI:#{doi}</a>
HTML
when :wikispecies
<<~WIKI.html_safe
#{authors_et_al(format).gsub(/[^\.]?$/, '.')} #{journal_date.year}:
#{title}. #{journal}. {{Doi|#{doi}}}
WIKI
else
end
end

def long_citation_html
<<~HTML.html_safe
#{authors_et_al_html} (#{journal_date.year}). #{title_html}.
<i>#{journal_html}</i>. <a href="#{link}" target="_blank">DOI:#{doi}</a>
HTML
long_citation(:html)
end

def title_html
Expand Down
5 changes: 5 additions & 0 deletions app/views/names/wiki/_wikispecies_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ Species: <%= @name.name_wiki(no_candidatus: true, link: true) %>
<%= @name.formal_wiki %>

=={{int:References}}==
==={{int:Primary references}}==
<% @name.citations.each do |citation| %>
* <%= citation.long_citation(:wikispecies) %>
<% end %>

==={{int:Links}}===
<% if @name.ncbi_taxonomy? %>
* {{NCBI|<%= @name.ncbi_taxonomy %>}}
Expand Down

0 comments on commit 52360a0

Please sign in to comment.