<commit_before><% (@stylesheets_header ||= []).push File.join(DC.cdn_root(:agnostic => true), "/note_embed/note_embed.css") %>

<header class="header_primary reverse_order">
  <div class="container">
    <nav class="header_nav">
      <%= link_to '⬅︎ Read full document', @current_annotation.contextual_path %>
    </nav>
    <h1><%= link_to 'DocumentCloud', '/' %></h1>
  </div>
</header>

<div class="container">
  <div class="DC-note <%#= extraClasses %>" data-version="1.1" style="background-image:url('<%= @current_annotation.page.image_url %>')">
    <div class="DC-note-header">
      <a class="DC-note-embed-resource" href="<%= @current_annotation.contextual_path %>" title="View the note '<%= @current_annotation.title %>' in its original document context">
        <span class="DC-note-title"><%= @current_annotation.title %></span>
        <span class="DC-note-page-number">(p. <%= @current_annotation.page_number %>)</span>
      </a>
    </div>
    <% if (@current_annotation_dimensions) %>
    <div class="DC-note-image-max-bounds" style="max-height:<%= @current_annotation_dimensions[:height_pixel] %>px;max-width:<%= @current_annotation_dimensions[:width_pixel] %>px">
      <div class="DC-note-image-aspect-ratio" style="padding-bottom:<%= @current_annotation_dimensions[:aspect_ratio] %>%">
        <a class="DC-note-image-link DC-note-image-space-filler" href="<%= @current_annotation.contextual_path %>" title="View the note '<%= @current_annotation.title %>' in its original document context">
          <img class="DC-note-image" width="<%= @current_annotation_dimensions[:width_pixel] %>" height="<%= @current_annotation_dimensions[:height_pixel] %>" src="<%= @current_annotation.page.image_url %>" alt="Selected portion of a source document hosted by DocumentCloud" style="top:<%= @current_annotation_dimensions[:offset_top_percent] %>%;left:<%= @current_annotation_dimensions[:offset_left_percent] %>%;width:<%= @current_annotation_dimensions[:width_percent] %>%;">
        </a>
      </div>
    </div>
    <% end %>
    <div class="DC-note-body"><%= @current_annotation.content.html_safe %></div>
    <div class="DC-note-background-fader"></div>
  </div>
</div>

<%
  @javascript_footer_inline = <<-EOS
    // Pixel ping, stolen from documentcloud-pages until unified
    var isIframed = function() {
      try {
          return window.self !== window.top;
      } catch (e) {
          return true;
      }
    };
    var getSourceUrl = function() {
      var source, sourceUrl;
      if (isIframed()) {
        source      = document.createElement('A');
        source.href = document.referrer;
      } else {
        source      = window.location;
      }
      sourceUrl = source.protocol + '//' + source.host;
      if (source.pathname.indexOf('/') !== 0) {
        sourceUrl += '/';
      };
      sourceUrl += source.pathname;
      sourceUrl = sourceUrl.replace(/[\/]+$/, '');
      return sourceUrl;
    };
<commit_msg>Fix note pages when content is empty<commit_after><% (@stylesheets_header ||= []).push File.join(DC.cdn_root(:agnostic => true), "/note_embed/note_embed.css") %>

<header class="header_primary reverse_order">
  <div class="container">
    <nav class="header_nav">
      <%= link_to '⬅︎ Read full document', @current_annotation.contextual_path %>
    </nav>
    <h1><%= link_to 'DocumentCloud', '/' %></h1>
  </div>
</header>

<div class="container">
  <div class="DC-note <%#= extraClasses %>" data-version="1.1" style="background-image:url('<%= @current_annotation.page.image_url %>')">
    <div class="DC-note-header">
      <a class="DC-note-embed-resource" href="<%= @current_annotation.contextual_path %>" title="View the note '<%= @current_annotation.title %>' in its original document context">
        <span class="DC-note-title"><%= @current_annotation.title %></span>
        <span class="DC-note-page-number">(p. <%= @current_annotation.page_number %>)</span>
      </a>
    </div>
    <% if (@current_annotation_dimensions) %>
    <div class="DC-note-image-max-bounds" style="max-height:<%= @current_annotation_dimensions[:height_pixel] %>px;max-width:<%= @current_annotation_dimensions[:width_pixel] %>px">
      <div class="DC-note-image-aspect-ratio" style="padding-bottom:<%= @current_annotation_dimensions[:aspect_ratio] %>%">
        <a class="DC-note-image-link DC-note-image-space-filler" href="<%= @current_annotation.contextual_path %>" title="View the note '<%= @current_annotation.title %>' in its original document context">
          <img class="DC-note-image" width="<%= @current_annotation_dimensions[:width_pixel] %>" height="<%= @current_annotation_dimensions[:height_pixel] %>" src="<%= @current_annotation.page.image_url %>" alt="Selected portion of a source document hosted by DocumentCloud" style="top:<%= @current_annotation_dimensions[:offset_top_percent] %>%;left:<%= @current_annotation_dimensions[:offset_left_percent] %>%;width:<%= @current_annotation_dimensions[:width_percent] %>%;">
        </a>
      </div>
    </div>
    <% end %>
    <div class="DC-note-body"><%= @current_annotation.content.html_safe unless @current_annotation.content.nil? %></div>
    <div class="DC-note-background-fader"></div>
  </div>
</div>

<%
  @javascript_footer_inline = <<-EOS
    // Pixel ping, stolen from documentcloud-pages until unified
    var isIframed = function() {
      try {
          return window.self !== window.top;
      } catch (e) {
          return true;
      }
    };
    var getSourceUrl = function() {
      var source, sourceUrl;
      if (isIframed()) {
        source      = document.createElement('A');
        source.href = document.referrer;
      } else {
        source      = window.location;
      }
      sourceUrl = source.protocol + '//' + source.host;
      if (source.pathname.indexOf('/') !== 0) {
        sourceUrl += '/';
      };
      sourceUrl += source.pathname;
      sourceUrl = sourceUrl.replace(/[\/]+$/, '');
      return sourceUrl;
    };

{'fraction_non_alphanumeric': 0.18382722250125566, 'fraction_numerical': 0.0016742005692281935, 'mean_word_length': 3.8138597904915392, 'pattern_counts': {'":': 0, '<': 117, '<?xml version=': 0, '>': 113, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3204791', 'n_tokens_mistral': 1945, 'n_tokens_neox': 1870, 'n_words': 346}