Defect #32477

Right-aligned TOC tag is displayed in exported PDF if the text formatting setting is Markdown

Added by Brice Beaumesnil 3 months ago. Updated 17 days ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:PDF export
Target version:4.1.1
Resolution:Fixed Affected version:3.4.8

Description

Hello,

If we have a right toc :

{{>toc}}

In a wiki page on REDMINE with text formatting markdown.

The toc

{{>toc}}

Appear in the PDF

No problem for left toc.

Thanks

Wiki.pdf (94.7 KB) Brice Beaumesnil, 2019-11-15 10:37


Related issues

Related to Redmine - Defect #16236: Right-aligned table of contents (TOC) not working with ma... Closed

Associated revisions

Revision 19480
Added by Go MAEDA 22 days ago

Right-aligned TOC tag is displayed in exported PDF if the text formatting setting is Markdown (#32477).

Patch by Yuichi HARADA.

Revision 19491
Added by Go MAEDA 17 days ago

Merged r19480 from trunk to 4.1-stable (#32477).

History

#1 Updated by Go MAEDA 3 months ago

  • Category changed from Wiki to PDF export
  • Status changed from New to Confirmed

#2 Updated by Go MAEDA 3 months ago

  • Related to Defect #16236: Right-aligned table of contents (TOC) not working with markdown added

#3 Updated by Yuichi HARADA 2 months ago

I modified the regular expression with reference to TOC_RE of app/helpers/application_helper.rb .
I confirmed that {{toc}}, {{<toc}} and {{>toc}} do not export to PDF.

diff --git a/lib/redmine/export/pdf.rb b/lib/redmine/export/pdf.rb
index c8189367b..0adcb18c7 100644
--- a/lib/redmine/export/pdf.rb
+++ b/lib/redmine/export/pdf.rb
@@ -92,7 +92,7 @@ module Redmine
           </style>'

           # Strip {{toc}} tags
-          txt = txt.gsub(/<p>\{\{([<>]?)toc\}\}<\/p>/i, '')
+          txt = txt.gsub(/<p>\{\{((<|&lt;)|(>|&gt;))?toc\}\}<\/p>/i, '')
           writeHTMLCell(w, h, x, y, css_tag + txt, border, ln, fill)
         end

#4 Updated by Go MAEDA 2 months ago

  • Target version set to Candidate for next minor release

#5 Updated by Go MAEDA about 1 month ago

  • Target version changed from Candidate for next minor release to 4.0.7

Setting the target version to 4.0.7.

#6 Updated by Go MAEDA 22 days ago

  • Status changed from Confirmed to Resolved
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch.

#7 Updated by Go MAEDA 17 days ago

  • Status changed from Resolved to Closed
  • Target version changed from 4.0.7 to 4.1.1

#8 Updated by Go MAEDA 17 days ago

  • Subject changed from Export PDF of WikiPage in Markdown Format with right toc to Right-aligned TOC tag is displayed in exported PDF if the text formatting setting is Markdown

Also available in: Atom PDF