From: José Matox Date: Sat, 14 Aug 2004 18:41:27 +0000 (+0000) Subject: up to file format 236 and also fix Bug 421. X-Git-Tag: 1.6.10~15070 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=498724d21beabdddf99a17a182eac65370b91b2b;p=features.git up to file format 236 and also fix Bug 421. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8927 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/lib/lyx2lyx/ChangeLog b/lib/lyx2lyx/ChangeLog index a00bd9d6f8..e9eb8fe13a 100644 --- a/lib/lyx2lyx/ChangeLog +++ b/lib/lyx2lyx/ChangeLog @@ -1,3 +1,7 @@ +2004-08-14 José Matos + * lyx_1_4.py: + * parser_tools.py: up the format to 236. + 2004-08-05 José Matos * lyx_1.4.py (remove_color_default): move diff --git a/lib/lyx2lyx/lyx_1_4.py b/lib/lyx2lyx/lyx_1_4.py index 82997ca1d5..c02f4e6194 100644 --- a/lib/lyx2lyx/lyx_1_4.py +++ b/lib/lyx2lyx/lyx_1_4.py @@ -1335,6 +1335,9 @@ def revert_cite_engine(header, opt): header.insert(i, "\\use_natbib " + use_natbib) +## +# Paper package +# def convert_paperpackage(header, opt): i = find_token(header, "\\paperpackage", 0) if i == -1: @@ -1359,9 +1362,91 @@ def revert_paperpackage(header, opt): ## -# Convertion hub +# Bullets +# +def convert_bullets(header, opt): + i = 0 + while 1: + i = find_token(header, "\\bullet", i) + if i == -1: + return + if header[i][:12] == '\\bulletLaTeX': + header[i] = header[i] + ' ' + strip(header[i+1]) + n = 3 + else: + header[i] = header[i] + ' ' + strip(header[i+1]) +\ + ' ' + strip(header[i+2]) + ' ' + strip(header[i+3]) + n = 5 + del header[i+1:i + n] + i = i + 1 + + +def revert_bullets(header, opt): + i = 0 + while 1: + i = find_token(header, "\\bullet", i) + if i == -1: + return + if header[i][:12] == '\\bulletLaTeX': + n = find(header[i], '"') + if n == -1: + opt.warn("Malformed header") + return + else: + header[i:i+1] = [header[i][:n-1],'\t' + header[i][n:], '\\end_bullet'] + i = i + 3 + else: + frag = split(header[i]) + if len(frag) != 5: + opt.warn("Malformed header") + return + else: + header[i:i+1] = [frag[0] + ' ' + frag[1], + '\t' + frag[2], + '\t' + frag[3], + '\t' + frag[4], + '\\end_bullet'] + i = i + 5 + + +## +# \begin_header and \begin_document # +def add_begin_header(header, opt): + i = find_token(header, '\\lyxformat', 0) + header.insert(i+1, '\\begin_header') + header.insert(i+1, '\\begin_document') + + +def remove_begin_header(header, opt): + i = find_token(header, "\\begin_header", 0) + if i != -1: + del header[i] + i = find_token(header, "\\begin_document", 0) + if i != -1: + del header[i] + +## +# \begin_body and \end_body +# +def add_begin_body(body, opt): + body.insert(0, '\\begin_body') + i = find_token(body, "\\end_document", 0) + body.insert(i, '\\end_body') + +def remove_begin_body(body, opt): + i = find_token(body, "\\begin_body", 0) + if i != -1: + del body[i] + i = find_token(body, "\\end_body", 0) + if i != -1: + del body[i] + + +## +# Convertion hub +# def convert(header, body, opt): if opt.format < 223: insert_tracking_changes(header) @@ -1438,8 +1523,22 @@ def convert(header, body, opt): if opt.format < 235: convert_paperpackage(header, opt) opt.format = 235 + if opt.end == opt.format: return + + if opt.format < 236: + convert_bullets(header, opt) + add_begin_header(header, opt) + add_begin_body(body, opt) + opt.format = 236 def revert(header, body, opt): + if opt.format > 235: + remove_begin_body(body, opt) + remove_begin_header(header, opt) + revert_bullets(header, opt) + opt.format = 235 + if opt.end == opt.format: return + if opt.format > 234: revert_paperpackage(header, opt) opt.format = 234 diff --git a/lib/lyx2lyx/parser_tools.py b/lib/lyx2lyx/parser_tools.py index ff93682113..90dc4e4a9e 100644 --- a/lib/lyx2lyx/parser_tools.py +++ b/lib/lyx2lyx/parser_tools.py @@ -273,7 +273,7 @@ def set_version(lines, version): format_re = re.compile(r"(\d)[\.,]?(\d\d)") fileformat = re.compile(r"\\lyxformat\s*(\S*)") lst_ft = [210, 215, 216, 217, 218, 220, 221, 223, 224, 225, 226, 227, 228, 229, - 230, 231, 232, 233, 234, 235] + 230, 231, 232, 233, 234, 235, 236] format_relation = [("0_10", [210], ["0.10.7","0.10"]), ("0_12", [215], ["0.12","0.12.1","0.12"]), @@ -285,7 +285,7 @@ format_relation = [("0_10", [210], ["0.10.7","0.10"]), ("1_1_6fix3", [218], ["1.1.6fix3","1.1.6fix4","1.1"]), ("1_2", [220], ["1.2.0","1.2.1","1.2.3","1.2.4","1.2"]), ("1_3", [221], ["1.3.0","1.3.1","1.3.2","1.3.3","1.3.4","1.3"]), - ("1_4", [223,224,225,226,227,228,229,230,231,232,233,234,235], ["1.4.0cvs","1.4"])] + ("1_4", [223,224,225,226,227,228,229,230,231,232,233,234,235, 236], ["1.4.0cvs","1.4"])] def lyxformat(format, opt): diff --git a/src/ChangeLog b/src/ChangeLog index 2e1e3bd18c..e0b6e3d491 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,20 @@ +2004-08-14 José Matos + + * Buffer.[Ch] (readDocument): new name for old readBody. + * Buffer.C: new file format, new keywords: \begin_document, + \begin_header, \begin_body, \end_body. + + * bufferparams.C (readToken): replace all calls to lex.nextToken + by lex.next(). Do the same to eatLine except where really needed. + + * lyxfont.C (lyxWriteChanges): remove whitespaces in the end of + line when writing to the lyx file. + + * output_plaintext.C (asciiParagraph): fix Bibliography style + handling. + + * text.C (read): fix end of file handling. + 2004-08-14 Jean-Marc Lasgouttes * MenuBackend.C (Menu::operator[]): new method to access diff --git a/src/buffer.C b/src/buffer.C index d669651885..1360653778 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -137,7 +137,7 @@ extern BufferList bufferlist; namespace { -const int LYX_FORMAT = 235; +const int LYX_FORMAT = 236; } // namespace anon @@ -393,9 +393,11 @@ void unknownClass(string const & unknown) int Buffer::readHeader(LyXLex & lex) { int unknown_tokens = 0; + int line = -1; + int begin_header_line = -1; while (lex.isOK()) { - lex.nextToken(); + lex.next(); string const token = lex.getString(); if (token.empty()) @@ -404,13 +406,18 @@ int Buffer::readHeader(LyXLex & lex) if (token == "\\end_header") break; + ++line; + if (token == "\\begin_header") { + begin_header_line = line; + continue; + } + lyxerr[Debug::PARSER] << "Handling header token: `" << token << '\'' << endl; - string unknown = params().readToken(lex, token); if (!unknown.empty()) { - if (unknown[0] != '\\') { + if (unknown[0] != '\\' and token == "\\textclass") { unknownClass(unknown); } else { ++unknown_tokens; @@ -423,6 +430,10 @@ int Buffer::readHeader(LyXLex & lex) } } } + if (begin_header_line) { + string const s = _("\\begin_header is missing"); + error(ErrorItem(_("Header error"), s, -1, 0, 0)); + } return unknown_tokens; } @@ -430,8 +441,15 @@ int Buffer::readHeader(LyXLex & lex) // Uwe C. Schroeder // changed to be public and have one parameter // Returns false if "\end_document" is not read (Asger) -bool Buffer::readBody(LyXLex & lex) +bool Buffer::readDocument(LyXLex & lex) { + lex.next(); + string const token = lex.getString(); + if (token != "\\begin_document") { + string const s = _("\\begin_document is missing"); + error(ErrorItem(_("Header error"), s, -1, 0, 0)); + } + if (paragraphs().empty()) { readHeader(lex); if (!params().getLyXTextClass().load()) { @@ -581,7 +599,7 @@ bool Buffer::readFile(LyXLex & lex, string const & filename, par_type pit) return false; } - lex.eatLine(); + lex.next(); string tmp_format = lex.getString(); //lyxerr << "LyX Format: `" << tmp_format << '\'' << endl; // if present remove ".," from string. @@ -592,13 +610,7 @@ bool Buffer::readFile(LyXLex & lex, string const & filename, par_type pit) int file_format = strToInt(tmp_format); //lyxerr << "format: " << file_format << endl; - if (file_format > LYX_FORMAT) { - Alert::warning(_("Document format failure"), - bformat(_("%1$s was created with a newer" - " version of LyX. This is likely to" - " cause problems."), - filename)); - } else if (file_format < LYX_FORMAT) { + if (file_format != LYX_FORMAT) { string const tmpfile = tempName(); if (tmpfile.empty()) { Alert::error(_("Conversion failed"), @@ -642,26 +654,18 @@ bool Buffer::readFile(LyXLex & lex, string const & filename, par_type pit) } - bool the_end = readBody(lex); - //lyxerr << "removing " << MacroTable::localMacros().size() - // << " temporary macro entries" << endl; - //MacroTable::localMacros().clear(); - params().setPaperStuff(); - -#ifdef WITH_WARNINGS -#warning Look here! -#endif -#if 0 - if (token == "\\end_document") - the_end_read = true; - - if (!the_end) { + if (readDocument(lex)) { Alert::error(_("Document format failure"), bformat(_("%1$s ended unexpectedly, which means" " that it is probably corrupted."), filename)); } -#endif + + //lyxerr << "removing " << MacroTable::localMacros().size() + // << " temporary macro entries" << endl; + //MacroTable::localMacros().clear(); + params().setPaperStuff(); + pimpl_->file_fully_loaded = true; return true; } @@ -784,18 +788,21 @@ bool Buffer::do_writeFile(ostream & ofs) const // write out a comment in the top of the file ofs << "#LyX " << lyx_version << " created this file. For more info see http://www.lyx.org/\n" - << "\\lyxformat " << LYX_FORMAT << "\n"; + << "\\lyxformat " << LYX_FORMAT << "\n" + << "\\begin_document\n"; // now write out the buffer parameters. + ofs << "\n\\begin_header\n"; params().writeFile(ofs); - ofs << "\\end_header\n"; - + // write the text + ofs << "\n\\begin_body\n"; text().write(*this, ofs); + ofs << "\n\\end_body\n"; // Write marker that shows file is complete - ofs << "\n\\end_document" << endl; + ofs << "\\end_document" << endl; // Shouldn't really be needed.... //ofs.close(); diff --git a/src/buffer.h b/src/buffer.h index 5ddca29398..20dd748ef0 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -95,7 +95,7 @@ public: \param par if != 0 insert the file. \return \c false if file is not completely read. */ - bool readBody(LyXLex &); + bool readDocument(LyXLex &); /// void insertStringAsLines(ParagraphList & plist, diff --git a/src/bufferparams.C b/src/bufferparams.C index 448edc75dc..d593f230d5 100644 --- a/src/bufferparams.C +++ b/src/bufferparams.C @@ -218,7 +218,7 @@ void BufferParams::setDefSkip(VSpace const & vs) string const BufferParams::readToken(LyXLex & lex, string const & token) { if (token == "\\textclass") { - lex.eatLine(); + lex.next(); string const classname = lex.getString(); pair pp = textclasslist.NumberOfClass(classname); @@ -242,12 +242,12 @@ string const BufferParams::readToken(LyXLex & lex, string const & token) } else if (token == "\\language") { readLanguage(lex); } else if (token == "\\inputencoding") { - lex.eatLine(); + lex.next(); inputenc = lex.getString(); } else if (token == "\\graphics") { readGraphicsDriver(lex); } else if (token == "\\fontscheme") { - lex.eatLine(); + lex.next(); fonts = lex.getString(); } else if (token == "\\paragraph_separation") { int tmpret = lex.findToken(string_paragraph_separation); @@ -256,7 +256,7 @@ string const BufferParams::readToken(LyXLex & lex, string const & token) paragraph_separation = static_cast(tmpret); } else if (token == "\\defskip") { - lex.nextToken(); + lex.next(); pimpl_->defskip = VSpace(lex.getString()); } else if (token == "\\quotes_language") { // FIXME: should be params.readQuotes() @@ -288,7 +288,7 @@ string const BufferParams::readToken(LyXLex & lex, string const & token) quotes_language = tmpl; } else if (token == "\\quotes_times") { // FIXME: should be params.readQuotes() - lex.nextToken(); + lex.next(); switch (lex.getInteger()) { case 1: quotes_times = InsetQuotes::SingleQ; @@ -311,14 +311,14 @@ string const BufferParams::readToken(LyXLex & lex, string const & token) } else paperpackage = PAPER_PACKAGES(tmpret); } else if (token == "\\use_geometry") { - lex.nextToken(); + lex.next(); use_geometry = lex.getInteger(); } else if (token == "\\use_amsmath") { - lex.nextToken(); + lex.next(); use_amsmath = static_cast( lex.getInteger()); } else if (token == "\\cite_engine") { - lex.nextToken(); + lex.next(); string const engine = lex.getString(); cite_engine = biblio::ENGINE_BASIC; @@ -330,29 +330,29 @@ string const BufferParams::readToken(LyXLex & lex, string const & token) cite_engine = biblio::ENGINE_JURABIB; } else if (token == "\\use_bibtopic") { - lex.nextToken(); + lex.next(); use_bibtopic = lex.getInteger(); } else if (token == "\\tracking_changes") { - lex.nextToken(); + lex.next(); tracking_changes = lex.getInteger(); } else if (token == "\\branch") { - lex.nextToken(); + lex.next(); string branch = lex.getString(); branchlist().add(branch); while (true) { - lex.nextToken(); + lex.next(); string const tok = lex.getString(); if (tok == "\\end_branch") break; Branch * branch_ptr = branchlist().find(branch); if (tok == "\\selected") { - lex.nextToken(); + lex.next(); if (branch_ptr) branch_ptr->setSelected(lex.getInteger()); } // not yet operational if (tok == "\\color") { - lex.nextToken(); + lex.eatLine(); string color = lex.getString(); if (branch_ptr) branch_ptr->setColor(color); @@ -364,7 +364,7 @@ string const BufferParams::readToken(LyXLex & lex, string const & token) } } } else if (token == "\\author") { - lex.nextToken(); + lex.next(); istringstream ss(lex.getString()); Author a; ss >> a; @@ -403,77 +403,55 @@ string const BufferParams::readToken(LyXLex & lex, string const & token) lex.next(); footskip = lex.getString(); } else if (token == "\\paperfontsize") { - lex.nextToken(); - fontsize = rtrim(lex.getString()); + lex.next(); + fontsize = lex.getString(); } else if (token == "\\papercolumns") { - lex.nextToken(); + lex.next(); columns = lex.getInteger(); } else if (token == "\\papersides") { - lex.nextToken(); + lex.next(); switch (lex.getInteger()) { default: case 1: sides = LyXTextClass::OneSide; break; case 2: sides = LyXTextClass::TwoSides; break; } } else if (token == "\\paperpagestyle") { - lex.nextToken(); - pagestyle = rtrim(lex.getString()); + lex.next(); + pagestyle = lex.getString(); } else if (token == "\\bullet") { // FIXME: should be params.readBullets() - lex.nextToken(); + lex.next(); int const index = lex.getInteger(); - lex.nextToken(); + lex.next(); int temp_int = lex.getInteger(); user_defined_bullet(index).setFont(temp_int); temp_bullet(index).setFont(temp_int); - lex.nextToken(); + lex.next(); temp_int = lex.getInteger(); user_defined_bullet(index).setCharacter(temp_int); temp_bullet(index).setCharacter(temp_int); - lex.nextToken(); + lex.next(); temp_int = lex.getInteger(); user_defined_bullet(index).setSize(temp_int); temp_bullet(index).setSize(temp_int); - lex.nextToken(); - string const temp_str = lex.getString(); - if (temp_str != "\\end_bullet") { - // this element isn't really necessary for - // parsing but is easier for humans - // to understand bullets. Put it back and - // set a debug message? - lex.printError("\\end_bullet expected, got" + temp_str); - //how can I put it back? - } } else if (token == "\\bulletLaTeX") { // The bullet class should be able to read this. - lex.nextToken(); - int const index = lex.getInteger(); lex.next(); + int const index = lex.getInteger(); + lex.next(true); string temp_str = lex.getString(); - string sum_str; - while (temp_str != "\\end_bullet") { - // this loop structure is needed when user - // enters an empty string since the first - // thing returned will be the \\end_bullet - // OR - // if the LaTeX entry has spaces. Each element - // therefore needs to be read in turn - sum_str += temp_str; - lex.next(); - temp_str = lex.getString(); - } - user_defined_bullet(index).setText(sum_str); - temp_bullet(index).setText(sum_str); + user_defined_bullet(index).setText(temp_str); + temp_bullet(index).setText(temp_str); } else if (token == "\\secnumdepth") { - lex.nextToken(); + lex.next(); secnumdepth = lex.getInteger(); } else if (token == "\\tocdepth") { - lex.nextToken(); + lex.next(); tocdepth = lex.getInteger(); } else if (token == "\\spacing") { lex.next(); - string const tmp = rtrim(lex.getString()); + string const tmp = lex.getString(); Spacing::Space tmp_space = Spacing::Default; float tmp_val = 0.0; if (tmp == "single") { @@ -489,15 +467,9 @@ string const BufferParams::readToken(LyXLex & lex, string const & token) } else { lex.printError("Unknown spacing token: '$$Token'"); } -#if 0 // FIXME: Handled in lyx2lyx ? - // Small hack so that files written with klyx will be - // parsed correctly. - if (first_par) - par->params().spacing(Spacing(tmp_space, tmp_val)); -#endif spacing().set(tmp_space, tmp_val); } else if (token == "\\float_placement") { - lex.nextToken(); + lex.next(); float_placement = lex.getString(); } else { return token; @@ -624,20 +596,15 @@ void BufferParams::writeFile(ostream & os) const for (int i = 0; i < 4; ++i) { if (user_defined_bullet(i) != ITEMIZE_DEFAULTS[i]) { if (user_defined_bullet(i).getFont() != -1) { - os << "\\bullet " << i - << "\n\t" - << user_defined_bullet(i).getFont() - << "\n\t" - << user_defined_bullet(i).getCharacter() - << "\n\t" - << user_defined_bullet(i).getSize() - << "\n\\end_bullet\n"; + os << "\\bullet " << i << " " + << user_defined_bullet(i).getFont() << " " + << user_defined_bullet(i).getCharacter() << " " + << user_defined_bullet(i).getSize() << "\n"; } else { - os << "\\bulletLaTeX " << i - << "\n\t\"" + os << "\\bulletLaTeX " << i << " \"" << user_defined_bullet(i).getText() - << "\"\n\\end_bullet\n"; + << "\"\n"; } } } diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 853bd8e7a4..c5179afb1f 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,9 @@ +2004-08-14 José Matos + + * insetbibitem.[Ch] (plaintext): added. + + * insetcite.[Ch]: fix plaintext export. + 2004-08-14 Lars Gullik Bjonnes * insettext.[Ch] (setDrawFrame): take a bool, get rid of the diff --git a/src/insets/insetbibitem.C b/src/insets/insetbibitem.C index 8d148ac66f..2e74ad6803 100644 --- a/src/insets/insetbibitem.C +++ b/src/insets/insetbibitem.C @@ -24,6 +24,7 @@ #include "frontends/font_metrics.h" #include "support/lstrings.h" +#include "support/std_ostream.h" #include "support/tostr.h" using lyx::support::prefixIs; @@ -32,7 +33,7 @@ using lyx::support::strToInt; using std::max; using std::string; using std::auto_ptr; - +using std::ostream; int InsetBibitem::key_counter = 0; string const key_prefix = "key-"; @@ -123,6 +124,12 @@ string const InsetBibitem::getScreenLabel(Buffer const &) const return getContents() + " [" + getBibLabel() + ']'; } +int InsetBibitem::plaintext(Buffer const &, ostream & os, + OutputParams const &) const +{ + os << '[' << getCounter() << "] "; + return 0; +} // ale070405 This function maybe shouldn't be here. We'll fix this at 0.13. int bibitemMaxWidth(BufferView * bv, LyXFont const &) diff --git a/src/insets/insetbibitem.h b/src/insets/insetbibitem.h index 05983fb25c..b05d22fe4a 100644 --- a/src/insets/insetbibitem.h +++ b/src/insets/insetbibitem.h @@ -15,8 +15,6 @@ #include "insetcommand.h" -class Buffer; - /** Used to insert bibitem's information (key and label) Must be automatically inserted as the first object in a @@ -48,6 +46,9 @@ public: int getCounter() const { return counter; } /// std::string const getBibLabel() const; + /// + int plaintext(Buffer const &, std::ostream &, + OutputParams const &) const; protected: /// virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd); diff --git a/src/insets/insetcite.C b/src/insets/insetcite.C index ef4e21acf2..91ab2928dc 100644 --- a/src/insets/insetcite.C +++ b/src/insets/insetcite.C @@ -313,7 +313,7 @@ string const InsetCitation::getScreenLabel(Buffer const & buffer) const } -int InsetCitation::plaintext(Buffer const & buffer, ostream & os, int) const +int InsetCitation::plaintext(Buffer const & buffer, ostream & os, OutputParams const &) const { if (cache.params == params() && cache.engine == biblio::getEngine(buffer)) diff --git a/src/insets/insetcite.h b/src/insets/insetcite.h index 8a5091f33f..6d425985c4 100644 --- a/src/insets/insetcite.h +++ b/src/insets/insetcite.h @@ -35,7 +35,7 @@ public: /// InsetOld::Code lyxCode() const { return InsetOld::CITE_CODE; } /// - int plaintext(Buffer const &, std::ostream &, int linelen) const; + int plaintext(Buffer const &, std::ostream &, OutputParams const &) const; /// int latex(Buffer const &, std::ostream &, OutputParams const &) const; diff --git a/src/lyxfont.C b/src/lyxfont.C index cc05bac8f0..2ffce829c8 100644 --- a/src/lyxfont.C +++ b/src/lyxfont.C @@ -700,33 +700,33 @@ void LyXFont::lyxWriteChanges(LyXFont const & orgfont, { os << "\n"; if (orgfont.family() != family()) { - os << "\\family " << LyXFamilyNames[family()] << " \n"; + os << "\\family " << LyXFamilyNames[family()] << "\n"; } if (orgfont.series() != series()) { - os << "\\series " << LyXSeriesNames[series()] << " \n"; + os << "\\series " << LyXSeriesNames[series()] << "\n"; } if (orgfont.shape() != shape()) { - os << "\\shape " << LyXShapeNames[shape()] << " \n"; + os << "\\shape " << LyXShapeNames[shape()] << "\n"; } if (orgfont.size() != size()) { - os << "\\size " << LyXSizeNames[size()] << " \n"; + os << "\\size " << LyXSizeNames[size()] << "\n"; } if (orgfont.emph() != emph()) { - os << "\\emph " << LyXMiscNames[emph()] << " \n"; + os << "\\emph " << LyXMiscNames[emph()] << "\n"; } if (orgfont.number() != number()) { - os << "\\numeric " << LyXMiscNames[number()] << " \n"; + os << "\\numeric " << LyXMiscNames[number()] << "\n"; } if (orgfont.underbar() != underbar()) { // This is only for backwards compatibility switch (underbar()) { - case OFF: os << "\\bar no \n"; break; - case ON: os << "\\bar under \n"; break; + case OFF: os << "\\bar no\n"; break; + case ON: os << "\\bar under\n"; break; case TOGGLE: lyxerr << "LyXFont::lyxWriteFontChanges: " "TOGGLE should not appear here!" << endl; break; - case INHERIT: os << "\\bar default \n"; break; + case INHERIT: os << "\\bar default\n"; break; case IGNORE: lyxerr << "LyXFont::lyxWriteFontChanges: " "IGNORE should not appear here!" << endl; @@ -734,7 +734,7 @@ void LyXFont::lyxWriteChanges(LyXFont const & orgfont, } } if (orgfont.noun() != noun()) { - os << "\\noun " << LyXMiscNames[noun()] << " \n"; + os << "\\noun " << LyXMiscNames[noun()] << "\n"; } if (orgfont.color() != color()) { // To make us file compatible with older diff --git a/src/output_plaintext.C b/src/output_plaintext.C index 283b8e19ae..d29f5024ed 100644 --- a/src/output_plaintext.C +++ b/src/output_plaintext.C @@ -84,7 +84,7 @@ void asciiParagraph(Buffer const & buf, { int ltype = 0; Paragraph::depth_type ltype_depth = 0; - bool ref_printed = false; + static bool ref_printed = false; Paragraph::depth_type depth = par.params().depth(); // First write the layout diff --git a/src/text.C b/src/text.C index 7fe1ce68f5..23748129f5 100644 --- a/src/text.C +++ b/src/text.C @@ -1873,7 +1873,6 @@ bool LyXText::read(Buffer const & buf, LyXLex & lex) { static Change current_change; - bool the_end_read = false; Paragraph::depth_type depth = 0; while (lex.isOK()) { @@ -1884,17 +1883,10 @@ bool LyXText::read(Buffer const & buf, LyXLex & lex) continue; if (token == "\\end_inset") { - the_end_read = true; break; } if (token == "\\end_document") { -#ifdef WITH_WARNINGS -#warning Look here! -#endif -#if 0 - lex.printError("\\end_document read in inset! Error in document!"); -#endif return false; } @@ -1928,7 +1920,7 @@ bool LyXText::read(Buffer const & buf, LyXLex & lex) } } - return the_end_read; + return true; }