Feature #550 » inlined-images.patch
| app/helpers/application_helper.rb | ||
|---|---|---|
|
filename, ext, alt, alttext = $1.downcase, $2, $3, $4
|
||
|
# search for the picture in attachments
|
||
|
if found = Attachment.latest_attach(attachments, CGI.unescape(filename))
|
||
|
image_url = download_named_attachment_path(found, found.filename, :only_path => only_path)
|
||
|
desc = found.description.to_s.gsub('"', '')
|
||
|
if !desc.blank? && alttext.blank?
|
||
|
alt = " title=\"#{desc}\" alt=\"#{desc}\""
|
||
|
end
|
||
|
"src=\"#{image_url}\"#{alt}"
|
||
|
case options[:wiki_links]
|
||
|
when :local
|
||
|
"src=\"data:#{found.content_type};base64,#{Base64.encode64(File.read(found.diskfile)).gsub(/\n/,"")}\"#{alt}"
|
||
|
when :anchor
|
||
|
"src=\"data:#{found.content_type};base64,#{Base64.encode64(File.read(found.diskfile)).gsub(/\n/,"")}\"#{alt}"
|
||
|
else
|
||
|
image_url = download_named_attachment_path(found, found.filename, :only_path => only_path)
|
||
|
"src=\"#{image_url}\"#{alt}"
|
||
|
end
|
||
|
else
|
||
|
m
|
||
|
end
|
||
| app/views/wiki/export.html.erb | ||
|---|---|---|
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<%= textilizable @content, :text, :wiki_links => :local %>
|
||
|
<%= textilizable @content, :text, :wiki_links => :local, :attachments => @content.page.attachments %>
|
||
|
</body>
|
||
|
</html>
|
||
| app/views/wiki/export_multiple.html.erb | ||
|---|---|---|
|
<% @pages.each do |page| %>
|
||
|
<hr />
|
||
|
<a name="<%= h(page.title) %>" />
|
||
|
<%= textilizable page.content ,:text, :wiki_links => :anchor %>
|
||
|
<%= textilizable page.content ,:text, :wiki_links => :anchor, :attachments => page.attachments %>
|
||
|
<% end %>
|
||
|
</body>
|
||
- « Previous
- 1
- 2
- Next »