14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/cl_wiki/format_opml.rb', line 14
def self.format_content(content, page)
out = ['<NoWikiLinks>']
content.grep(%r{<outline.*?>|</outline>}).each do |ln|
title = ln.scan(/title=\"(.*?)\"/).compact
html = ln.scan(/htmlUrl=\"(.*?)\"/).compact
xml = ln.scan(/xmlUrl=\"(.*?)\"/).compact
if html.empty? && xml.empty?
if !title.empty?
out << "<h4>#{title}</h4>"
out << '<blockquote>'
else
out << '</blockquote>'
end
else
out << "<a href='#{xml}'>[xml]</a> <a href='#{html}'>#{title}</a>"
end
end
out.join("\n") + content
end
|