checkProg('DocBook converter -> PDF (docbook)',
['pandoc -f docbook -t latex --pdf-engine=lualatex --toc -o $$o $$i', # Since Pandoc 2.0
'pandoc -f docbook -t latex --latex-engine=lualatex --toc -o $$o $$i'], # Up to Pandoc 1.19
- rc_entry = [ r'\converter docbook5 pdf9 "%%" ""' ])
+ rc_entry = [ r'\converter docbook5 pdf9 "%%" "needcopiesfrom=docbook5"' ])
#
xpath, xslt_sheet = checkProg('XSLT stylesheets for ePub', ['chunk.xsl'], '', ['/usr/share/xml/docbook/stylesheet/docbook-xsl-ns/epub3'])
if xslt_sheet == 'chunk.xsl':
xpath = 'none'
global java
if xsltproc != '':
- addToRC(r'\converter docbook5 epub "$${python} $$s/scripts/docbook2epub.py none none \"' + xsltproc + r'\" ' + xpath + ' $$i $$r $$o" ""')
+ addToRC(r'\converter docbook5 epub "$${python} $$s/scripts/docbook2epub.py none none \"' + xsltproc + r'\" ' + xpath + ' $$i $$r $$o" "needcopiesfrom=docbook5"')
elif java != '':
- addToRC(r'\converter docbook5 epub "$${python} $$s/scripts/docbook2epub.py \"' + java + r'\" none none ' + xpath + ' $$i $$r $$o" ""')
+ addToRC(r'\converter docbook5 epub "$${python} $$s/scripts/docbook2epub.py \"' + java + r'\" none none ' + xpath + ' $$i $$r $$o" "needcopiesfrom=docbook5"')
#
checkProg('a MS Word Office Open XML converter -> LaTeX', ['pandoc -s -f docx -o $$o -t latex $$i'],
rc_entry = [ r'\converter word2 latex "%%" ""' ])
\begin_inset Flex Code
status collapsed
+\begin_layout Plain Layout
+needcopiesfrom=<format>
+\end_layout
+
+\end_inset
+
+ Some formats (e.
+\begin_inset space \thinspace{}
+\end_inset
+
+g.,
+ DocBook) generate external files with specific names (for instance if math is rendered as graphic),
+ but they are only generated in the working directory if the respective format is the target format.
+ If you have such a format in your conversion chain and need those files in conversion,
+ use this flag with the respective
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+<format>
+\end_layout
+
+\end_inset
+
+ (cf.
+ the DocBook to ePub converter,
+ which uses
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+needcopiesfrom=docbook5
+\end_layout
+
+\end_inset
+
+).
+ The files will then be made available in the temporary directory as soon as the intermediate format has been generated.
+\end_layout
+
+\begin_layout Labeling
+\labelwidthstring 00.00.0000
+\begin_inset Flex Code
+status collapsed
+
\begin_layout Plain Layout
nice
\end_layout
\begin_inset Flex Code
status collapsed
+\begin_layout Plain Layout
+needcopiesfrom=<Format>
+\end_layout
+
+\end_inset
+
+ Manche Formate (bspw.
+ DocBook) erzeugen externe Dateien mit speziellen Namen (zum Beispiel,
+ wenn mathematische Formeln als Grafiken dargestellt werden),
+ allerdings geschieht dies nur,
+ wenn das Format den Endpunkt der Konversion darstellt,
+ die Dateien landen dann im Arbeitsverzeichnis.
+ Wenn Sie eines dieser Formate als Zwischenformat haben und diese Dateien im Konvertierungsprozess benötigen,
+ verwenden Sie diesen Flag mit dem entsprechenden
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+<Format>
+\end_layout
+
+\end_inset
+
+ (vgl.
+ den Konverter von DocBook nach ePub,
+ der
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+needcopiesfrom=docbook5
+\end_layout
+
+\end_inset
+
+ verwendet).
+ Die Dateien werden dann im temporären Verzeichnis zur Verfügung gestellt,
+ nachdem das Zwischenformat erzeugt wurde.
+\end_layout
+
+\begin_layout Labeling
+\labelwidthstring 00.00.0000
+\begin_inset Flex Code
+status collapsed
+
\begin_layout Plain Layout
nice
\end_layout
Converters::RetVal const retval =
converters.convert(this, FileName(filename), tmp_result_file,
FileName(absFileName()), backend_format, format,
- error_list, Converters::none, includeall);
+ error_list, Converters::none, includeall,
+ runparams.exportdata);
if (retval == Converters::KILLED)
return ExportCancel;
bool success = (retval == Converters::SUCCESS);
#include "TextClass.h"
#include "Encoding.h"
#include "ErrorList.h"
+#include "Exporter.h"
#include "Format.h"
#include "InsetList.h"
#include "Language.h"
need_auth_ = true;
else if (flag_name == "hyperref-driver")
href_driver_ = flag_value;
+ else if (flag_name == "needcopiesfrom")
+ need_renamed_copies_from_ = flag_value;
}
if (!result_dir_.empty() && result_file_.empty())
result_file_ = "index." + theFormats().extension(to_);
FileName const & from_file, FileName const & to_file,
FileName const & orig_from,
string const & from_format, string const & to_format,
- ErrorList & errorList, int conversionflags, bool includeall)
+ ErrorList & errorList, int conversionflags, bool includeall,
+ shared_ptr<ExportData> exportdata)
{
if (from_format == to_format)
return move(from_format, from_file, to_file, false) ?
FileName outfile = from_file;
for (auto const & edge : edgepath) {
Converter const & conv = converterlist_[edge];
+ // If the converter requires renamed file copies from an involved
+ // converter, handle this here. These copies stay in the tmp dir
+ if (exportdata && conv.need_renamed_copies_from() == conv.from()) {
+ vector<ExportedFile> const extfiles =
+ exportdata->externalFiles(conv.from());
+ CopyStatus status = FORCE;
+ for (ExportedFile const & exp : extfiles) {
+ string const fmt = theFormats().getFormatFromFile(exp.sourceName);
+ FileName expFileName = makeAbsPath(exp.exportName,
+ exp.sourceName.onlyPath().realPath());
+ status = copyFile(fmt, exp.sourceName,
+ expFileName,
+ exp.exportName, status == FORCE,
+ true);
+ }
+ }
bool dummy = conv.To()->dummy() && conv.to() != "program";
if (!dummy) {
LYXERR(Debug::FILES, "Converting from "
#include "Graph.h"
#include "support/trivstring.h"
+#include <memory>
#include <vector>
#include <set>
#include <string>
class Buffer;
class ErrorList;
+class ExportData;
class Format;
class Formats;
class OutputParams;
std::string const parselog() const { return parselog_; }
///
std::string const hyperref_driver() const { return href_driver_; }
+ ///
+ std::string const need_renamed_copies_from() const { return need_renamed_copies_from_; }
private:
///
trivstring parselog_;
/// The hyperref driver
trivstring href_driver_;
+ /// Needs renamed file copies from an intermediate format
+ trivstring need_renamed_copies_from_;
};
support::FileName const & from_file, support::FileName const & to_file,
support::FileName const & orig_from,
std::string const & from_format, std::string const & to_format,
- ErrorList & errorList, int conversionflags = none, bool includeall = false);
+ ErrorList & errorList, int conversionflags = none, bool includeall = false,
+ std::shared_ptr<ExportData> exportdata = nullptr);
///
void update(Formats const & formats);
///