app/controllers/discourse-media-wiki-import/import_controller.rb
##
# Converts any HTML encoded gallery tags to a template format.
#
Converts any HTML encoded gallery tags to a template format.
Converts any HTML encoded gallery tags to a template format .
def convert_gallery_markup(wiki_page_text:)
      wiki_page_text.gsub!(/(<gallery)(.*)>\n(.*)(<\/gallery>)/m) { |_|
        attrs = $~[2]
        items = $~[3]
        "<ul class=\"gallery\" data-#{attrs.strip.split(/(?<!:)\s/).reject! { |s| s.nil? || s.strip.empty? }.join(" data-")}>\n<li>[[#{items.strip.split("\n").join("]]</li>\n<li>[[")}]]</li>\n</ul>"
      }
    end
def convert_gallery_markup ( wiki_page_text : ) wiki_page_text . gsub! ( / (<gallery)(.*)> \n (.*)(< \/ gallery>) /m ) { | _ | attrs = $~ [ 2 ] items = $~ [ 3 ] "<ul class=\"gallery\" data-#{attrs.strip.split(/(?<!:)\s/).reject! { |s| s.nil? || s.strip.empty? }.join(" data-")}>\n<li>[[#{items.strip.split("\n").join("]]</li>\n<li>[[")}]]</li>\n</ul>" } end
Converts any HTML encoded gallery tags to a template format.
Converts any HTML encoded gallery tags to a template format .
wiki_page_text