X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fbuffer.C;h=c42098707bacd16f6a317ccef77d38358371ece2;hb=a393cfc37c978985f534f9f00bdbbcfed07b3731;hp=a89d1e316039dca66d55a62f2be989fbcfe31b22;hpb=d659612225b93787899a9e5f1c622ba93d181651;p=lyx.git
diff --git a/src/buffer.C b/src/buffer.C
index a89d1e3160..c42098707b 100644
--- a/src/buffer.C
+++ b/src/buffer.C
@@ -14,24 +14,6 @@
#include
-#include
-#include
-#include
";
@@ -2765,7 +2861,7 @@ void operator|=(PAR_TAG & p1, PAR_TAG const & p2)
inline
void reset(PAR_TAG & p1, PAR_TAG const & p2)
{
- p1 = static_cast( p1 & ~p2);
+ p1 = static_cast(p1 & ~p2);
}
} // namespace anon
@@ -2890,7 +2986,7 @@ void Buffer::simpleLinuxDocOnePar(ostream & os,
}
list < PAR_TAG > temp;
- while(!tag_state.empty() && tag_close ) {
+ while (!tag_state.empty() && tag_close) {
PAR_TAG k = tag_state.top();
tag_state.pop();
os << "" << tag_name(k) << ">";
@@ -2971,8 +3067,8 @@ void Buffer::sgmlError(Paragraph * par, int pos,
{
// insert an error marker in text
InsetError * new_inset = new InsetError(message);
- par->insertInset(pos, new_inset);
- par->setFont(pos, LyXFont(LyXFont::ALL_INHERIT, params.language));
+ par->insertInset(pos, new_inset, LyXFont(LyXFont::ALL_INHERIT,
+ params.language));
}
@@ -3126,10 +3222,12 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
// treat label as a special case for
// more WYSIWYM handling.
+ // This is a hack while paragraphs can't have
+ // attributes, like id in this case.
if (par->isInset(0)) {
Inset * inset = par->getInset(0);
Inset::Code lyx_code = inset->lyxCode();
- if (lyx_code == Inset::LABEL_CODE){
+ if (lyx_code == Inset::LABEL_CODE) {
command_name += " id=\"";
command_name += (static_cast(inset))->getContents();
command_name += "\"";
@@ -3153,7 +3251,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
}
if (environment_stack[depth] != style.latexname()) {
- if(environment_stack.size() == depth + 1) {
+ if (environment_stack.size() == depth + 1) {
environment_stack.push_back("!-- --");
environment_inner.push_back("!-- --");
}
@@ -3176,7 +3274,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
if (style.latextype == LATEX_ENVIRONMENT) {
if (!style.latexparam().empty()) {
- if(style.latexparam() == "CDATA")
+ if (style.latexparam() == "CDATA")
ofs << "";
else
sgmlCloseTag(ofs, depth + command_depth,
@@ -3300,24 +3398,26 @@ void Buffer::simpleDocBookOnePar(ostream & os,
if (font.emph() == LyXFont::ON) {
os << "";
emph_flag = true;
- }else if(i) {
+ } else if (i) {
os << "";
emph_flag = false;
}
}
- char c = par->getChar(i);
- if (c == Paragraph::META_INSET) {
+ if (par->isInset(i)) {
Inset * inset = par->getInset(i);
- inset->docbook(this, os);
+ // don't print the inset in position 0 if desc_on == 3 (label)
+ if (i || desc_on != 3)
+ inset->docbook(this, os);
} else {
+ char c = par->getChar(i);
string sgml_string;
par->sgmlConvertChar(c, sgml_string);
if (style.pass_thru) {
os << c;
- } else if(style.free_spacing || par->isFreeSpacing() || c != ' ') {
+ } else if (style.free_spacing || par->isFreeSpacing() || c != ' ') {
os << sgml_string;
} else if (desc_on ==1) {
++char_line_count;
@@ -3339,7 +3439,7 @@ void Buffer::simpleDocBookOnePar(ostream & os,
// not closed...
os << "";
}
- if(style.free_spacing) os << '\n';
+ if (style.free_spacing) os << '\n';
}
@@ -3354,7 +3454,7 @@ int Buffer::runChktex()
// get LaTeX-Filename
string const name = getLatexName();
- string path = OnlyPath(filename);
+ string path = filePath();
string const org_path = path;
if (lyxrc.use_tempdir || !IsDirWriteable(path)) {
@@ -3371,7 +3471,7 @@ int Buffer::runChktex()
makeLaTeXFile(name, org_path, false);
TeXErrors terr;
- Chktex chktex(lyxrc.chktex_command, name, filepath);
+ Chktex chktex(lyxrc.chktex_command, name, filePath());
int res = chktex.run(terr); // run chktex
if (res == -1) {
@@ -3384,7 +3484,7 @@ int Buffer::runChktex()
// if we removed error insets before we ran chktex or if we inserted
// error insets after we ran chktex, this must be run:
- if (removedErrorInsets || res){
+ if (removedErrorInsets || res) {
users->redraw();
users->fitCursor();
}
@@ -3402,7 +3502,7 @@ void Buffer::validate(LaTeXFeatures & features) const
// AMS Style is at document level
if (params.use_amsmath || tclass.provides(LyXTextClass::amsmath))
- features.require("amsstyle");
+ features.require("amsmath");
while (par) {
// We don't use "lyxerr.debug" because of speed. (Asger)