<%= render "works/work_header" %>
<% if @chapters %>
<% @chapters.each do |chapter| %>
<%= render "chapters/chapter", chapter: chapter %>
<% end %>
<% else %>
<%=raw sanitize_field(@chapter, :content) %>
<% end %>
<% inspired_by = get_inspired_by(@work) %>
<% if !@work.endnotes.blank? || !@work.serial_works.blank? || !inspired_by.empty? %>
<% unless @work.endnotes.blank? %>
<%= render "works/work_endnotes" %>
<% end %>
<% unless @work.serial_works.blank? %>
<%= render "works/work_series_links" %>
<% end %>
<% unless inspired_by.empty? %>
<%= render "works/work_approved_children", inspired_by: inspired_by %>
<% end %>
<% end %>