1.9.2 Bugfixes for exports
authorinsilmaril
Tue, 17 Jul 2007 11:19:51 +0000
changeset 5512913f96fd233
parent 550 55236fe5a630
child 552 d11cc5d29414
1.9.2 Bugfixes for exports
demos/vym-projectplan.vym
noteobj.cpp
version.h
     1.1 Binary file demos/vym-projectplan.vym has changed
     2.1 --- a/noteobj.cpp	Tue Jul 17 11:19:50 2007 +0000
     2.2 +++ b/noteobj.cpp	Tue Jul 17 11:19:51 2007 +0000
     2.3 @@ -48,32 +48,36 @@
     2.4  {
     2.5  	QString r=note;
     2.6  
     2.7 +	// Remove all <style...> ...</style>
     2.8 +	QRegExp rx ("<style.*>.*</style>");
     2.9 +	rx.setMinimal(true);
    2.10 +	r.replace (rx,"");
    2.11 +
    2.12  	// convert all "<br*>" to "\n"
    2.13 -	QRegExp re("<br.*>");
    2.14 -	re.setMinimal(true);
    2.15 -	r.replace (re,"\n");
    2.16 +	rx.setPattern ("<br.*>");
    2.17 +	r.replace (rx,"\n");
    2.18  
    2.19  	// convert all "</p>" to "\n"
    2.20 -	re.setPattern ("</p>");
    2.21 -	r.replace (re,"\n");
    2.22 +	rx.setPattern ("</p>");
    2.23 +	r.replace (rx,"\n");
    2.24  	
    2.25  	// remove all remaining tags 
    2.26 -	re.setPattern ("<.*>");
    2.27 -	r.replace (re,"");
    2.28 +	rx.setPattern ("<.*>");
    2.29 +	r.replace (rx,"");
    2.30  
    2.31  	// If string starts with \n now, remove it.
    2.32  	// It would be wrong in an OOo export for example
    2.33  	while (r.at(0)=='\n') r.remove (0,1);
    2.34  	
    2.35  	// convert "&", "<" and ">"
    2.36 -	re.setPattern ("&gt;");
    2.37 -	r.replace (re,">");
    2.38 -	re.setPattern ("&lt;");
    2.39 -	r.replace (re,"<");
    2.40 -	re.setPattern ("&amp;");
    2.41 -	r.replace (re,"&");
    2.42 -	re.setPattern ("&quot;");
    2.43 -	r.replace (re,"\"");
    2.44 +	rx.setPattern ("&gt;");
    2.45 +	r.replace (rx,">");
    2.46 +	rx.setPattern ("&lt;");
    2.47 +	r.replace (rx,"<");
    2.48 +	rx.setPattern ("&amp;");
    2.49 +	r.replace (rx,"&");
    2.50 +	rx.setPattern ("&quot;");
    2.51 +	r.replace (rx,"\"");
    2.52  
    2.53  	return r;
    2.54  }
    2.55 @@ -148,14 +152,38 @@
    2.56  	// QTextEdit may generate fontnames with unquoted &, like
    2.57  	// in "Lucida B&H". This is invalid in XML and thus would crash
    2.58  	// the XML parser
    2.59 -	uint pos=0;
    2.60 +
    2.61 +	// More invalid XML is generated with bullet lists:
    2.62 +	// There are 2 <style> tags in one <li>, so we merge them here
    2.63 +	int pos=0;
    2.64  	bool inbracket=false;
    2.65 +	int begin_bracket;
    2.66  	bool inquot=false;
    2.67  	QString n=note;
    2.68  	while (pos<n.length())
    2.69  	{
    2.70 -		if (n.mid(pos,1)=="<") inbracket=true;
    2.71 -		if (n.mid(pos,1)==">") inbracket=false;
    2.72 +		if (n.mid(pos,1)=="<") 
    2.73 +		{
    2.74 +			inbracket=true;
    2.75 +			begin_bracket=pos;
    2.76 +		}
    2.77 +		if (n.mid(pos,1)==">") 
    2.78 +		{
    2.79 +			inbracket=false;
    2.80 +			QString s=n.mid(begin_bracket,pos-begin_bracket+1);
    2.81 +			int sl=s.length();
    2.82 +			if (s.count("style=\"")>1)
    2.83 +			{
    2.84 +				cout << "note: s="<<s.ascii()<<endl;
    2.85 +				QRegExp rx("style=\\s*\"(.*)\"\\s*style=\\s*\"(.*)\"");
    2.86 +				rx.setMinimal (true);
    2.87 +				s.replace(rx,"style=\"\\1 \\2\"");
    2.88 +				cout << " new:   "<<s.ascii()<<endl;
    2.89 +				n.replace (begin_bracket,sl,s);
    2.90 +				cout << "pos="<<pos<<"  bb="<<begin_bracket<<"  s1l="<<sl<<"  s2l="<<s.length()<<endl<<endl;
    2.91 +				pos=pos-(sl-s.length());
    2.92 +			}	
    2.93 +		}	
    2.94  		if (n.mid(pos,1)=="\"" && inbracket)
    2.95  		{
    2.96  			if (!inquot)
     3.1 --- a/version.h	Tue Jul 17 11:19:50 2007 +0000
     3.2 +++ b/version.h	Tue Jul 17 11:19:51 2007 +0000
     3.3 @@ -4,10 +4,10 @@
     3.4  #include <QString>
     3.5  
     3.6  #define __VYM_NAME "VYM"
     3.7 -#define __VYM_VERSION "1.9.1"
     3.8 +#define __VYM_VERSION "1.9.2"
     3.9  //#define __VYM_CODENAME "Codename: 1.10.0-beta-1"
    3.10  #define __VYM_CODENAME "Codename: development version"
    3.11 -#define __VYM_BUILD_DATE "July 11, 2007"
    3.12 +#define __VYM_BUILD_DATE "July 16, 2007"
    3.13  
    3.14  
    3.15  bool checkVersion(const QString &);