/nav
  = link_to(@report.name, "##{dom_id(@report)}")
  ul
    li = link_to("Inhaltsverzeichnis", "#toc")
    li 
      = link_to('Testbericht')
      ul
        - @report.pages.select { |p| p.elements.any? { |e| e.success_criteria.any?(&:failed?) } }.each do |page|
          li
            = link_to("#{page.position} #{page.path}", "##{dom_id(page)}")
            ul
              - page.elements.select { |e| e.success_criteria.any?(&:failed?) }.each do |element|
                li
                  = link_to("#{element.number} #{element.title}")
                  ul
                    - element.success_criteria.select(&:failed?).each do |sc|
                      li = link_to("#{sc.number} #{sc.title}", "##{dom_id(sc)}")
    li
      = link_to("Anhang")
      ul
        - @failed_success_criteria.group_by(&:check).each do |check, scs|
          li = link_to(check.display_label)
          
h1.title id=dom_id(@report) = @report.name

h2 1 Einschätzung
p Gibt es hier Text?

h3 1.1 Zielsetzung und Ausgangslage
p Woher kommt dieser Text?

h3 1.2 Wie wurde getestet
p Woher kommt dieser Text?

h3 1.3 Einschätzung
p Woher kommt dieser Text?

h2 2 Protokoll
- current_page_pos = 0
- current_abs_element_pos = 0
- @report.pages.select { |p| p.elements.any? { |e| e.success_criteria.any? { _1.failed? } } }.each do |page|
  - current_page_pos += 1
  - current_element_pos = 0
  h3 = "2.#{current_page_pos} #{page.path}"
  - page.elements.select { |e| e.success_criteria.any? { _1.failed? } }.each do |element|
    - current_element_pos += 1
    - current_abs_element_pos += 1
    - current_sc_pos = 0
    h4 = "2.#{current_page_pos}.#{current_element_pos} #{element.title}"
    /h3 = "2.#{current_abs_element_pos} #{element.title}"
    p
      strong Pfad:
      span =< page.path
    = safe_display(element.screenshot) { image_tag(_1.representation(resize_to_fit: [250, 250]))}
    = element.description 
    - element.success_criteria.select{ _1.failed? }.each do |sc|
      - current_sc_pos += 1
      /h4 
        = "2.#{current_abs_element_pos}.#{current_sc_pos} #{sc.title}"
      h5 = "2.#{current_page_pos}.#{current_element_pos}.#{current_sc_pos} #{sc.title}"
      p
        strong Protokoll-Nummer
        =< sc.number
      - if sc.test_comment?
        p = sc.test_comment
      - safe_display(sc.quick_criterion) do
        strong Kriterium
        .body_text = _1
      - safe_display(sc.quick_fail) do
        strong Quick Fail
        .body_text = _1
      - safe_display(sc.quick_fix) do
        strong Quick Fix
        .body_text = _1
      strong WCAG
      .body_text = link_to(sc.check.external_number, sc.check.external_url)         

h2 3 Anhang: Liste der zu beachtenden WCAG Regeln 
- counter = 0
- @failed_success_criteria.group_by(&:check).sort_by{ |c, scs| c.number }.each do |check, scs|
  - counter += 1
  h3 = "3.#{counter}. #{check.name_de}"
  - safe_display(check.external_number) do
    strong WCAG Nummer
    .body_text = _1
  - safe_display(check.external_url) do
    strong WCAG Link
    .body_text = _1
  - safe_display(check.conformity_level) do
    strong Konformität
    .body_text = _1
  - safe_display(check.conformity_notice_de) do
    strong Anmerkung Konformität
    .body_text = _1
  - safe_display(check.priority) do
    strong Priorität
    .body_text = _1
  - safe_display(check.criterion_de) do
    strong Kriterium/Grundlage
    .body_text = _1
  - safe_display(check.exemption_details_de) do
    strong Ausnahmen
    .body_text = _1
  - safe_display(check.criterion_details_de) do
    strong Verstehen
    .body_text = _1
  - safe_display(check.example_de) do
    strong Beispiel
    .body_text = _1
  - safe_display(check.annotation_de) do
    strong Anmerkung
    .body_text = _1
  - if check.links.any?
    strong Links
    .body_text
    - check.links.group_by(&:link_category).each do |category, links|
      strong = category.t_name
      ul
        - links.each do |l|
          li = link_to(l.text, l.url)
    strong Erfolgskriterien
    .body_text = scs.map(&:number).join(", ")
