X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBufferParams.cpp;h=bf24b5937cb7c177fd25564897ea164963f2d1a4;hb=2098f1d8c20d51e63e670bcdc9da8996068975bf;hp=cfc893bbf6cf59854ca1afd10ca560c91590a8de;hpb=83b1c48846cabdf60a575a67e3b6a69911a1b14f;p=lyx.git diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index cfc893bbf6..bf24b5937c 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -375,6 +375,8 @@ BufferParams::BufferParams() } // default index indiceslist().addDefault(B_("Index")); + html_be_strict = true; + html_use_mathml = true; } @@ -534,6 +536,8 @@ string BufferParams::readToken(Lexer & lex, string const & token, readModules(lex); } else if (token == "\\begin_removed_modules") { readRemovedModules(lex); + } else if (token == "\\begin_includeonly") { + readIncludeonly(lex); } else if (token == "\\options") { lex.eatLine(); options = lex.getString(); @@ -768,6 +772,10 @@ string BufferParams::readToken(Lexer & lex, string const & token, toktmp << endl; return toktmp; } + } else if (token == "\\html_use_mathml") { + lex >> html_use_mathml; + } else if (token == "\\html_be_strict") { + lex >> html_be_strict; } else { lyxerr << "BufferParams::readToken(): Unknown token: " << token << endl; @@ -828,7 +836,17 @@ void BufferParams::writeFile(ostream & os) const os << *it << '\n'; os << "\\end_modules" << '\n'; } - + + // includeonly + if (!includedChildren_.empty()) { + os << "\\begin_includeonly" << '\n'; + list::const_iterator it = includedChildren_.begin(); + list::const_iterator en = includedChildren_.end(); + for (; it != en; it++) + os << *it << '\n'; + os << "\\end_includeonly" << '\n'; + } + // local layout information if (!local_layout.empty()) { // remove '\n' from the end @@ -967,8 +985,10 @@ void BufferParams::writeFile(ostream & os) const } } - os << "\\tracking_changes " << convert(trackChanges) << "\n"; - os << "\\output_changes " << convert(outputChanges) << "\n"; + os << "\\tracking_changes " << convert(trackChanges) << "\n" + << "\\output_changes " << convert(outputChanges) << "\n" + << "\\html_use_mathml " << convert(html_use_mathml) << "\n" + << "\\html_be_strict " << convert(html_be_strict) << "\n"; os << pimpl_->authorlist; } @@ -1072,7 +1092,7 @@ void BufferParams::validate(LaTeXFeatures & features) const bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, - TexRow & texrow) const + TexRow & texrow, FileName const & filepath) const { os << "\\documentclass"; @@ -1241,6 +1261,31 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, // handle inputenc etc. writeEncodingPreamble(os, features, texrow); + // includeonly + if (!includedChildren_.empty()) { + os << "\\includeonly{"; + list::const_iterator it = includedChildren_.begin(); + bool first = true; + for (; it != includedChildren_.end() ; ++it) { + string incfile = *it; + FileName inc = makeAbsPath(incfile, filepath.absFilename()); + string mangled = DocFileName(changeExtension(inc.absFilename(), ".tex")). + mangledFilename(); + if (!features.runparams().nice) + incfile = mangled; + // \includeonly doesn't want an extension + incfile = changeExtension(incfile, string()); + incfile = latex_path(incfile); + if (!incfile.empty()) { + if (!first) + os << ","; + os << from_utf8(incfile); + } + first = false; + } + os << "}\n"; + } + if (!listings_params.empty() || features.isRequired("listings")) { os << "\\usepackage{listings}\n"; texrow.newline(); @@ -1895,6 +1940,23 @@ void BufferParams::readRemovedModules(Lexer & lex) } +void BufferParams::readIncludeonly(Lexer & lex) +{ + if (!lex.eatLine()) { + lyxerr << "Error (BufferParams::readIncludeonly):" + "Unexpected end of input." << endl; + return; + } + while (true) { + string child = lex.getString(); + if (child == "\\end_includeonly") + break; + includedChildren_.push_back(child); + lex.eatLine(); + } +} + + string BufferParams::paperSizeName(PapersizePurpose purpose) const { char real_papersize = papersize;