<commit_before>module Plugins::CamaMetaTag::MainHelper

  # here all actions on going to active
  # you can run sql commands like this:
  # results = ActiveRecord::Base.connection.execute(query);
  # plugin: plugin model
  def cama_meta_tag_on_active(plugin)
  end

  # here all actions on going to inactive
  # plugin: plugin model
  def cama_meta_tag_on_inactive(plugin)
  end

  def cama_meta_tag_on_seo(args)
    if is_page?
      page = args[:object] || @cama_visited_post
      tmp = {
          title: page.get_option('seo_title').to_s.translate,
          keywords: page.get_option('keywords').to_s.translate,
          descr: page.get_option('seo_description').to_s.translate,
          author: page.get_option('seo_author').to_s.translate,
          image: page.get_option('seo_image').to_s.translate
      }
      args[:seo_data][:title] = tmp[:title] if tmp[:title].present?<commit_msg>Fixed missing post object<commit_after>module Plugins::CamaMetaTag::MainHelper

  # here all actions on going to active
  # you can run sql commands like this:
  # results = ActiveRecord::Base.connection.execute(query);
  # plugin: plugin model
  def cama_meta_tag_on_active(plugin)
  end

  # here all actions on going to inactive
  # plugin: plugin model
  def cama_meta_tag_on_inactive(plugin)
  end

  def cama_meta_tag_on_seo(args)
    if is_page?
      page = args[:object].present? ? args[:object] : @cama_visited_post
      tmp = {
          title: page.get_option('seo_title').to_s.translate,
          keywords: page.get_option('keywords').to_s.translate,
          descr: page.get_option('seo_description').to_s.translate,
          author: page.get_option('seo_author').to_s.translate,
          image: page.get_option('seo_image').to_s.translate
      }
      args[:seo_data][:title] = tmp[:title] if tmp[:title].present?
{'fraction_non_alphanumeric': 0.11189956331877729, 'fraction_numerical': 0.0, 'mean_word_length': 3.687979539641944, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4507161', 'n_tokens_mistral': 609, 'n_tokens_neox': 598, 'n_words': 121}