# encoding: utf-8
#--
# Copyright (C) 2012 Gitorious AS
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see
The content you're attempting to browse appears to be binary. Download #{File.basename(path)}.
HTML end def format_text_blob(path, content, repository = nil, ref = nil) multiline(entityfy(content)) end def format_whitespace(text) text end def multiline(blob, options = {}) class_names = options[:class_names] || [] class_names << "prettyprint" << "linenums" num = 0 lines = blob.split("\n").inject("") do |html, line| num += 1 # Empty elements causes annoying rendering artefacts # Forcing one space on each line affects copy-paste negatively # TODO: Don't force one space, find CSS fix line = format_whitespace(line).sub(/^$/, " ") "#{html}" + "" end def safe_blob_text(blob) text = blob.text(nil, defined?(Encoding) ? Encoding.default_external : nil) if text.respond_to?(:encode) text = text.encode('UTF-16', :invalid => :replace, :undef => :replace, :replace => "�").encode('UTF-8') end text end end end end#{lines}