Am Donnerstag, 2. Februar 2006 11:35 schrieb Juergen Spitzmueller: > Georg Baum wrote: > > I think the safest solution right now is simply to make a special case for > > the "lyx13" format. I'll send an updated patch this evening. > > I agree.
Here it is. It works for me, could you please test it, too? Georg
Index: lib/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ChangeLog,v retrieving revision 1.757 diff -u -p -r1.757 ChangeLog --- lib/ChangeLog 26 Jan 2006 11:25:36 -0000 1.757 +++ lib/ChangeLog 2 Feb 2006 19:56:40 -0000 @@ -1,3 +1,9 @@ +2006-02-02 Georg Baum <[EMAIL PROTECTED]> + + * configure.m4: add lyx13x format and converter + * configure.m4: remove viewer from lyx format to exclude it from the + View menu + 2006-01-26 Jürgen Spitzmüller <[EMAIL PROTECTED]> * chkconfig.ltx: add missing tests for bibtopic and jurabib; Index: lib/configure.m4 =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/configure.m4,v retrieving revision 1.108 diff -u -p -r1.108 configure.m4 --- lib/configure.m4 8 Sep 2005 09:20:12 -0000 1.108 +++ lib/configure.m4 2 Feb 2006 19:56:41 -0000 @@ -590,7 +590,8 @@ cat >$outfile <<EOF \\Format jpg jpg JPEG "" "$RASTERIMAGE_VIEWER" "$RASTERIMAGE_EDITOR" \\Format latex tex LaTeX L "" "$TEXT_EDITOR" \\Format linuxdoc sgml LinuxDoc x "" "$TEXT_EDITOR" -\\Format lyx lyx LyX "" "lyx" "lyx" +\\Format lyx lyx LyX "" "" "" +\\Format lyx13x lyx13 "LyX 1.3.x" "" "" "" \\Format lyxpreview lyxpreview "LyX Preview" "" "" "" \\Format literate nw NoWeb N "" "$TEXT_EDITOR" \\Format pbm pbm PBM "" "$RASTERIMAGE_VIEWER" "$RASTERIMAGE_EDITOR" @@ -636,6 +637,7 @@ cat >$outfile <<EOF \\converter linuxdoc lyx "$linuxdoc_to_lyx_command" "" \\converter literate latex "$literate_to_tex_command" "" \\converter literate lyx "$literate_to_lyx_command" "" +\\converter lyx lyx13x "python \$\$s/lyx2lyx/lyx2lyx -t 221 \$\$i > \$\$o" "" \\converter lyxpreview png "$lyxpreview_to_png_command" "" \\converter lyxpreview ppm "$lyxpreview_to_bitmap_command" "" \\converter ps fax "$fax_command" "" Index: src/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v retrieving revision 1.2366 diff -u -p -r1.2366 ChangeLog --- src/ChangeLog 30 Jan 2006 16:34:29 -0000 1.2366 +++ src/ChangeLog 2 Feb 2006 19:56:47 -0000 @@ -1,3 +1,10 @@ +2006-02-02 Georg Baum <[EMAIL PROTECTED]> + + * exporter.C (Backends): Add "lyx" backend + * exporter.C (Export): Handle "lyx" backend + * graph.C (getReachable): Don't exclude "lyx" + * MenuBackend.C (expandFormats): exclude "lyx" from export menu + 2006-01-30 Jürgen Spitzmüller <[EMAIL PROTECTED]> * * text2.C (deleteEmptyParagraphMechanism): fix off-by-one error of the start Index: src/exporter.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/exporter.C,v retrieving revision 1.63 diff -u -p -r1.63 exporter.C --- src/exporter.C 7 Dec 2005 15:21:10 -0000 1.63 +++ src/exporter.C 2 Feb 2006 19:56:47 -0000 @@ -61,6 +61,7 @@ vector<string> const Backends(Buffer con if (buffer.params().getLyXTextClass().isTeXClassAvailable()) v.push_back(BufferFormat(buffer)); v.push_back("text"); + v.push_back("lyx"); return v; } @@ -143,11 +144,19 @@ bool Exporter::Export(Buffer * buffer, s runparams.flavor = OutputParams::LATEX; runparams.linelen = lyxrc.ascii_linelen; vector<string> backends = Backends(*buffer); - if (find(backends.begin(), backends.end(), format) == backends.end()) { + // FIXME: Without this test export to lyx13 would be through + // latex -> lyx -> lyx13, 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" && !converters.getPath("lyx", format).empty()) + backend_format = "lyx"; + else if (find(backends.begin(), backends.end(), format) == backends.end()) { for (vector<string>::const_iterator it = backends.begin(); it != backends.end(); ++it) { - Graph::EdgePath p = - converters.getPath(*it, format); + Graph::EdgePath p = converters.getPath(*it, format); if (!p.empty()) { runparams.flavor = converters.getFlavor(p); backend_format = *it; @@ -171,6 +180,9 @@ bool Exporter::Export(Buffer * buffer, s // Ascii backend if (backend_format == "text") writeFileAscii(*buffer, filename, runparams); + // no backend + else if (backend_format == "lyx") + buffer->writeFile(filename); // Linuxdoc backend else if (buffer->isLinuxDoc()) { runparams.nice = !put_in_tempdir; Index: src/graph.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/graph.C,v retrieving revision 1.11 diff -u -p -r1.11 graph.C --- src/graph.C 6 Oct 2003 09:35:37 -0000 1.11 +++ src/graph.C 2 Feb 2006 19:56:47 -0000 @@ -77,8 +77,6 @@ Graph::getReachable(int from, bool only_ int const i = Q_.front(); Q_.pop(); Format const & format = formats.get(i); - if (format.name() == "lyx") - continue; if (!only_viewable || !format.viewer().empty() || format.isChildFormat()) result.push_back(i); Index: src/MenuBackend.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/MenuBackend.C,v retrieving revision 1.108 diff -u -p -r1.108 MenuBackend.C --- src/MenuBackend.C 25 Oct 2005 15:21:47 -0000 1.108 +++ src/MenuBackend.C 2 Feb 2006 19:56:47 -0000 @@ -517,6 +517,11 @@ void expandFormats(MenuItem::Kind kind, else if ((*fit)->name() == "textparagraph") label = _("Plain Text as Paragraphs"); label += "..."; + } else if (kind == MenuItem::ExportFormats) { + // exporting to LyX does not make sense + // FIXME: Introduce noexport flag + if ((*fit)->name() == "lyx") + continue; } if (!(*fit)->shortcut().empty()) label += '|' + (*fit)->shortcut();