linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #05295
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2852: HTML->RTF: handle <br/>
------------------------------------------------------------
revno: 2852
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sat 2012-02-04 17:40:44 +0100
message:
HTML->RTF: handle <br/>
modified:
win32/HtmlToRtf.cpp
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'win32/HtmlToRtf.cpp'
--- win32/HtmlToRtf.cpp 2012-02-04 15:43:31 +0000
+++ win32/HtmlToRtf.cpp 2012-02-04 16:40:44 +0000
@@ -23,6 +23,7 @@
#include <dcpp/debug.h>
#include <dcpp/Flags.h>
+#include <dcpp/ScopedFunctor.h>
#include <dcpp/SimpleXML.h>
#include <dcpp/StringTokenizer.h>
#include <dcpp/Text.h>
@@ -62,7 +63,7 @@
StringList fonts;
StringList colors;
- std::deque<Context> contexts;
+ vector<Context> contexts;
};
tstring HtmlToRtf::convert(const string& html, dwt::RichTextBox* box) {
@@ -79,11 +80,16 @@
}
void Parser::startTag(const string& name, StringPairList& attribs, bool simple) {
+ if(name == "br") {
+ ret += _T("\\line\n");
+ }
+
if(simple) {
return;
}
contexts.emplace_back(contexts.back());
+ ScopedFunctor([this] { write(contexts.back()); });
if(name == "b") {
contexts.back().setFlag(Context::Bold);
@@ -149,8 +155,6 @@
}
}
}
-
- write(contexts.back());
}
void Parser::data(const string& data) {