mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
buffer-export without argument exports the default format
buffer-export is proposed as a default binding in the preferences so now it does what a user expects when binding it to a key.
This commit is contained in:
parent
443eb7bf79
commit
a1faa41c83
@ -2533,7 +2533,8 @@ bool Buffer::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
||||
enable = true;
|
||||
break;
|
||||
}
|
||||
string format = to_utf8(arg);
|
||||
string format =
|
||||
arg.empty() ? params().getDefaultOutputFormat() : to_utf8(arg);
|
||||
size_t pos = format.find(' ');
|
||||
if (pos != string::npos)
|
||||
format = format.substr(0, pos);
|
||||
@ -2641,11 +2642,13 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
|
||||
break;
|
||||
|
||||
case LFUN_BUFFER_EXPORT: {
|
||||
ExportStatus const status = doExport(argument, false);
|
||||
string const format =
|
||||
argument.empty() ? params().getDefaultOutputFormat() : argument;
|
||||
ExportStatus const status = doExport(format, false);
|
||||
dr.setError(status != ExportSuccess);
|
||||
if (status != ExportSuccess)
|
||||
dr.setMessage(bformat(_("Error exporting to format: %1$s."),
|
||||
func.argument()));
|
||||
from_utf8(format)));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -574,7 +574,7 @@ void LyXAction::init()
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_BUFFER_EXPORT
|
||||
* \li Action: Exports the current buffer (document) to the given format.
|
||||
* \li Syntax: buffer-export <FORMAT> [<DEST>]
|
||||
* \li Syntax: buffer-export [<FORMAT>] [<DEST>]
|
||||
* \li Params: <FORMAT> is either "custom" or one of the formats which you
|
||||
can find in Tools->Preferences->File formats->Format.
|
||||
Usual format you will enter is "pdf2" (pdflatex),
|
||||
@ -582,7 +582,9 @@ void LyXAction::init()
|
||||
In case of "custom" you will be asked for a format you
|
||||
want to start from and for the command that you want to
|
||||
apply to this format. Internally the control is then passed
|
||||
to #LFUN_BUFFER_EXPORT_CUSTOM.
|
||||
to #LFUN_BUFFER_EXPORT_CUSTOM.\n
|
||||
If absent, the default output format of the document is
|
||||
used.
|
||||
<DEST> If present, this argument provides the export destination
|
||||
filename. Its containing folder will also be the destination
|
||||
folder, where all the needed external files will be copied.
|
||||
|
@ -3548,14 +3548,17 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
||||
else
|
||||
target_dir = doc_buffer->fileName().onlyPath();
|
||||
|
||||
string const format = argument.empty() ?
|
||||
doc_buffer->params().getDefaultOutputFormat() : argument;
|
||||
|
||||
if ((dest.empty() && doc_buffer->isUnnamed())
|
||||
|| !target_dir.isDirWritable()) {
|
||||
exportBufferAs(*doc_buffer, cmd.argument());
|
||||
exportBufferAs(*doc_buffer, from_utf8(format));
|
||||
break;
|
||||
}
|
||||
/* TODO/Review: Is it a problem to also export the children?
|
||||
See the update_unincluded flag */
|
||||
d.asyncBufferProcessing(argument,
|
||||
d.asyncBufferProcessing(format,
|
||||
doc_buffer,
|
||||
_("Exporting ..."),
|
||||
&GuiViewPrivate::exportAndDestroy,
|
||||
|
Loading…
Reference in New Issue
Block a user