11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/cl_wiki/format/format.opml.rb', line 11
def FormatOPML.format_content(content, page)
out = ['<NoWikiLinks>']
content.grep(/<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
|