SVN commit 769457 by amantia: Insert literal character entities if possible. BUG: 129520 M +1 -0 ChangeLog M +119 -119 data/chars M +2 -2 src/document.cpp M +11 -1 src/quanta_init.cpp M +9 -0 utility/quantacommon.cpp M +9 -0 utility/quantacommon.h --- branches/KDE/3.5/kdewebdev/quanta/ChangeLog #769456:769457 @@ -5,6 +5,7 @@ - fix crashes when using XDebug - do not keep an empty, Untitled document opened when opening new files [#151682] - fix crash when closing a plugin and no other document is opened [#156728] + - insert literal character entities if possible [#129520] Version 3.5.8 (Release date: 07-10-2006) - bugfixes: --- branches/KDE/3.5/kdewebdev/quanta/data/chars #769456:769457 @@ -1,10 +1,10 @@ ! (!) Exclamation mark -" (") Quotation mark +" (") Quotation mark # (#) Hash mark $ ($) Dollar sign % (%) Percent sign -& (&) Ampersand -' (') Apostrophe +& (&) Ampersand +' (') Apostrophe ( (() Left parenthesis ) ()) Right parenthesis * (*) Asterisk @@ -15,9 +15,9 @@ / (/) Slash : (:) Colon ; (;) Semicolon -< (<) Less than +< (<) Less than = (=) Equals sign -> (>) Greater than +> (>) Greater than ? (?) Question mark @ (@) Commercial at sign [ ([) Left square bracket @@ -30,102 +30,102 @@ | (|) Vertical bar } (}) Right curly brace ~ (~) Tilde - ( ) Nonbreaking space -¡ (¡) Inverted exclamation mark -¢ (¢) Cent sign -£ (£) Pound sign -¤ (¤) Currency sign -¥ (¥) Yen sign -¦ (¦) Broken vertical bar -§ (§) Section sign -¨ (¨) Diaeresis -© (©) Copyright -ª (ª) Feminine ordinal -« («) Left Pointing Guillemet -¬ (¬) Not sign - (­) Soft hyphen -® (®) Registered trademark -¯ (¯) Macron -° (°) Degree sign -± (±) Plus-minus sign -² (²) Superscript 2 -³ (³) Superscript 3 -´ (´) Acute accent -µ (µ) Micro sign -¶ (¶) Paragraph sign -· (·) Middle dot -¸ (¸) Cedilla -¹ (¹) Superscript 1 -º (º) Masculine ordinal -» (») Right Pointing Guillemet -¼ (¼) Fraction one-fourth -½ (½) Fraction one-half -¾ (¾) Fraction three-fourths -¿ (¿) Inverted question mark -À (À) Capital A, grave accent -Á (Á) Capital A, acute accent -Â (Â) Capital A, circumflex accent -Ã (Ã) Capital A, tilde -Ä (Ä) Capital A, diaeresis -Å (Å) Capital A, ring -Æ (Æ) Capital AE ligature -Ç (Ç) Capital C, cedilla -È (È) Capital E, grave accent -É (É) Capital E, acute accent -Ê (Ê) Capital E, circumflex accent -Ë (Ë) Capital E, diaeresis -Ì (Ì) Capital I, grave accent -Í (Í) Capital I, acute accent -Î (Î) Capital I, circumflex accent -Ï (Ï) Capital I, diaeresis -Ð (Ð) Capital eth -Ñ (Ñ) Capital N, tilde -Ò (Ò) Capital O, grave accent -Ó (Ó) Capital O, acute accent -Ô (Ô) Capital O, circumflex accent -Õ (Õ) Capital O, tilde -Ö (Ö) Capital O, diaeresis -× (×) Multiplication -Ø (Ø) Capital O, slash -Ù (Ù) Capital U, grave accent -Ú (Ú) Capital U, acute accent -Û (Û) Capital U, circumflex accent -Ü (Ü) Capital U, diaeresis -Ý (Ý) Capital Y, acute accent -Þ (Þ) Capital thorn -ß (ß) Small Sharp s -à (à) Small a, grave accent -á (á) Small a, acute accent -â (â) Small a, circumflex accent -ã (ã) Small a, tilde -ä (ä) Small a, diaeresis -å (å) Small a, ring -æ (æ) Small ae ligature -ç (ç) Small c, cedilla -è (è) Small e, grave accent -é (é) Small e, acute accent -ê (ê) Small e, circumflex accent -ë (ë) Small e, diaeresis -ì (ì) Small i, grave accent -í (í) Small i, acute accent -î (î) Small i, circumflex accent -ï (ï) Small i, diaeresis -ð (ð) Small eth -ñ (ñ) Small n, tilde -ò (ò) Small o, grave accent -ó (ó) Small o, acute accent -ô (ô) Small o, circumflex accent -õ (õ) Small o, tilde -ö (ö) Small o, diaeresis -÷ (÷) Division -ø (ø) Small o, slash -ù (ù) Small u, grave accent -ú (ú) Small u, acute accent -û (û) Small u, circumflex accent -ü (ü) Small u, diaeresis -ý (ý) Small y, acute accent -þ (þ) Small thorn -ÿ (ÿ) Small y, diaeresis + ( ) Nonbreaking space +¡ (¡) Inverted exclamation mark +¢ (¢) Cent sign +£ (£) Pound sign +¤ (¤) Currency sign +¥ (¥) Yen sign +¦ (¦) Broken vertical bar +§ (§) Section sign +¨ (¨) Diaeresis +© (©) Copyright +ª (ª) Feminine ordinal +« («) Left Pointing Guillemet +¬ (¬) Not sign + (­) Soft hyphen +® (®) Registered trademark +¯ (¯) Macron +° (°) Degree sign +± (±) Plus-minus sign +² (²) Superscript 2 +³ (³) Superscript 3 +´ (´) Acute accent +µ (µ) Micro sign +¶ (¶) Paragraph sign +· (·) Middle dot +¸ (¸) Cedilla +¹ (¹) Superscript 1 +º (º) Masculine ordinal +» (») Right Pointing Guillemet +¼ (¼) Fraction one-fourth +½ (½) Fraction one-half +¾ (¾) Fraction three-fourths +¿ (¿) Inverted question mark +À (À) Capital A, grave accent +Á (Á) Capital A, acute accent +Â (Â) Capital A, circumflex accent +Ã (Ã) Capital A, tilde +Ä (Ä) Capital A, diaeresis +Å (Å) Capital A, ring +Æ (Æ) Capital AE ligature +Ç (Ç) Capital C, cedilla +È (È) Capital E, grave accent +É (É) Capital E, acute accent +Ê (Ê) Capital E, circumflex accent +Ë (Ë) Capital E, diaeresis +Ì (Ì) Capital I, grave accent +Í (Í) Capital I, acute accent +Î (Î) Capital I, circumflex accent +Ï (Ï) Capital I, diaeresis +Ð (Ð) Capital eth +Ñ (Ñ) Capital N, tilde +Ò (Ò) Capital O, grave accent +Ó (Ó) Capital O, acute accent +Ô (Ô) Capital O, circumflex accent +Õ (Õ) Capital O, tilde +Ö (Ö) Capital O, diaeresis +× (×) Multiplication +Ø (Ø) Capital O, slash +Ù (Ù) Capital U, grave accent +Ú (Ú) Capital U, acute accent +Û (Û) Capital U, circumflex accent +Ü (Ü) Capital U, diaeresis +Ý (Ý) Capital Y, acute accent +Þ (Þ) Capital thorn +ß (ß) Small Sharp s +à (à) Small a, grave accent +á (á) Small a, acute accent +â (â) Small a, circumflex accent +ã (ã) Small a, tilde +ä (ä) Small a, diaeresis +å (å) Small a, ring +æ (æ) Small ae ligature +ç (ç) Small c, cedilla +è (è) Small e, grave accent +é (é) Small e, acute accent +ê (ˆ) Small e, circumflex accent +ë (ë) Small e, diaeresis +ì (ì) Small i, grave accent +í (í) Small i, acute accent +î (î) Small i, circumflex accent +ï (ï) Small i, diaeresis +ð (ð) Small eth +ñ (ñ) Small n, tilde +ò (ò) Small o, grave accent +ó (ó) Small o, acute accent +ô (ô) Small o, circumflex accent +õ (õ) Small o, tilde +ö (ö) Small o, diaeresis +÷ (÷) Division +ø (ø) Small o, slash +ù (ù) Small u, grave accent +ú (ú) Small u, acute accent +û (û) Small u, circumflex accent +ü (ü) Small u, diaeresis +ý (ý) Small y, acute accent +þ (þ) Small thorn +ÿ (ÿ) Small y, diaeresis Ă (Ă) Capital A, romanian accent ă (ă) Small a, romanian accent č (č) Small c, caron @@ -146,25 +146,25 @@ Ţ (Ț) Capital T, comma accent below ţ (ț) Small t, comma accent below ‐ (‐) Hyphen -– (–) En dash -— (—) Em dash -‘ (‘) Left Single Quotation mark -’ (’) Right Single Quotation mark -‚ (‚) Single Low-9 Quotation mark -“ (“) Left Double Quotation mark -” (”) Right Double Quotation mark -„ („) Double Low-9 Quotation mark -† (†) Dagger -‡ (‡) Double Dagger -• (•) Bullet -… (…) Horizontal Ellipsis -‰ (‰) Per Mille sign -‹ (‹) Single Left-Pointing Angle Quotation mark -› (›) Single Right-Pointing Angle Quotation mark -⁄ (⁄) Fraction slash +– (–) En dash +— (—) Em dash +‘ (‘) Left Single Quotation mark +’ (’) Right Single Quotation mark +‚ (‚) Single Low-9 Quotation mark +“ (“) Left Double Quotation mark +” (”) Right Double Quotation mark +„ („) Double Low-9 Quotation mark +† (†) Dagger +‡ (‡) Double Dagger +• (•) Bullet +… (…) Horizontal Ellipsis +‰ (‰) Per Mille sign +‹ (‹) Single Left-Pointing Angle Quotation mark +› (›) Single Right-Pointing Angle Quotation mark +⁄ (⁄) Fraction slash ₣ (₣) French Franc sign ₧ (₧) Peseta sign ₪ (₪) New Sheqel sign ₫ (₫) Dong sign -€ (€) Euro currency sign -™ (™) Trade Mark sign +€ (€) Euro currency sign +™ (™) Trade Mark sign --- branches/KDE/3.5/kdewebdev/quanta/src/document.cpp #769456:769457 @@ -858,7 +858,7 @@ { m_replaceLine = line; m_replaceCol = column; - m_replaceStr = QString("&#%1;").arg(string[0].unicode()); + m_replaceStr = QuantaCommon::encodedChar(string[0].unicode()); QTimer::singleShot(0, this, SLOT(slotReplaceChar())); return; } @@ -871,7 +871,7 @@ { m_replaceLine = line; m_replaceCol = column; - m_replaceStr = QString("&#%1;").arg(c); + m_replaceStr = QuantaCommon::encodedChar(c); QTimer::singleShot(0, this, SLOT(slotReplaceChar())); return; } --- branches/KDE/3.5/kdewebdev/quanta/src/quanta_init.cpp #769456:769457 @@ -113,6 +113,7 @@ #include "tagactionmanager.h" #include "tagactionset.h" +extern QMap replacementMap; QuantaInit::QuantaInit(QuantaApp * quantaApp) : QObject() @@ -292,7 +293,16 @@ t.setEncoding(QTextStream::UnicodeUTF8); QString s; while (!t.eof()) - charList << i18n(t.readLine().utf8()); // line excluding '\n' + { + s = t.readLine(); + charList << i18n(s.utf8()); // line excluding '\n' + int begin = s.find("(&") + 1; + if (begin == 1) + continue; + int length = s.find(";)") - begin + 1; + QString s2 = s.mid(begin, length - 1); + replacementMap[s[0].unicode()] = s2; + } file.close(); } --- branches/KDE/3.5/kdewebdev/quanta/utility/quantacommon.cpp #769456:769457 @@ -74,6 +74,7 @@ QString toolbarExtension = ".toolbar.tgz"; QRegExp newLineRx("\\n"); QStringList charList; //hold the list of the &char; chars. See the data/chars file. +QMap replacementMap; QPtrList tempFileList; QPtrList tempDirList; bool typingInProgress; @@ -741,4 +742,12 @@ return path; } +QString QuantaCommon::encodedChar(uint code) +{ + + if (replacementMap.contains(code)) + return QString("%1;").arg(replacementMap[code]); + else + return QString("&#%1;").arg(code); +} --- branches/KDE/3.5/kdewebdev/quanta/utility/quantacommon.h #769456:769457 @@ -211,6 +211,15 @@ */ static QString readPathEntry(KConfig *config, const QString &pKey); + /** + * Returns the HTML encoding string for character with the specified code. + * If no such literal encoding is known (like ä), the numeric encoding + * is returned: &#code; + * @param code the numeric code of the character + * @return the encoded string + */ + static QString encodedChar(uint code); + }; #endif