[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:24:07 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=3a4d055

The following commit has been merged in the master branch:
commit 3a4d0558ac38a7f2667aab943153cd4336a730a5
Author: David Edmundson <david at davidedmundson.co.uk>
Date:   Fri Aug 30 11:20:57 2013 +0000

    Fix LaTeX filter
    
    Instead of trying to put the images inline we put a reference and insert the LaTeX images at the end.
    
    BUGS: 322218
    REVIEW: 111501
---
 filters/latex/latex-filter.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/filters/latex/latex-filter.cpp b/filters/latex/latex-filter.cpp
index 824fb6a..bb12d1b 100644
--- a/filters/latex/latex-filter.cpp
+++ b/filters/latex/latex-filter.cpp
@@ -53,6 +53,7 @@ void LatexFilter::filterMessage(KTp::Message &message, const KTp::MessageContext
     rg.setMinimal(true);
 
     int pos = 0;
+    int numberOfFormula = 0;
     while ((pos = rg.indexIn(messageText, pos)) != -1) {
         QString formula = rg.cap();
         // remove the $$ delimiters on start/end
@@ -65,7 +66,8 @@ void LatexFilter::filterMessage(KTp::Message &message, const KTp::MessageContext
             continue;
         }
 
-        QString image(QLatin1Literal("<img src=\"data:image/png;base64,") %
+        numberOfFormula++;
+        QString image(QLatin1Literal("<br/><img src=\"data:image/png;base64,") %
         handleLatex(formula) %
         QLatin1Literal("\" style=\"max-width:100%;margin-top:3px\"") %
         QLatin1Literal("alt=\"") %
@@ -73,11 +75,11 @@ void LatexFilter::filterMessage(KTp::Message &message, const KTp::MessageContext
         QLatin1Literal("\" isEmotion=\"true\"/>"));
 
         int length = rg.matchedLength();
-        messageText.replace(pos, length, image);
+        messageText.replace(pos, length);
 
         pos += length;
+        message.appendMessagePart(image);
     }
-
     message.setMainMessagePart(messageText);
 }
 
@@ -183,4 +185,4 @@ LatexFilter::~LatexFilter()
 }
 
 K_PLUGIN_FACTORY(MessageFilterFactory, registerPlugin<LatexFilter>();)
-K_EXPORT_PLUGIN(MessageFilterFactory("ktptextui_message_filter_latex"))
\ No newline at end of file
+K_EXPORT_PLUGIN(MessageFilterFactory("ktptextui_message_filter_latex"))

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list