From d0888b2f719956a3156af6fced1b98c60675f06a Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 20 Jan 2013 16:22:20 +0000 Subject: [PATCH] Strip {{toc}} tags in pdf exports (#9842). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11227 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/export/pdf.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/redmine/export/pdf.rb b/lib/redmine/export/pdf.rb index ff3993f72..d0edd6f67 100644 --- a/lib/redmine/export/pdf.rb +++ b/lib/redmine/export/pdf.rb @@ -112,6 +112,13 @@ module Redmine RDMPdfEncoding::rdm_from_utf8(txt, l(:general_pdf_encoding)) end + def formatted_text(text) + html = Redmine::WikiFormatting.to_html(Setting.text_formatting, text) + # Strip {{toc}} tags + html.gsub!(/

\{\{([<>]?)toc\}\}<\/p>/i, '') + html + end + # Encodes an UTF-8 string to UTF-16BE def to_utf16(str) if str.respond_to?(:encode) @@ -132,8 +139,7 @@ module Redmine def RDMwriteHTMLCell(w, h, x, y, txt='', attachments=[], border=0, ln=1, fill=0) @attachments = attachments writeHTMLCell(w, h, x, y, - fix_text_encoding( - Redmine::WikiFormatting.to_html(Setting.text_formatting, txt)), + fix_text_encoding(formatted_text(txt)), border, ln, fill) end