// needed to insert the selection
void Buffer::insertStringAsLines(Paragraph *& par, Paragraph::size_type & pos,
- LyXFont const & font,
- string const & str) const
+ LyXFont const & fn,string const & str) const
{
LyXLayout const & layout = textclasslist.Style(params.textclass,
- par->getLayout());
+ par->getLayout());
+ LyXFont font = fn;
+
+ (void)par->checkInsertChar(font);
// insert the string, don't insert doublespace
bool space_inserted = true;
for(string::const_iterator cit = str.begin();
if (*cit == '\n') {
if (par->size() || layout.keepempty) {
par->breakParagraph(params, pos,
- layout.isEnvironment());
+ layout.isEnvironment());
par = par->next();
pos = 0;
space_inserted = true;
continue;
}
// do not insert consecutive spaces if !free_spacing
- } else if ((*cit == ' ' || *cit == '\t')
- && space_inserted && !layout.free_spacing) {
+ } else if ((*cit == ' ' || *cit == '\t') &&
+ space_inserted && !layout.free_spacing)
+ {
continue;
} else if (*cit == '\t') {
if (!layout.free_spacing) {
texrow.newline();
}
- // We try to load babel late, in case it interferes
- // with other packages.
- if (use_babel) {
- string tmp = lyxrc.language_package;
- if (!lyxrc.language_global_options
- && tmp == "\\usepackage{babel}")
- tmp = string("\\usepackage[") +
- language_options.str().c_str() +
- "]{babel}";
- ofs << tmp << "\n";
- texrow.newline();
- }
-
if (params.secnumdepth != tclass.secnumdepth()) {
ofs << "\\setcounter{secnumdepth}{"
<< params.secnumdepth
ofs << preamble;
+ // We try to load babel late, in case it interferes
+ // with other packages.
+ if (use_babel) {
+ string tmp = lyxrc.language_package;
+ if (!lyxrc.language_global_options
+ && tmp == "\\usepackage{babel}")
+ tmp = string("\\usepackage[") +
+ language_options.str().c_str() +
+ "]{babel}";
+ ofs << tmp << "\n";
+ texrow.newline();
+ }
+
// make the body.
ofs << "\\begin{document}\n";
texrow.newline();
string top_element = textclasslist.LatexnameOfClass(params.textclass);
if (!body_only) {
- string sgml_includedfiles=features.getIncludedFiles(fname);
+ ofs << "<!doctype linuxdoc system";
- if (params.preamble.empty() && sgml_includedfiles.empty()) {
- ofs << "<!doctype linuxdoc system>\n\n";
- } else {
- ofs << "<!doctype linuxdoc system [ "
- << params.preamble << sgml_includedfiles << " \n]>\n\n";
+ string preamble = params.preamble;
+ preamble += features.getIncludedFiles(fname);
+ preamble += features.getLyXSGMLEntities();
+
+ if (!preamble.empty()) {
+ ofs << " [ " << preamble << " ]";
}
+ ofs << ">\n\n";
if (params.options.empty())
sgmlOpenTag(ofs, 0, top_element);
}
-void Buffer::docbookHandleCaption(ostream & os, string & inner_tag,
- Paragraph::depth_type depth, int desc_on,
- Paragraph * & par)
-{
- Paragraph * tpar = par;
- while (tpar
- && (tpar->layout != textclasslist.NumberOfLayout(params.textclass,
- "Caption").second))
- tpar = tpar->next();
-
- if (tpar &&
- tpar->layout == textclasslist.NumberOfLayout(params.textclass,
- "Caption").second) {
- sgmlOpenTag(os, depth + 1, inner_tag);
- string extra_par;
- simpleDocBookOnePar(os, extra_par, tpar,
- desc_on, depth + 2);
- sgmlCloseTag(os, depth+1, inner_tag);
- if (!extra_par.empty())
- os << extra_par;
- }
-}
-
-
// checks, if newcol chars should be put into this line
// writes newline, if necessary.
namespace {
} // namespace anon
-
-
// Handle internal paragraph parsing -- layout already processed.
void Buffer::simpleLinuxDocOnePar(ostream & os,
Paragraph * par,
string top_element = textclasslist.LatexnameOfClass(params.textclass);
if (!only_body) {
- string sgml_includedfiles = features.getIncludedFiles(fname);
+ ofs << "<!DOCTYPE " << top_element
+ << " PUBLIC \"-//OASIS//DTD DocBook V4.1//EN\"";
- ofs << "<!doctype " << top_element
- << " public \"-//OASIS//DTD DocBook V3.1//EN\"";
+ string preamble = params.preamble;
+ preamble += features.getIncludedFiles(fname);
+ preamble += features.getLyXSGMLEntities();
- if (params.preamble.empty() && sgml_includedfiles.empty())
- ofs << ">\n\n";
- else
- ofs << "\n [ " << params.preamble
- << sgml_includedfiles << " \n]>\n\n";
+ if (!preamble.empty()) {
+ ofs << "\n [ " << preamble << " ]";
+ }
+ ofs << ">\n\n";
}
string top = top_element;
}
} else {
string sgml_string;
- if (par->linuxDocConvertChar(c, sgml_string)
- && !style.free_spacing) { // in freespacing
- // mode, spaces are
- // non-breaking characters
- // char is ' '
- if (desc_on == 1) {
- ++char_line_count;
- os << "\n</term><listitem><para>";
- desc_on = 2;
- } else {
- os << c;
- }
+ par->linuxDocConvertChar(c, sgml_string);
+
+ if (style.pass_thru) {
+ os << c;
+ } else if(style.free_spacing || c != ' ') {
+ os << sgml_string;
+ } else if (desc_on ==1) {
+ ++char_line_count;
+ os << "\n</term><listitem><para>";
+ desc_on = 2;
} else {
- os << sgml_string;
+ os << ' ';
}
}
font_old = font;