Sha256: 31cfcbd40ee1fde148dd526b44a10974671382f2667237e99ec4baab5f976265
Contents?: true
Size: 483 Bytes
Versions: 2
Compression:
Stored size: 483 Bytes
Contents
module Caramelize class SwapWikiLinks # take an input stream and convert all wikka syntax to markdown syntax def run body 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
caramelize-0.4.0 | lib/caramelize/filters/swap_wiki_links.rb |
caramelize-0.3.0 | lib/caramelize/filters/swap_wiki_links.rb |