<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title><%= @plan.title %></title>

    <%= render partial: 'shared/export/plan_styling',
               locals: {
                 font_face: font_face,
                 font_size: "#{font_size}pt",
                 margin: "#{margin_top}px #{margin_right}px #{margin_bottom}px #{margin_left}px"
               } %>
  </head>
  <body>
    <% if @show_coversheet %>
      <%= render partial: 'shared/export/plan_coversheet' %>
    <% end %>

    <% @hash[:phases].each do |phase| %>
      <%# Page break before each phase %>
        <div style="page-break-before:always;"></div>
        <h1><%= download_plan_page_title(@plan, phase, @hash) %></h1>
        <hr />
        <% phase[:sections].each do |section| %>
          <% if display_section?(@hash[:customization], section, @show_custom_sections) %>
            <% if @show_sections_questions %>
              <br>
              <h2><%= section[:title] %></h2>
              <br>
            <% end %>
            <% if @research_output_export_mode == "by_section" || @research_outputs_number == 1 %>
              <%= render partial: 'shared/export/export_by_research_output',
                         locals: {
                          research_outputs: @hash[:research_outputs],
                          questions: section[:questions],
                          section: section
                        } %>
            <% elsif @research_output_export_mode == "by_question" %>
              <%= render partial: 'shared/export/export_by_question',
                         locals: {
                          research_outputs: @hash[:research_outputs],
                          questions: section[:questions],
                          section: section
                        } %>
            <% else %>
                <h1>Export mode unknown</h1>
            <% end %>
          <% end %> <!-- sections.each -->
        <% end %> <!-- phases.each -->
    <% end %>
  </body>
</html>
