Actions
Bug #2534
closedxmera Omnia - Collection #2512: Wiki link problems when exporting to pdf
Broken links in exported wiki pages when using relative links
Start date:
11/19/2024
Due date:
11/19/2024
% Done:
100%
Estimated time:
Description
When a wiki page author uses relative links like so with Markdown or CommonMark [My Link](/relative/to/my/domain)
the link will be included in a pdf like so localhost:3000/relative/to/my/domain
. That is, the schema (http or https) is missing.
Updated by liaham 5 months ago
Internal links are kept as internal within textilizable
. When the text should be exported we need to transform internal links to external links. This could be done in an extra method or as further option with textilizable.
def write_wiki_page(pdf, page)
text =
textilizable(
page.content, :text,
:only_path => false,
:edit_section_links => false,
:headings => false,
:inline_attachments => false
)
# Add code to fix internal links
pdf.RDMwriteFormattedCell(190, 5, '', '', text, page.attachments, 0)
if page.attachments.any?
pdf.ln(5)
pdf.SetFontStyle('B', 9)
pdf.RDMCell(190, 5, l(:label_attachment_plural), "B")
pdf.ln
page.attachments.each do |attachment|
pdf.SetFontStyle('', 8)
pdf.RDMCell(80, 5, attachment.filename)
pdf.RDMCell(20, 5, number_to_human_size(attachment.filesize), 0, 0, "R")
pdf.RDMCell(25, 5, format_date(attachment.created_on), 0, 0, "R")
pdf.RDMCell(65, 5, attachment.author.name, 0, 0, "R")
pdf.ln
end
end
end
Actions