The source code that is evaluated to produce the Haml document.

 This is automatically converted to the correct encoding
 (see {file:REFERENCE.md#encodings the `:encoding` option}).

 @return [String]
325426
def precompiled_with_ambles(local_names, after_preamble: '')
      preamble = <<END.tr("\n", ';')
begin
extend Haml::Helpers
_hamlout = @haml_buffer = Haml::Buffer.new(haml_buffer, #{Options.new(options).for_buffer.inspect})
_erbout = _hamlout.buffer
#{after_preamble}
END
      postamble = <<END.tr("\n", ';')
#{precompiled_method_return_value}
ensure
@haml_buffer = @haml_buffer.upper if @haml_buffer
end
END
      "#{preamble}#{locals_code(local_names)}#{precompiled}#{postamble}".dup
    end
12638
def fetch_rails_source(file, options = {})
        # use Rails template resolution mechanism if possible (find_template)
        source_format = request_format if defined?(request_format)

        if source_format && context_scope.respond_to?(:lookup_context) # Rails 3
          lookup_proc = lambda do |partial|
            if ActionPack::VERSION::MAJOR == 3 && ActionPack::VERSION::MINOR < 2
              context_scope.lookup_context.find(file, [], partial)
            else # Rails 3.2 and higher
              # pull format directly from rails unless it is html
              request_format = context_scope.request.format.to_sym
              source_format = request_format unless request_format == :html
              context_scope.lookup_context.find(file, [], partial, [], { :formats => [source_format] })
            end
          end
          template = lookup_proc.call(false) rescue nil
          template ||= lookup_proc.call(true) rescue nil
          template.identifier if template
        elsif source_format && context_scope.respond_to?(:view_paths) # Rails 2
          template = context_scope.view_paths.find_template(file, source_format, false)
          template.filename if template
        end
      end
83331
def normalized_scheme
      return nil unless self.scheme
      @normalized_scheme ||= begin
        if self.scheme =~ /^\s*ssh\+svn\s*$/i
          "svn+ssh".dup
        else
          Addressable::URI.normalize_component(
            self.scheme.strip.downcase,
            Addressable::URI::CharacterClasses::SCHEME
          )
        end
      end
      # All normalized values should be UTF-8
      @normalized_scheme.force_encoding(Encoding::UTF_8) if @normalized_scheme
      @normalized_scheme
    end
164146
def parse_ruby_code(outer_delimiters)
      code = String.new
      end_re = if outer_delimiters.is_a?(Regexp)
                 outer_delimiters
               else
                 /\A\s*[#{Regexp.escape outer_delimiters.to_s}]/
               end
      delimiters = []
      string_start_quote_char = nil

      until @line.empty? || (delimiters.empty? && @line =~ end_re)
        char = @line[0]

        # backslash escaped delimiter
        if char == '\\' && RUBY_ALL_DELIMITERS.include?(@line[1])
          code << @line.slice!(0, 2)
          next
        end

        case char
        when RUBY_START_DELIMITERS_RE
          if RUBY_NOT_NESTABLE_DELIMITERS.include?(char) && delimiters.last == char
            # end char of not nestable delimiter
            delimiters.pop
            string_start_quote_char = nil
          else
            # diving into nestable delimiters
            delimiters << char if string_start_quote_char.nil?

            # mark start char of the not nestable delimiters, for example strings
            if RUBY_NOT_NESTABLE_DELIMITERS.include?(char) && string_start_quote_char.nil?
              string_start_quote_char = char
            end
          end

        when RUBY_END_DELIMITERS_RE
          # rising
          delimiters.pop if char == RUBY_DELIMITERS_REVERSE[delimiters.last]
        end

        code << @line.slice!(0)
      end

      syntax_error('Unexpected end of ruby code') unless delimiters.empty?

      code.strip
    end
60420
def pretty_print(self):
        
        msg = "Source: " + str(self._source) + "\n"
        msg += "Destination: " + str(self._destination) + "\n"
        inv_types = {v: k for k, v in defines.Types.items()}
        msg += "Type: " + str(inv_types[self._type]) + "\n"
        msg += "MID: " + str(self._mid) + "\n"
        if self._code is None:
            self._code = 0

        msg += "Code: " + str(defines.Codes.LIST[self._code].name) + "\n"
        msg += "Token: " + str(self._token) + "\n"
        for opt in self._options:
            msg += str(opt)
        msg += "Payload: " + "\n"
        msg += str(self._payload) + "\n"
        return msg
133329
def to_h
      {
        code: code,
        app_code: app_code,
        message: message,
        field_errors: field_errors.map(&:to_h),
        debug_info: debug_info.to_h
      }
    end
361895
def generate_html
      FileUtils.rm_rf(Rails.root.join('tmp/apidocs'))
      options = [Rails.root.join("app/controllers").to_s, "--op=#{Rails.root.join('tmp/apidocs')}"]

      self.store = RDoc::Store.new

      @options = load_options
      @options.parse options
      @exclude = @options.exclude

      @last_modified = setup_output_dir @options.op_dir, @options.force_update

      @store.encoding = @options.encoding if @options.respond_to? :encoding
      @store.dry_run = @options.dry_run
      @store.main = @options.main_page
      @store.title = @options.title
      @store.path = @options.op_dir

      @start_time = Time.now
      @store.load_cache
      @options.default_title = "RDoc Documentation"

      parse_files @options.files
      @store.complete @options.visibility

      formatter = RDoc::Markup::ToHtml.new(RDoc::Options.new)

      routes = routes_by_regex.map do |r|
        {verb: r[:verb],
         path: r[:path].sub('(.:format)', ''),
         class_name: gen_class_name(r),
         action_name: gen_action_name(r)
        }
      end.each do |r|
        doc = document_route(r)
        r[:html_comment] = doc ? doc.accept(formatter) : ""
      end.select { |r| r[:class_name] != "ApidocsController" }

      puts routes.inspect
      routes
    end
266963
function(){
		var prodHtmlPath = this.html = this.findHTML();

		if(!prodHtmlPath) {
			return;
		}

		return readFile(prodHtmlPath, "utf8")
		.then(function(src){
			this.originalSource = src;

			var $ = cheerio.load(src);
			var stealScript;
			$("script").each(function(idx, el){
				var $el = $(el);
				var src = $el.attr("src");
				if(/steal\.production\.js/.test(src)) {
					stealScript = $el;
					return false;
				}
			});

			if(stealScript) {
				stealScript.attr("env", "electron-production");
				return writeFile(prodHtmlPath, $.html(), "utf8");
			}
		}.bind(this))
		.catch(function(){
			// We don't want the copy to fail just because of this
		});

	}
1209221
def encode_utf16(str, encoding = 0)  # :nodoc:
    # Exit if the $string isn't defined, i.e., hasn't been set by user.
    return [nil, nil] if str.nil?

    string = str.dup
    # Return if encoding is set, i.e., string has been manually encoded.
    #return ( undef, undef ) if $string == 1;

    ruby_19 { string = convert_to_ascii_if_ascii(string) }

    # Handle utf8 strings.
    if is_utf8?(string)
      string = utf8_to_16be(string)
      encoding = 1
    end

    # Chart strings are limited to 255 characters.
    limit = encoding != 0 ? 255 * 2 : 255

    if string.bytesize >= limit
      # truncate the string and raise a warning.
      string = string[0, limit]
    end

    [string, encoding]
  end
924480
def string_to_hash(markup)
      options = {}

      if match = markup.match(Syntax)
        markup.scan(TagAttributes) do |key, value|
          options[key.to_sym] = value.gsub(/\A"|"\z/, "")
        end
      end

      options
    end
1034563
def charset=(charset)
      content_type = parsed_content_type_header.mime_type
      if false == charset
        set_content_type content_type, nil
      else
        set_content_type content_type, charset || self.class.default_charset
      end
    end
1253767
def raw
      formated_headers = headers.map { |k, v| "#{k}: #{v}\r\n" }.join
      status_text = Rack::Utils::HTTP_STATUS_CODES[status]
      format "HTTP/%s %s %s\r\n%s\r\n%s", @version, status, status_text, formated_headers, body.join
    end
1319682
def to_html
      output_options = Nokogiri::XML::Node::SaveOptions::DEFAULT_XHTML ^
        Nokogiri::XML::Node::SaveOptions::FORMAT
      @fragment.children.inject("") do |out, child|
        out << child.serialize(:save_with => output_options, :encoding => 'UTF-8')
      end
    end
496609
def generate_lambda_string(document, optimize: false)
      @document = document
      @buff = []
      @indent = 0
      @code_indent = 0
      @optimize = optimize

      buff_code '# frozen_string_literal: true' # so it can be faster on Ruby 2.3+
      buff_code ''
      buff_code "lambda do |#{NEW_LINE_NAME}: \"\\n\", #{BASE_INDENT_NAME}: '  '|"

      code_indent do
        buff_code "self.#{NEW_LINE_NAME} = #{NEW_LINE_NAME}"
        buff_code "self.#{BASE_INDENT_NAME} = #{BASE_INDENT_NAME}"

        visit_document(document)

        buff_code "output = #{BUFF_NAME}.join"
        buff_code 'self.__reset'
        buff_code 'output'
      end

      buff_code 'end'


      @document = nil

      @buff.join("\n")
    end
453205
def get_code_language(self):
        
        js_source = self.get_js_source()
        if self.options.get("include_html", False):
            resources = get_sphinx_resources(include_bokehjs_api=True)
            html_source = BJS_HTML.render(
                css_files=resources.css_files,
                js_files=resources.js_files,
                bjs_script=js_source)
            return [html_source, "html"]
        else:
            return [js_source, "javascript"]
579092
def to_utf8!(s=nil,from:nil)
      s=self if s.nil? #if we are included
      from=s.encoding if from.nil?
      return s.encode!('UTF-8',from, :invalid => :replace, :undef => :replace,
               :fallback => Proc.new { |bytes| '<'+bytes.unpack('H*')[0]+'>' }
             )
    end
204415
def to_str(format=List::FORMAT_BINARY,opts={})
      if format != FORMAT_BINARY && format != FORMAT_XML && format != FORMAT_PLAIN
        raise CFFormatError.new("Format #{format} not supported, use List::FORMAT_BINARY or List::FORMAT_XML")
      end

      prsr = @@parsers[format-1].new

      opts[:root] = @value
      opts[:formatted] = @formatted unless opts.has_key?(:formatted)

      return prsr.to_str(opts)
    end