mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 06:15:16 +00:00
0b95bed295
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4912 a592a061-630c-0410-9148-cb99ea01b6c8
81 lines
1.1 KiB
C
81 lines
1.1 KiB
C
/**
|
|
* \file sgml.C
|
|
* Copyright 2002 the LyX Team
|
|
* Read the file COPYING
|
|
*
|
|
* \author José Matos
|
|
* \author John Levon <levon@movementarian.org>
|
|
*/
|
|
|
|
#include "sgml.h"
|
|
#include "paragraph.h"
|
|
|
|
using std::pair;
|
|
using std::make_pair;
|
|
|
|
namespace sgml {
|
|
|
|
pair<bool, string> escapeChar(char c)
|
|
{
|
|
string str;
|
|
|
|
switch (c) {
|
|
case Paragraph::META_HFILL:
|
|
break;
|
|
case Paragraph::META_NEWLINE:
|
|
str = '\n';
|
|
break;
|
|
case ' ':
|
|
return make_pair(true, string(" "));
|
|
break;
|
|
case '\0': // Ignore :-)
|
|
str.erase();
|
|
break;
|
|
case '&':
|
|
str = "&";
|
|
break;
|
|
case '<':
|
|
str = "<";
|
|
break;
|
|
case '>':
|
|
str = ">";
|
|
break;
|
|
case '$':
|
|
str = "$";
|
|
break;
|
|
case '#':
|
|
str = "#";
|
|
break;
|
|
case '%':
|
|
str = "%";
|
|
break;
|
|
case '[':
|
|
str = "[";
|
|
break;
|
|
case ']':
|
|
str = "]";
|
|
break;
|
|
case '{':
|
|
str = "{";
|
|
break;
|
|
case '}':
|
|
str = "}";
|
|
break;
|
|
case '~':
|
|
str = "˜";
|
|
break;
|
|
case '"':
|
|
str = """;
|
|
break;
|
|
case '\\':
|
|
str = "\";
|
|
break;
|
|
default:
|
|
str = c;
|
|
break;
|
|
}
|
|
return make_pair(false, str);
|
|
}
|
|
|
|
} // namespace sgml
|