mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
Allow LyX format to be written to View>Source window.
This commit is contained in:
parent
cfc43d772d
commit
b7ac2d69e7
@ -3317,7 +3317,13 @@ void Buffer::getSourceCode(odocstream & os, string const format,
|
|||||||
<< "\n\n";
|
<< "\n\n";
|
||||||
}
|
}
|
||||||
// output paragraphs
|
// output paragraphs
|
||||||
if (runparams.flavor == OutputParams::HTML) {
|
if (runparams.flavor == OutputParams::LYX) {
|
||||||
|
Paragraph const & par = text().paragraphs()[par_begin];
|
||||||
|
ostringstream ods;
|
||||||
|
depth_type dt = par.getDepth();
|
||||||
|
par.write(ods, params(), dt);
|
||||||
|
os << from_utf8(ods.str());
|
||||||
|
} else if (runparams.flavor == OutputParams::HTML) {
|
||||||
XHTMLStream xs(os);
|
XHTMLStream xs(os);
|
||||||
setMathFlavor(runparams);
|
setMathFlavor(runparams);
|
||||||
xhtmlParagraphs(text(), *this, xs, runparams);
|
xhtmlParagraphs(text(), *this, xs, runparams);
|
||||||
@ -3347,7 +3353,16 @@ void Buffer::getSourceCode(odocstream & os, string const format,
|
|||||||
else if (output == OnlyBody)
|
else if (output == OnlyBody)
|
||||||
os << _("Preview body");
|
os << _("Preview body");
|
||||||
os << "\n\n";
|
os << "\n\n";
|
||||||
if (runparams.flavor == OutputParams::HTML) {
|
if (runparams.flavor == OutputParams::LYX) {
|
||||||
|
ostringstream ods;
|
||||||
|
if (output == FullSource)
|
||||||
|
write(ods);
|
||||||
|
else if (output == OnlyPreamble)
|
||||||
|
params().writeFile(ods);
|
||||||
|
else if (output == OnlyBody)
|
||||||
|
text().write(ods);
|
||||||
|
os << from_utf8(ods.str());
|
||||||
|
} else if (runparams.flavor == OutputParams::HTML) {
|
||||||
writeLyXHTMLSource(os, runparams, output);
|
writeLyXHTMLSource(os, runparams, output);
|
||||||
} else if (runparams.flavor == OutputParams::TEXT) {
|
} else if (runparams.flavor == OutputParams::TEXT) {
|
||||||
if (output == OnlyPreamble) {
|
if (output == OnlyPreamble) {
|
||||||
|
@ -2180,6 +2180,8 @@ OutputParams::FLAVOR BufferParams::getOutputFlavor(string const format) const
|
|||||||
result = OutputParams::HTML;
|
result = OutputParams::HTML;
|
||||||
else if (dformat == "text")
|
else if (dformat == "text")
|
||||||
result = OutputParams::TEXT;
|
result = OutputParams::TEXT;
|
||||||
|
else if (dformat == "lyx")
|
||||||
|
result = OutputParams::LYX;
|
||||||
else {
|
else {
|
||||||
// Try to determine flavor of default output format
|
// Try to determine flavor of default output format
|
||||||
vector<string> backs = backends();
|
vector<string> backs = backends();
|
||||||
|
@ -35,7 +35,8 @@ public:
|
|||||||
XETEX,
|
XETEX,
|
||||||
XML,
|
XML,
|
||||||
HTML,
|
HTML,
|
||||||
TEXT
|
TEXT,
|
||||||
|
LYX
|
||||||
};
|
};
|
||||||
|
|
||||||
enum MathFlavor {
|
enum MathFlavor {
|
||||||
|
@ -209,9 +209,6 @@ void ViewSourceWidget::updateDefaultFormat()
|
|||||||
LYXERR0("Can't find format for backend " << format << "!");
|
LYXERR0("Can't find format for backend " << format << "!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (fmt->name() == "lyx")
|
|
||||||
// we can't presently display the LyX format itself
|
|
||||||
continue;
|
|
||||||
|
|
||||||
QString const pretty = qt_(fmt->prettyname());
|
QString const pretty = qt_(fmt->prettyname());
|
||||||
QString const qformat = toqstr(format);
|
QString const qformat = toqstr(format);
|
||||||
|
@ -752,6 +752,9 @@ void InsetExternal::validate(LaTeXFeatures & features) const
|
|||||||
case OutputParams::TEXT:
|
case OutputParams::TEXT:
|
||||||
format = "text";
|
format = "text";
|
||||||
break;
|
break;
|
||||||
|
case OutputParams::LYX:
|
||||||
|
format = "lyx";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
external::Template::Formats::const_iterator cit =
|
external::Template::Formats::const_iterator cit =
|
||||||
et.formats.find(format);
|
et.formats.find(format);
|
||||||
|
Loading…
Reference in New Issue
Block a user