Strip {{toc}} tags in pdf exports (#9842).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11227 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2013-01-20 16:22:20 +00:00
parent 15f035be51
commit d0888b2f71
1 changed files with 8 additions and 2 deletions

View File

@ -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!(/<p>\{\{([<>]?)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