Sha256: 74e4079611e312627d41b49cf10d40bace54ca00d36c8b59742a1aeabfa9aaa3
Contents?: true
Size: 570 Bytes
Versions: 2
Compression:
Stored size: 570 Bytes
Contents
# frozen_string_literal: true module Caramelize class CamelCaseToWikiLinks 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!(/([^\[\|\w\S])([A-Z]\w+[A-Z]\w+)([^\]])/) { "#{::Regexp.last_match(1)}#{format_link(::Regexp.last_match(2))}#{::Regexp.last_match(3)}" } migrated_body end private def format_link(link) link.tr!(' ', '_') link.delete!('.') "[[#{link}]]" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
caramelize-1.3.1 | lib/caramelize/filters/camel_case_to_wiki_links.rb |
caramelize-1.3.0 | lib/caramelize/filters/camel_case_to_wiki_links.rb |