Project

General

Profile

Actions

Bug #2534

closed

xmera Omnia - Collection #2512: Wiki link problems when exporting to pdf

Broken links in exported wiki pages when using relative links

Added by liaham 6 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
11/19/2024
Due date:
11/19/2024
% Done:

100%

Estimated time:
Affected Version:
Compatible Redmine Version:
5.1.z

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.


Related issues 1 (0 open1 closed)

Related to Redmine - Bug #2481: Broken link in exported wiki pages when including issue linksRejectedliaham11/19/202411/19/2024

Actions
Actions #1

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 #2

Updated by liaham 5 months ago

  • Due date set to 11/19/2024
  • Status changed from New to Closed
  • Assignee set to liaham
  • Start date set to 11/19/2024
Actions #3

Updated by liaham 5 months ago

  • % Done changed from 0 to 100
Actions #4

Updated by liaham 5 months ago

  • Related to Bug #2481: Broken link in exported wiki pages when including issue links added
Actions

Also available in: Atom PDF