<commit_before>require_dependency 'article'

class Article

  Metadata = {
    'og:type' => MetadataPlugin.og_types[:article],
    'og:url' => proc{ |a, c| c.og_url_for a.url },
    'og:title' => proc{ |a, c| a.title },
    'og:image' => proc do |a, c|
        result = a.body_images_paths

        if result.empty?
          result = "#{a.profile.environment.top_url}#{a.profile.image.public_filename}" if a.profile.image
        end

        if result.empty?
          result = MetadataPlugin.config[:open_graph][:environment_logo]
        end
        result
      end,
    'og:see_also' => [],
    'og:site_name' => proc{ |a, c| a.profile.name },
    'og:updated_time' => proc{ |a, c| a.updated_at.iso8601 },
    'og:locale:locale' => proc{ |a, c| a.environment.default_language },
    'og:locale:alternate' => proc{ |a, c| a.environment.languages - [a.environment.default_language] },
    'twitter:image' => proc{ |a, c| a.body_images_paths },
		'article:expiration_time' => "", # In the future we might want to populate this
		'article:modified_time' => proc{ |a, c| a.updated_at.iso8601 },
		'article:published_time' => proc{ |a, c| a.published_at.iso8601 },
		'article:section' => "", # In the future we might want to populate this
		'article:tag' => proc{ |a, c| a.tags.map &:name },
		'og:description' => proc{ |a, c| ActionView::Base.full_sanitizer.sanitize a.body },
		'og:rich_attachment' => "",
  }



end<commit_msg>metadata: shorten code<commit_after>require_dependency 'article'

class Article

  Metadata = {
    'og:type' => MetadataPlugin.og_types[:article],
    'og:url' => proc{ |a, c| c.og_url_for a.url },
    'og:title' => proc{ |a, c| a.title },
    'og:image' => proc do |a, c|
        result = a.body_images_paths
        result = "#{a.profile.environment.top_url}#{a.profile.image.public_filename}" if a.profile.image if result.blank?
        result = MetadataPlugin.config[:open_graph][:environment_logo] if result.blank?
        result
      end,
    'og:see_also' => [],
    'og:site_name' => proc{ |a, c| a.profile.name },
    'og:updated_time' => proc{ |a, c| a.updated_at.iso8601 },
    'og:locale:locale' => proc{ |a, c| a.environment.default_language },
    'og:locale:alternate' => proc{ |a, c| a.environment.languages - [a.environment.default_language] },
    'twitter:image' => proc{ |a, c| a.body_images_paths },
		'article:expiration_time' => "", # In the future we might want to populate this
		'article:modified_time' => proc{ |a, c| a.updated_at.iso8601 },
		'article:published_time' => proc{ |a, c| a.published_at.iso8601 },
		'article:section' => "", # In the future we might want to populate this
		'article:tag' => proc{ |a, c| a.tags.map &:name },
		'og:description' => proc{ |a, c| ActionView::Base.full_sanitizer.sanitize a.body },
		'og:rich_attachment' => "",
  }



end
{'fraction_non_alphanumeric': 0.17392844491675521, 'fraction_numerical': 0.008501594048884165, 'mean_word_length': 3.591869918699187, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 37, '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': '4993446', 'n_tokens_mistral': 1043, 'n_tokens_neox': 1005, 'n_words': 219}