Sha256: 3e6d24267f5c8b067a620f41c7f923fe7228b24b7b31cf92fe355512e45027b6
Contents?: true
Size: 532 Bytes
Versions: 1
Compression:
Stored size: 532 Bytes
Contents
module Caramelize class SwapWikiLinks def initialize(body) @body = body end # take an input stream and convert all wikka syntax to markdown syntax def run migrated_body = @body.dup migrated_body.gsub!(/\[\[(\S+)\|(.+?)\]\]/, '[[\2|\1]]') migrated_body.gsub!(/\[\[([\w\s\.]*)\]\]/) do |s| if $1 s = $1 t = $1.dup t.gsub!(' ', '_') t.gsub!(/\./, '') s = "[[#{s}|#{t}]]" end end migrated_body end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
caramelize-1.0.0 | lib/caramelize/filters/swap_wiki_links.rb |