mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Escape content form inset index. (docbook)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9120 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b6263feca7
commit
d507a0b147
@ -1,3 +1,7 @@
|
||||
2004-10-25 José Matos <jamatos@lyx.org>
|
||||
|
||||
* sgml.[Ch] (escapeString): new function to escape all the string.
|
||||
|
||||
2004-10-24 José Matos <jamatos@lyx.org>
|
||||
|
||||
* paragraph.[Ch] (getFirstWord): new function to get the first
|
||||
|
@ -1,3 +1,7 @@
|
||||
2004-10-24 Andreas Vox <vox@isp.uni-luebeck.de>
|
||||
|
||||
* insetindex.C (docbook): escape the index, to generate correct sgml.
|
||||
|
||||
2004-10-23 José Matos <jamatos@lyx.org>
|
||||
|
||||
* insettext.C (docbook): rearrange arguments, due to change in the upper
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "gettext.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "metricsinfo.h"
|
||||
#include "sgml.h"
|
||||
|
||||
#include "support/std_ostream.h"
|
||||
|
||||
@ -42,7 +43,7 @@ string const InsetIndex::getScreenLabel(Buffer const &) const
|
||||
int InsetIndex::docbook(Buffer const &, ostream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << "<indexterm><primary>" << getContents()
|
||||
os << "<indexterm><primary>" << sgml::escapeString(getContents())
|
||||
<< "</primary></indexterm>";
|
||||
return 0;
|
||||
}
|
||||
|
18
src/sgml.C
18
src/sgml.C
@ -23,15 +23,17 @@
|
||||
#include "support/std_ostream.h"
|
||||
#include "support/tostr.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using lyx::support::subst;
|
||||
|
||||
using std::make_pair;
|
||||
|
||||
using std::ostream;
|
||||
using std::ostringstream;
|
||||
using std::pair;
|
||||
using std::string;
|
||||
|
||||
|
||||
namespace sgml {
|
||||
|
||||
pair<bool, string> escapeChar(char c)
|
||||
@ -94,6 +96,20 @@ pair<bool, string> escapeChar(char c)
|
||||
}
|
||||
|
||||
|
||||
string escapeString(string const & raw)
|
||||
{
|
||||
ostringstream bin;
|
||||
|
||||
for(int i=0; i < raw.size(); ++i) {
|
||||
bool ws;
|
||||
string str;
|
||||
boost::tie(ws, str) = sgml::escapeChar(raw[i]);
|
||||
bin << str;
|
||||
}
|
||||
return bin.str();
|
||||
}
|
||||
|
||||
|
||||
int openTag(Buffer const & buf, ostream & os, Paragraph::depth_type depth,
|
||||
bool mixcont, string const & name, string const & param)
|
||||
{
|
||||
|
@ -29,6 +29,9 @@ namespace sgml {
|
||||
*/
|
||||
std::pair<bool, std::string> escapeChar(char c);
|
||||
|
||||
/// Escape a word instead of a single character
|
||||
std::string escapeString(std::string const & raw);
|
||||
|
||||
/// Opens tag
|
||||
int openTag(Buffer const & buf, std::ostream & os, lyx::depth_type depth,
|
||||
bool mixcont, std::string const & name,
|
||||
|
Loading…
Reference in New Issue
Block a user