}
+void Preamble::suppressDate(bool suppress)
+{
+ if (suppress)
+ h_suppress_date = "true";
+ else
+ h_suppress_date = "false";
+}
+
+
void Preamble::add_package(string const & name, vector<string> & options)
{
// every package inherits the global options
}
-void Preamble::end_preamble(ostream & os, TeX2LyXDocClass const & /*tc*/)
+void Preamble::writeLyXHeader(ostream & os)
{
// translate from babel to LyX names
h_language = babel2lyx(h_language);
}
-void Preamble::parse(Parser & p, ostream & os,
- string const & forceclass, TeX2LyXDocClass & tc)
+void Preamble::parse(Parser & p, string const & forceclass,
+ TeX2LyXDocClass & tc)
{
// initialize fixed types
special_columns['D'] = 3;
ss << tc.sides();
h_papersides = ss.str();
}
- end_preamble(os, tc);
}
///
std::string addModules(std::string const & lyxpreamble,
std::string const & modules);
-
///
- void parse(Parser & p, std::ostream & os,
- std::string const & forceclass, TeX2LyXDocClass & tc);
+ void suppressDate(bool suppress);
+
+
+ /// Parses the LaTeX preamble into internal data
+ void parse(Parser & p, std::string const & forceclass,
+ TeX2LyXDocClass & tc);
+ /// Writes the LyX file header from internal data
+ void writeLyXHeader(std::ostream & os);
private:
///
std::string const & opts, bool in_lyx_preamble);
///
void handle_if(Parser & p, bool in_lyx_preamble);
- ///
- void end_preamble(std::ostream & os, TeX2LyXDocClass const & tc);
};
367 relative lengths for h and v space InsetSpace, InsetVSpace
368 glue lengths InsetSpace
369 author id \author
-370 \date{} \suppress_date
- (partly supported, see bug #7844)
371 automatic mhchem loading \use_mhchem
375 \includeonly \{begin,end}_includeonly
376 update .aux of unincluded children \maintain_unincluded_children
p.setEncoding(encoding);
//p.dump();
- ostringstream ps;
- preamble.parse(p, ps, documentclass, textclass);
+ preamble.parse(p, documentclass, textclass);
active_environments.push_back("document");
Context context(true, textclass);
ms << *it << '\n';
ms << "\\end_modules\n";
}
+ ostringstream ps;
+ preamble.writeLyXHeader(ps);
os << preamble.addModules(ps.str(), ms.str());
ss.seekg(0);
eat_whitespace(p, os, context, true);
}
+ // Must catch empty dates before findLayout is called below
+ else if (t.cs() == "date") {
+ string const date = p.verbatim_item();
+ if (date.empty())
+ preamble.suppressDate(true);
+ else {
+ preamble.suppressDate(false);
+ if (context.new_layout_allowed &&
+ (newlayout = findLayout(context.textclass,
+ t.cs(), true))) {
+ // write the layout
+ output_command_layout(os, p, outer,
+ context, newlayout);
+ p.skip_spaces();
+ } else
+ handle_ert(os, "\\date{" + date + '}',
+ context);
+ }
+ }
+
// Starred section headings
// Must attempt to parse "Section*" before "Section".
else if ((p.next_token().asInput() == "*") &&