2012-02-20 21:47:14 +00:00
|
|
|
/* This file is (c) 2008-2012 Konstantin Isakov <ikm@goldendict.org>
|
2009-01-28 20:55:45 +00:00
|
|
|
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
|
|
|
|
|
|
|
#ifndef __HTMLESCAPE_HH_INCLUDED__
|
|
|
|
#define __HTMLESCAPE_HH_INCLUDED__
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace Html {
|
|
|
|
|
|
|
|
using std::string;
|
|
|
|
|
|
|
|
// Replaces &, <, > and " by their html entity equivalents
|
|
|
|
// The " is not really required to be escaped in html, but is replaced anyway
|
|
|
|
// to make the result suitable for inserting as attributes' values.
|
|
|
|
string escape( string const & );
|
|
|
|
|
2009-04-09 18:50:49 +00:00
|
|
|
// Converts the given preformatted text to html. Each end of line is replaced by
|
|
|
|
// <br>, each leading space is converted to .
|
2013-07-13 11:24:58 +00:00
|
|
|
string preformat( string const &, bool baseRightToLeft = false );
|
2009-04-09 18:50:49 +00:00
|
|
|
|
2009-04-12 11:28:56 +00:00
|
|
|
// Escapes the given string to be included in JavaScript.
|
|
|
|
string escapeForJavaScript( string const & );
|
|
|
|
|
2012-09-07 13:58:45 +00:00
|
|
|
// Replace html entities
|
|
|
|
QString unescape( QString const & str );
|
2012-11-14 12:54:31 +00:00
|
|
|
string unescapeUtf8( string const & str );
|
2012-09-07 13:58:45 +00:00
|
|
|
|
2009-01-28 20:55:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|