process_code_excerpt

in src/_plugins/code_excerpt_processor.rb [38:80]


    def process_code_excerpt(match)
      
      pi = match[2] 
      pi_name = match[3]
      args = process_pi_args(pi)
      optional_code_block = match[4]
      indent = match[5]
      lang = !match[6] || match[6].empty? ? (args['ext'] || 'nocode') : match[6]
      attrs = mk_code_example_directive_attr(lang, args['linenums'])

      return process_code_pane(pi, attrs, args) if pi_name == 'code-pane'

      if pi_name != 'code-excerpt'
        log_puts "Warning: unrecognized instruction: #{pi}"
        return match[0]
      elsif !optional_code_block
        
        process_set_command(pi, args)
        return ''
      end

      code = match[7]
      leading_whitespace = get_indentation_string(optional_code_block)
      code = Util.trim_min_leading_space(code)

      if lang == 'diff'
        diff = @code_differ.render(args, code)
        diff.indent!(leading_whitespace.length) if leading_whitespace
        return diff
      end

      title = args['title']
      classes = args['class']

      
      
      escaped_code = CGI.escapeHTML(code)

      code = @code_framer.frame_code(title, classes, attrs, _process_highlight_markers(escaped_code), indent)
      code.indent!(leading_whitespace.length) if leading_whitespace
      code
    end