<!--title, author, fandom-->
<div class="header module">

  <h4 class="heading">
    <% # so bookmarks go to the external work page, not directly to the external link %>
    <% if external_work ||= @bookmarkable %>
      <%= link_to bookmarkable.title, bookmarkable %>
    <% else %>
      <%= link_to external_work.title, external_work.url %>
    <% end %>
    <%= ts("by") %>
    <%= byline(external_work) %>
  </h4>

  <h5 class="fandoms heading">
    <span class="landmark"><%= ts("Fandoms") %>:</span>
    <% fandoms = external_work.tag_groups["Fandom"] %>
    <%= fandoms.collect{ |tag| link_to_tag_works(tag) }.join(", ").html_safe if fandoms %>
  </h5>

  <%= get_symbols_for(external_work) %>
  <p class="datetime"><%= set_format_for_date(external_work.created_at) %></p>
</div>

<p class="notice"><%= t("external_works.notice") %></p>

<!--warnings again, cast, freeform tags-->
<h6 class="landmark heading"><%= ts("Tags") %></h6>
<ul class="tags commas">
  <%= blurb_tag_block(external_work) %>
</ul>

<!--summary-->
<% unless external_work.summary.blank? %>
  <h6 class="landmark heading"><%= ts("Summary") %></h6>
  <blockquote class="userstuff summary">
    <%=raw strip_images(sanitize_field(external_work, :summary)) %>
  </blockquote>
<% end %>

<!--stats-->
<dl class="stats">
  <% unless external_work.language.blank? %>
    <dt class="language"><%= ts("Language:") %></dt>
    <dd class="language" lang="<%= external_work.language.short %>"><%= external_work.language.name %></dd>
  <% end %>

  <% if Bookmark.count_visible_bookmarks(external_work) > 0 %>
    <dt class="bookmarks"><%= Bookmark.model_name.human(count: :many) %>:</dt>
    <dd class="bookmarks"><%= link_to_bookmarkable_bookmarks(external_work) %></dd>
  <% end %>

  <% if external_work.related_works.count > 0 %>
    <dt class="inspired"><%= RelatedWork.model_name.human(count: :many) %>:</dt>
    <dd class="inspired"><%= link_to number_with_delimiter(external_work.related_works.count), external_work %></dd>
  <% end %>
</dl>
