mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Export Inset Cite (docbook)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9100 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f65b01c798
commit
c6bf338207
@ -1,3 +1,8 @@
|
||||
2004-10-17 Andreas Vox <vox@isp.uni-luebeck.de>
|
||||
|
||||
* insetcite.[hC] (docbook, latex, cleanupWhitespace): implementing
|
||||
DocBook output for this inset ( <citation>content</citation> )
|
||||
|
||||
2004-10-05 Andreas Vox <vox@isp.uni-luebeck.de>
|
||||
|
||||
* insetgraphics.C (docbook) : using mediaobject for XML;
|
||||
|
@ -324,6 +324,35 @@ int InsetCitation::plaintext(Buffer const & buffer, ostream & os, OutputParams c
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
string const cleanupWhitespace(string const & citelist)
|
||||
{
|
||||
string::const_iterator it = citelist.begin();
|
||||
string::const_iterator end = citelist.end();
|
||||
// Paranoia check: make sure that there is no whitespace in here
|
||||
// -- at least not behind commas or at the beginning
|
||||
string result;
|
||||
char last = ',';
|
||||
for (; it != end; ++it) {
|
||||
if (*it != ' ')
|
||||
last = *it;
|
||||
if (*it != ' ' || last != ',')
|
||||
result += *it;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// end anon namyspace
|
||||
}
|
||||
|
||||
int InsetCitation::docbook(Buffer const &, ostream & os, OutputParams const &) const
|
||||
{
|
||||
os << "<citation>" << cleanupWhitespace(getContents()) << "</citation>";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Have to overwrite the default InsetCommand method in order to check that
|
||||
// the \cite command is valid. Eg, the user has natbib enabled, inputs some
|
||||
// citations and then changes his mind, turning natbib support off. The output
|
||||
@ -344,19 +373,7 @@ int InsetCitation::latex(Buffer const & buffer, ostream & os,
|
||||
else if (!after.empty())
|
||||
os << '[' << after << ']';
|
||||
|
||||
string::const_iterator it = getContents().begin();
|
||||
string::const_iterator end = getContents().end();
|
||||
// Paranoia check: make sure that there is no whitespace in here
|
||||
string content;
|
||||
char last = ',';
|
||||
for (; it != end; ++it) {
|
||||
if (*it != ' ')
|
||||
last = *it;
|
||||
if (*it != ' ' || last != ',')
|
||||
content += *it;
|
||||
}
|
||||
|
||||
os << '{' << content << '}';
|
||||
os << '{' << cleanupWhitespace(getContents()) << '}';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -40,6 +40,9 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user