Sha256: 849c5e8cc441809bfaacbdc5837525cf71af306dd4532599bf1f03c6d23f0456
Contents?: true
Size: 982 Bytes
Versions: 2
Compression:
Stored size: 982 Bytes
Contents
module Caramelize module Wikka2MarkdownConverter # take an input stream and convert all wikka syntax to markdown syntax def convert2markdown str str.gsub!(/(======)(.*?)(======)/ ) {|s| '# ' + $2 } #h1 str.gsub!(/(=====)(.*?)(=====)/) {|s| '## ' + $2 } #h2 str.gsub!(/(====)(.*?)(====)/) {|s| '### ' + $2 } #h3 str.gsub!(/(===)(.*?)(===)/) {|s| '#### ' + $2 } #h4 str.gsub!(/(\*\*)(.*?)(\*\*)/) {|s| '**' + $2 + '**' } #bold str.gsub!(/(\/\/)(.*?)(\/\/)/) {|s| '_' + $2 + '_' } #italic #str.gsub!(/(===)(.*?)(===)/) {|s| '`' + $2 + '`'} #code str.gsub!(/(__)(.*?)(__)/) {|s| '<u>' + $2 + '</u>'} #underline #str.gsub!(/(.*?)(\n\t-)(.*?)/) {|s| $1 + '\n' + $3 } #list str.gsub!(/(\t-)(.*?)/) {|s| '*' + $2 } #list #str.gsub!(/(----)/) {|s| '~~~~'} #seperator # TODO more syntax conversion for links and images str end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
caramelize-0.0.3 | lib/caramelize/wikka2markdown_converter.rb |
caramelize-0.0.2 | lib/caramelize/wikka2markdown_converter.rb |