lib/gollum-site/markup.rb in gollum-site-0.1.2 vs lib/gollum-site/markup.rb in gollum-site-0.1.3

- old
+ new

@@ -1,10 +1,35 @@ module Gollum class Markup + # Removing sanitization; this will be configurable after Gollum 1.1.0 + def render(no_follow = false) + sanitize_options = no_follow ? + HISTORY_SANITIZATION_OPTIONS : + SANITIZATION_OPTIONS + data = extract_tex(@data) + data = extract_code(data) + data = extract_tags(data) + begin + data = GitHub::Markup.render(@name, data) + if data.nil? + raise "There was an error converting #{@name} to HTML." + end + rescue Object => e + data = %{<p class="gollum-error">#{e.message}</p>} + end + data = process_tags(data) + data = process_code(data) + sanitize_options[:elements] << 'iframe' + sanitize_options[:attributes][:all] << 'frameborder' + data = Sanitize.clean(data, sanitize_options) + data = process_tex(data) + data.gsub!(/<p><\/p>/, '') + data + end # Attempt to process the tag as a page link tag. # - # tag - The String tag contents (the stuff inside the double + # tag - The String tag contents (the stuff inside the double # brackets). # no_follow - Boolean that determines if rel="nofollow" is added to all # <a> tags. # # Returns the String HTML if the tag is a valid page link tag or nil