<commit_before>module Smithy
  module Liquid
    module Rendering

      private

      def render_smithy_page
        output = Rails.cache.fetch("#{@page.cache_key}-render_smithy_page") do
          @page.template.liquid_template.render(liquid_context)
        end
        render :text => output, :layout => false
      end

      def render_as_smithy_page(template_name)
        output = Smithy::Template.templates.find_by_name(template_name).liquid_template.render(liquid_context)
        render :text => output, :layout => false
      end

      def liquid_context
        ::Liquid::Context.new({}, smithy_default_assigns, smithy_default_registers, false)
      end

      def smithy_default_assigns
        {
          'page'              => @page,
          'current_page'      => self.params[:path],
          'params'            => self.params,
          'path'              => request.path,
          'fullpath'          => request.fullpath,<commit_msg>no caching for logged in users<commit_after>module Smithy
  module Liquid
    module Rendering

      private

      def render_smithy_page
        if smithy_current_user
          output = @page.template.liquid_template.render(liquid_context)
        else
          output = Rails.cache.fetch("#{@page.cache_key}-render_smithy_page") do
            @page.template.liquid_template.render(liquid_context)
          end
        end
        render :text => output, :layout => false
      end

      def render_as_smithy_page(template_name)
        output = Smithy::Template.templates.find_by_name(template_name).liquid_template.render(liquid_context)
        render :text => output, :layout => false
      end

      def liquid_context
        ::Liquid::Context.new({}, smithy_default_assigns, smithy_default_registers, false)
      end

      def smithy_default_assigns
        {
          'page'              => @page,
          'current_page'      => self.params[:path],
          'params'            => self.params,
          'path'              => request.path,
          'fullpath'          => request.fullpath,
{'fraction_non_alphanumeric': 0.09489402697495183, 'fraction_numerical': 0.0, 'mean_word_length': 2.146969696969697, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '2244059', 'n_tokens_mistral': 614, 'n_tokens_neox': 580, 'n_words': 108}