* src/exporter.C

(Exporter::Export): Remove hardcoded check for lyx backend.
	Use the shortest converter path instead, that is more flexible and
	always correct.

	* lib/configure.py: Add new formats and converters for importing and
	exporting files from CJK LyX.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17202 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2007-02-15 20:14:12 +00:00
parent 1baa28f2bc
commit 3ccb9d8af9
2 changed files with 18 additions and 16 deletions

View File

@ -301,6 +301,9 @@ def checkFormatEntries(dtl_tools):
\Format lyx lyx LyX "" "" "" ""
\Format lyx13x lyx13 "LyX 1.3.x" "" "" "" "document"
\Format lyx14x lyx14 "LyX 1.4.x" "" "" "" "document"
\Format clyx cjklyx "CJK LyX 1.4.x (big5)" "" "" "" "document"
\Format jlyx cjklyx "CJK LyX 1.4.x (euc-jp)" "" "" "" "document"
\Format klyx cjklyx "CJK LyX 1.4.x (euc-kr)" "" "" "" "document"
\Format lyxpreview lyxpreview "LyX Preview" "" "" "" ""
\Format pdftex pdftex_t PDFTEX "" "" "" ""
\Format program "" Program "" "" "" ""
@ -449,7 +452,7 @@ def checkConverterEntries():
# FIXME: no rc_entry? comment it out
# checkProg('Image converter', ['convert $$i $$o'])
#
# Entried that do not need checkProg
# Entries that do not need checkProg
addToRC(r'''\converter lyxpreview ppm "python -tt $$s/scripts/lyxpreview2bitmap.py" ""
\converter date dateout "python -tt $$s/scripts/date.py %d-%m-%Y > $$o" ""
\converter docbook docbook-xml "cp $$i $$o" "xml"
@ -458,6 +461,12 @@ def checkConverterEntries():
\converter fig pstex "python -tt $$s/scripts/fig2pstex.py $$i $$o" ""
\converter lyx lyx13x "python -tt $$s/lyx2lyx/lyx2lyx -t 221 $$i > $$o" ""
\converter lyx lyx14x "python -tt $$s/lyx2lyx/lyx2lyx -t 245 $$i > $$o" ""
\converter lyx clyx "python -tt $$s/lyx2lyx/lyx2lyx -c big5 -t 245 $$i > $$o" ""
\converter lyx jlyx "python -tt $$s/lyx2lyx/lyx2lyx -c euc_jp -t 245 $$i > $$o" ""
\converter lyx klyx "python -tt $$s/lyx2lyx/lyx2lyx -c euc_kr -t 245 $$i > $$o" ""
\converter clyx lyx "python -tt $$s/lyx2lyx/lyx2lyx -c big5 $$i > $$o" ""
\converter jlyx lyx "python -tt $$s/lyx2lyx/lyx2lyx -c euc_jp $$i > $$o" ""
\converter klyx lyx "python -tt $$s/lyx2lyx/lyx2lyx -c euc_kr $$i > $$o" ""
''')

View File

@ -153,27 +153,20 @@ bool Exporter::Export(Buffer * buffer, string const & format,
runparams.flavor = OutputParams::LATEX;
runparams.linelen = lyxrc.plaintext_linelen;
vector<string> backends = Backends(*buffer);
// FIXME: Without this test export to lyx1[34] would be through
// latex -> lyx -> lyx1[34], because the first backend below with a
// working conversion path is used. We should replace this test and
// the explicit loop below with a method
// getShortestPath(vector<string> const & from, string const & to)
// which returns the shortest path from one of the formats in 'from'
// to 'to'.
if ((format == "lyx13x" || format == "lyx14x") &&
!theConverters().getPath("lyx", format).empty())
backend_format = "lyx";
else if (find(backends.begin(), backends.end(), format) == backends.end()) {
if (find(backends.begin(), backends.end(), format) == backends.end()) {
// Get shortest path to format
Graph::EdgePath path;
for (vector<string>::const_iterator it = backends.begin();
it != backends.end(); ++it) {
Graph::EdgePath p = theConverters().getPath(*it, format);
if (!p.empty()) {
runparams.flavor = theConverters().getFlavor(p);
if (!p.empty() && (path.empty() || p.size() < path.size())) {
backend_format = *it;
break;
path = p;
}
}
if (backend_format.empty()) {
if (!path.empty())
runparams.flavor = theConverters().getFlavor(path);
else {
Alert::error(_("Couldn't export file"),
bformat(_("No information for exporting the format %1$s."),
formats.prettyName(format)));