]> git.lyx.org Git - lyx.git/commitdiff
up to file format 236 and also fix Bug 421.
authorJosé Matox <jamatos@lyx.org>
Sat, 14 Aug 2004 18:41:27 +0000 (18:41 +0000)
committerJosé Matox <jamatos@lyx.org>
Sat, 14 Aug 2004 18:41:27 +0000 (18:41 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8927 a592a061-630c-0410-9148-cb99ea01b6c8

15 files changed:
lib/lyx2lyx/ChangeLog
lib/lyx2lyx/lyx_1_4.py
lib/lyx2lyx/parser_tools.py
src/ChangeLog
src/buffer.C
src/buffer.h
src/bufferparams.C
src/insets/ChangeLog
src/insets/insetbibitem.C
src/insets/insetbibitem.h
src/insets/insetcite.C
src/insets/insetcite.h
src/lyxfont.C
src/output_plaintext.C
src/text.C

index a00bd9d6f858f0007edaeede37705d82d9c9ef14..e9eb8fe13a50a8c8048020bcd200a3bd82302036 100644 (file)
@@ -1,3 +1,7 @@
+2004-08-14  José Matos  <jamatos@lyx.org>
+       * lyx_1_4.py:
+       * parser_tools.py: up the format to 236.
+
 2004-08-05  José Matos  <jamatos@lyx.org>
 
        * lyx_1.4.py (remove_color_default): move
index 82997ca1d50c25f10d16b3ef2c11c2c2bee0f1c8..c02f4e61949be484b2ed955d95965977a9acb3ba 100644 (file)
@@ -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
index ff936821139c64594f67acb3f43e9d97476247fd..90dc4e4a9eb883c0f5f64b84d5f99d9da1eeeeda 100644 (file)
@@ -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):
index 2e1e3bd18cdfaefcac7d52c2e4ffb5ef395b9d2d..e0b6e3d4916852e8300ba9c0e0deadd653bcd621 100644 (file)
@@ -1,3 +1,20 @@
+2004-08-14  José Matos  <jamatos@lyx.org>
+
+       * 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  <lasgouttes@lyx.org>
 
        * MenuBackend.C (Menu::operator[]): new method to access
index d669651885adb0703169b5951d6ef5d72fdec3ab..136065377866753173e44d1c47af27c7d3e4fee9 100644 (file)
@@ -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();
index 5ddca293989e1d974b8d16373041bbe1483c0f9d..20dd748ef0de91d9f57c17cd7f68fd775b3b927b 100644 (file)
@@ -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,
index 448edc75dc9ea4ae960fb3a706d767532134e414..d593f230d5adc77004f25d5f378fe6af8467a25c 100644 (file)
@@ -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<bool, lyx::textclass_type> 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<PARSEP>(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<AMS>(
                        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";
                        }
                }
        }
index 853bd8e7a4fc3c10ddc2ba90df6e027b9f3ff3f7..c5179afb1f01dd1ca115019966406f7efd8b27be 100644 (file)
@@ -1,3 +1,9 @@
+2004-08-14  José Matos  <jamatos@lyx.org>
+
+       * insetbibitem.[Ch] (plaintext): added.
+
+       * insetcite.[Ch]: fix plaintext export.
+
 2004-08-14  Lars Gullik Bjonnes  <larsbj@lyx.org>
 
        * insettext.[Ch] (setDrawFrame): take a bool, get rid of the
index 8d148ac66ff41d025212076a61a7bee7c56ce85b..2e74ad680349874207d70066b11cfc98ce041f06 100644 (file)
@@ -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 &)
index 05983fb25c691aa91d98fd3725e5b54374b59d79..b05d22fe4ac1aefbc4038683c28dbd0094b34f5e 100644 (file)
@@ -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);
index ef4e21acf2363b6a8066eb1ac469ef257599d599..91ab2928dc2dd0f8f4f511a083fbe53f166c4f7e 100644 (file)
@@ -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))
index 8a5091f33f0353bf53a0b3b7387f9f3504f86154..6d425985c45c83cb37f94fecf25b6b06fff540e8 100644 (file)
@@ -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;
index cc05bac8f05f943db72db600b5688759570d8ad7..2ffce829c8ea4c1039ad2fec9badbef58beb7f56 100644 (file)
@@ -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
index 283b8e19aecb6d37e69a19a2596ed62a47aff42e..d29f5024ed2607a611d197ca18aaa9f57a0a9292 100644 (file)
@@ -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
index 7fe1ce68f54f3d40a052da5a759314bbb71ac63c..23748129f595fd8a88f1e20a5a4b8910f9c586f5 100644 (file)
@@ -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;
 }