Skip to content

Commit

Permalink
handle blockquote and image
Browse files Browse the repository at this point in the history
  • Loading branch information
WardCunningham committed Apr 8, 2017
1 parent 62b0319 commit e1e6fa8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions fedwiki/transform.rb
Expand Up @@ -65,6 +65,10 @@ def markdown text
add({'type' => 'markdown', 'text' => text, 'id' => random()})
end

def html text
add({'type' => 'html', 'text' => text, 'id' => random()})
end

def page title
@story = []
@journal = []
Expand Down Expand Up @@ -107,12 +111,16 @@ def ref title

it['Table of Contents'] = toc
it.each do |title, story|
puts title
page title do
story.each do |line|
line.gsub! /\[(.*?)\]\((.*?)\)/, '[\2 \1]'
if m = line.match(/^(#|>|\-|\*)/)
line.gsub! /\[#.*? (.*?)\]/, '[[\1]]'
if m = line.match(/^(#|\-|\*)/)
markdown line
elsif m = line.match(/^>\s*(.*)$/)
html "<blockquote>#{m[1]}</blockquote>"
elsif m = line.match(/^!\[(\/.*?) .*?\]/)
html "<img src='https://raw.githubusercontent.com/WardCunningham/pie-cookbook/master/#{m[1]}' width=420>"
else
paragraph line
end
Expand Down

0 comments on commit e1e6fa8

Please sign in to comment.