]> git.lyx.org Git - features.git/commitdiff
Added html export for LinuxDoc and DocBook. LinuxDoc import now available in file...
authorJosé Matox <jamatos@lyx.org>
Mon, 20 Mar 2000 18:55:57 +0000 (18:55 +0000)
committerJosé Matox <jamatos@lyx.org>
Mon, 20 Mar 2000 18:55:57 +0000 (18:55 +0000)
The LinuxDoc and DocBook export now are controled by lyxrc flags.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@623 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
lib/lyxrc.example
src/lyx_cb.C
src/lyxfunc.C
src/lyxfunc.h
src/lyxrc.C
src/lyxrc.h
src/menus.C

index c429e6ef49443b7bf29d15cf90ca216f1d299fa1..ea8938d58b909c512d8498c545084bdf1415c04b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2000-03-20 José Abílio Matos <jamatos@lyx.org>
+
+       * src/lyxrc.[Ch] Removed \sgml_extra_options, added 6 other flags
+       for linuxdoc and docbook import and export format options.
+
+       * lib/lyxrc.example Example of default values for the previous flags.
+
+       * src/lyx_cb.C Use those flags instead of the hardwired values for
+       linuxdoc and docbook export.
+
+       * src/lyxfunc.[Ch] Added HTML export for linuxdoc and docbook, added
+       linuxdoc import.
+
+       * src/menus.C Added menus entries for the new import/exports formats.
+       
 2000-03-09 André Pönitz <poenitz@mathematik.tu-chemnitz.de>
 
        * src/lyxrc.*: Added support for running without Gui 
index 6bd1f5d26544de410bb3e466d450942c8e7de084..ab064ef6724ac1ad75253e517382ecab1ed4dade 100644 (file)
 # Example: use this to let math be italic with tth.
 #\html_command "tth -t -i < '$$FName' > '$$OutName'"
 
-# If you want to pass extra flags to the LinuxDoc sgml scripts, insert them
-# here. 
-# Example: the next line activates iso-latin1 support:
-#\sgml_extra_options -l
-
 # Keyboard Mapping. Use this to set the correct mapping file for your
 # keyboard, that is if you need one. You'll need one if you for instance
 # want to type German documents on an American keyboard. In that case,
 #\font_encoding default
 
 
+#
+# LINUXDOC SECTION #######################################################
+#
+
+# If you want to pass extra flags to the LinuxDoc sgml scripts, insert them
+# here. 
+# Example: the next line activates iso-latin1 support:
+#\linuxdoc_to_latex_command "sgml2latex -c latin"
+
+# Here you have the command to convert from linuxdoc to html.
+# Example: one html file only.
+#\linuxdoc_to_html_command "sgml2html -s 0"
+
+# The LinuxDoc to LyX converter
+#\linuxdoc_to_lyx_command "sgml2lyx"
+
+#
+# DOCBOOK SECTION ########################################################
+#
+
+# Command to convert a docbook file to dvi
+#\docbook_to_dvi_command "sgmltools -b dvi"
+
+# Command to convert a docbook file to html
+#\docbook_to_html_command "sgmltools -b html"
+
+# Command to convert a docbook file to pdf
+#\docbook_to_pdf_command ""
+
+
 #
 # FILE SECTION  ##########################################################
 #
index a52d5fbd7ebe2981e49a85175f1282decc36415a..639402f555246573ffb0f09fc8c7f0fb54a018fa 100644 (file)
@@ -11,6 +11,7 @@
 #include <config.h>
 
 #include <fstream>
+#include <algorithm>
 
 using std::ifstream;
 using std::copy;
@@ -947,6 +948,57 @@ void MenuMakeHTML(Buffer * buffer)
 
 }
 
+void MenuMakeHTML_LinuxDoc(Buffer * buffer)
+{
+       // First, create LinuxDoc file
+       MenuMakeLinuxDoc(buffer);
+
+       // And now, run the converter
+       string file = buffer->fileName();
+
+       string result = ChangeExtension(file, ".html", false);
+       string infile = ChangeExtension(file, ".sgml", false);
+       string tmp = lyxrc.linuxdoc_to_html_command;
+       tmp = subst(tmp, "$$FName", infile);
+       tmp = subst(tmp, "$$OutName", result);
+       Systemcalls one;
+       int res = one.startscript(Systemcalls::System, tmp);
+       if (res == 0) {
+               ShowMessage(buffer,_("Document exported as HTML to file `")
+                                                 + MakeDisplayPath(result) +'\'');
+       } else {
+               ShowMessage(buffer,_("Unable to convert to HTML the file `")
+                                                 + MakeDisplayPath(infile) 
+                                                 + '\'');
+       }
+
+}
+
+void MenuMakeHTML_DocBook(Buffer * buffer)
+{
+       // First, create LaTeX file
+       MenuMakeDocBook(buffer);
+
+       // And now, run the converter
+       string file = buffer->fileName();
+       string result = ChangeExtension(file, ".html", false);
+       string infile = ChangeExtension(file, ".sgml", false);
+       string tmp = lyxrc.docbook_to_html_command;
+       tmp = subst(tmp, "$$FName", infile);
+       tmp = subst(tmp, "$$OutName", result);
+       Systemcalls one;
+       int res = one.startscript(Systemcalls::System, tmp);
+       if (res == 0) {
+               ShowMessage(buffer,_("Document exported as HTML to file `")
+                                                 + MakeDisplayPath(result) +'\'');
+       } else {
+               ShowMessage(buffer,_("Unable to convert to HTML the file `")
+                                                 + MakeDisplayPath(infile) 
+                                                 + '\'');
+       }
+
+}
+
 void MenuExport(Buffer * buffer, string const & extyp) 
 {
        // latex
@@ -996,6 +1048,14 @@ void MenuExport(Buffer * buffer, string const & extyp)
        else if (extyp == "html") {
                MenuMakeHTML(buffer);
        }
+       // HTML from linuxdoc
+       else if (extyp == "html-linuxdoc") {
+               MenuMakeHTML_LinuxDoc(buffer);
+       }
+       // HTML from docbook
+       else if (extyp == "html-docbook") {
+               MenuMakeHTML_DocBook(buffer);
+       }
        else {
                ShowMessage(buffer, _("Unknown export type: ") + extyp);
        }
@@ -1327,15 +1387,13 @@ int RunLinuxDoc(BufferView * bv, int flag, string const & filename)
        switch (flag) {
        case 0: /* TeX output asked */
              bv->owner()->getMiniBuffer()->Set(_("Converting LinuxDoc SGML to TeX file..."));
-               s2 = "sgml2latex " + add_flags + " -o tex "
-                       + lyxrc.sgml_extra_options + ' ' + name;
+               s2 = lyxrc.linuxdoc_to_latex_command + ' ' + add_flags + " -o tex " + ' ' + name;
                if (one.startscript(Systemcalls::System, s2)) 
                        errorcode = 1;
                break;
        case 1: /* dvi output asked */
                bv->owner()->getMiniBuffer()->Set(_("Converting LinuxDoc SGML to dvi file..."));
-               s2 = "sgml2latex " + add_flags + " -o dvi "
-                       + lyxrc.sgml_extra_options + ' ' + name;
+               s2 = lyxrc.linuxdoc_to_latex_command + ' ' + add_flags + " -o dvi " + ' ' + name;
                if (one.startscript(Systemcalls::System, s2)) {
                        errorcode = 1;
                } else
@@ -1372,6 +1430,7 @@ int RunDocBook(int flag, string const & filename)
        current_view->buffer()->makeDocBookFile(name, 0);
 
        // Shall this code go or should it stay? (Lgb)
+       // This code is a placeholder for future implementation. (Jose')
 //     string add_flags;
 //     LYX_PAPER_SIZE ps = (LYX_PAPER_SIZE) current_view->buffer()->params.papersize;
 //     switch (ps) {
@@ -1387,7 +1446,7 @@ int RunDocBook(int flag, string const & filename)
        case 1: /* dvi output asked */
        {
                current_view->owner()->getMiniBuffer()->Set(_("Converting DocBook SGML to dvi file..."));
-               string s2 = "sgmltools --backend dvi " + name;
+               string s2 = lyxrc.docbook_to_dvi_command + ' ' + name;
                if (one.startscript(Systemcalls::System, s2)) {
                        errorcode = 1;
                } else
index 9671c56fccdf28e78b70246601672e094b86d414..ddd80299e411b62e6ce3cb83e4ff3c605d07640f 100644 (file)
@@ -356,12 +356,18 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
        case LFUN_IMPORT:
                if (argument == "latex")
                        disable = lyxrc.relyx_command == "none";
+               if (argument == "linuxdoc")
+                       disable = lyxrc.linuxdoc_to_lyx_command == "none";
                break;
        case LFUN_EXPORT:
                if (argument == "dvi" || argument == "postscript")
                        disable = noLaTeX;
                if (argument == "html")
                        disable = lyxrc.html_command == "none";
+               if (argument == "html-linuxdoc")
+                       disable = lyxrc.linuxdoc_to_html_command == "none";
+               if (argument == "html-docbook")
+                       disable = lyxrc.docbook_to_html_command == "none";
                break;
        case LFUN_UNDO:
                disable = buf->undostack.empty();
@@ -769,6 +775,8 @@ string LyXFunc::Dispatch(int ac,
                        // noweb
                } else if (imtyp == "noweb") {
                        doImportLaTeX(true);
+               } else if (imtyp == "linuxdoc") {
+                       doImportLinuxDoc();
                } else {
                        setErrorMessage(string(N_("Unknown import type: "))
                                        + imtyp);
@@ -2922,6 +2930,95 @@ void LyXFunc::doImportLaTeX(bool isnoweb)
 }
 
 
+void LyXFunc::doImportLinuxDoc()
+{
+       string initpath = lyxrc.document_path;
+       LyXFileDlg fileDlg;
+  
+       if (owner->view()->available()) {
+               string trypath = owner->buffer()->filepath;
+               // If directory is writeable, use this as default.
+               if (IsDirWriteable(trypath) == 1)
+                       initpath = trypath;
+       }
+
+       // launches dialog
+       ProhibitInput();
+       fileDlg.SetButton(0, _("Documents"), lyxrc.document_path);
+       fileDlg.SetButton(1, _("Examples"), 
+                         AddPath(system_lyxdir, "examples"));
+
+       string filename = fileDlg.Select(_("Select LinuxDoc file to Import"),
+                                         initpath, "*.sgml");
+       
+       AllowInput();
+       // check selected filename
+       if (filename.empty()) {
+               owner->getMiniBuffer()->Set(_("Canceled."));
+               return;
+       }
+
+       // get absolute path of file
+       filename = MakeAbsPath(filename);
+
+       // Check if the document already is open
+       string LyXfilename = ChangeExtension(filename, ".lyx", false);
+       if (bufferlist.exists(LyXfilename)){
+               switch(AskConfirmation(_("Document is already open:"), 
+                                      MakeDisplayPath(LyXfilename, 50),
+                                      _("Do you want to close that document now?\n"
+                                        "('No' will just switch to the open version)")))
+                       {
+                       case 1: // Yes: close the document
+                               if (!bufferlist.close(bufferlist.getBuffer(LyXfilename)))
+                               // If close is canceled, we cancel here too.
+                                       return;
+                               break;
+                       case 2: // No: switch to the open document
+                               owner->view()->buffer(
+                                       bufferlist.getBuffer(LyXfilename));
+                               return;
+                       case 3: // Cancel: Do nothing
+                               owner->getMiniBuffer()->Set(_("Canceled."));
+                               return;
+                       }
+       }
+
+       // Check if a LyX document by the same root exists in filesystem
+       FileInfo f(LyXfilename, true);
+       if (f.exist() && !AskQuestion(_("A document by the name"), 
+                                     MakeDisplayPath(LyXfilename),
+                                     _("already exists. Overwrite?"))) {
+               owner->getMiniBuffer()->Set(_("Canceled."));
+               return;
+       }
+
+       // loads document
+       owner->getMiniBuffer()->Set(_("Importing LinuxDoc file"),
+                                   MakeDisplayPath(filename), "...");
+
+       // run sgml2lyx
+       string tmp = lyxrc.linuxdoc_to_lyx_command + filename;
+        Systemcalls one;
+       Buffer * buf = 0;
+
+       int result = one.startscript(Systemcalls::System, tmp);
+       if (result == 0) {
+               string filename = ChangeExtension(filename, ".lyx", false);
+               // File was generated without problems. Load it.
+               buf = bufferlist.loadLyXFile(filename);
+               owner->view()->buffer(buf);
+               owner->getMiniBuffer()->Set(_("LinuxDoc file "),
+                                           MakeDisplayPath(filename),
+                                           _("imported."));
+       } else {
+               owner->getMiniBuffer()->Set(_("Could not import LinuxDoc file"),
+                                           MakeDisplayPath(filename));
+       }
+}
+
+
 void LyXFunc::MenuInsertLyXFile(string const & filen)
 {
        string filename = filen;
index a66dae38e37ca4b49c52501d9da503fefdb25828..fcb825489f10e972502701a46b26a1397f230210 100644 (file)
@@ -114,6 +114,9 @@ private:
        ///
        void doImportASCII(bool);
 
+       ///
+       void doImportLinuxDoc();
+
        ///
        void MenuInsertLyXFile(string const &);
 
index 6fb564ed0cf77a5ae66ee533fd2bda59ee040dc5..ef5be2b60ddbe351970da9a1d76d43fbe0624798 100644 (file)
@@ -86,7 +86,6 @@ enum LyXRCTags {
        RC_SCREEN_FONT_ENCODING,
        RC_SCREEN_FONT_ENCODING_MENU,
        RC_AUTOSAVE,
-       RC_SGML_EXTRA_OPTIONS,
        RC_DOCUMENTPATH,
        RC_TEMPLATEPATH,
        RC_TEMPDIRPATH,
@@ -148,6 +147,12 @@ enum LyXRCTags {
        RC_DATE_INSERT_FORMAT,
        RC_SHOW_BANNER,
        RC_USE_GUI,
+       RC_LINUXDOC_TO_LYX_COMMAND,
+       RC_LINUXDOC_TO_HTML_COMMAND,
+       RC_LINUXDOC_TO_LATEX_COMMAND,
+       RC_DOCBOOK_TO_DVI_COMMAND,
+       RC_DOCBOOK_TO_HTML_COMMAND,
+       RC_DOCBOOK_TO_PDF_COMMAND,
        RC_LAST
 };
 
@@ -176,6 +181,9 @@ keyword_item lyxrcTags[] = {
        { "\\date_insert_format", RC_DATE_INSERT_FORMAT },
        { "\\default_papersize", RC_DEFAULT_PAPERSIZE },
        { "\\display_shortcuts", RC_DISPLAY_SHORTCUTS },
+       { "\\docbook_to_dvi_command", RC_DOCBOOK_TO_DVI_COMMAND },
+       { "\\docbook_to_html_command", RC_DOCBOOK_TO_HTML_COMMAND },
+       { "\\docbook_to_pdf_command", RC_DOCBOOK_TO_PDF_COMMAND },
        { "\\document_path", RC_DOCUMENTPATH },
        { "\\dvi_to_ps_command", RC_DVI_TO_PS_COMMAND },
        { "\\escape_chars", RC_ESC_CHARS },
@@ -195,6 +203,9 @@ keyword_item lyxrcTags[] = {
        { "\\language_package", RC_LANGUAGE_PACKAGE },
        { "\\lastfiles", RC_LASTFILES },
        { "\\latex_command", RC_LATEX_COMMAND },
+       { "\\linuxdoc_to_html_command", RC_LINUXDOC_TO_HTML_COMMAND },
+       { "\\linuxdoc_to_latex_command", RC_LINUXDOC_TO_LATEX_COMMAND },
+       { "\\linuxdoc_to_lyx_command", RC_LINUXDOC_TO_LYX_COMMAND },
         { "\\literate_command", RC_LITERATE_COMMAND },
         { "\\literate_error_filter", RC_LITERATE_ERROR_FILTER },
         { "\\literate_extension", RC_LITERATE_EXTENSION },
@@ -239,7 +250,6 @@ keyword_item lyxrcTags[] = {
        { "\\screen_zoom", RC_SCREEN_ZOOM },
        { "\\selection_color", RC_SELECTION_COLOR },
        { "\\serverpipe", RC_SERVERPIPE },
-       { "\\sgml_extra_options", RC_SGML_EXTRA_OPTIONS },
        { "\\show_banner", RC_SHOW_BANNER },
        { "\\spell_command", RC_SPELL_COMMAND },
        { "\\tempdir_path", RC_TEMPDIRPATH },
@@ -362,6 +372,16 @@ void LyXRC::setDefaults() {
        date_insert_format = "%A, %e %B %Y";
        show_banner = true;
        use_gui = true;
+
+       ///
+       linuxdoc_to_latex_command="none";
+       linuxdoc_to_lyx_command="none";
+       linuxdoc_to_html_command="none";
+
+       docbook_to_dvi_command="none";
+       docbook_to_html_command="none";
+       docbook_to_pdf_command="none";
+
        //
        defaultKeyBindings();
 }
@@ -740,11 +760,6 @@ int LyXRC::read(string const & filename)
                                autosave = lexrc.GetInteger();
                        break;
                        
-               case RC_SGML_EXTRA_OPTIONS:
-                       if (lexrc.next())
-                               sgml_extra_options = lexrc.GetString();
-                       break;
-                       
                case RC_DOCUMENTPATH:
                        if (lexrc.next()) {
                                document_path = ExpandPath(lexrc.GetString());
@@ -997,6 +1012,30 @@ int LyXRC::read(string const & filename)
                        if (lexrc.next())
                                use_gui = lexrc.GetBool();
                        break;
+               case RC_LINUXDOC_TO_LYX_COMMAND:
+                       if ( lexrc.next())
+                               linuxdoc_to_lyx_command = lexrc.GetString();
+                       break;
+               case RC_LINUXDOC_TO_HTML_COMMAND:
+                       if ( lexrc.next())
+                               linuxdoc_to_html_command = lexrc.GetString();
+                       break;
+               case RC_LINUXDOC_TO_LATEX_COMMAND:
+                       if ( lexrc.next())
+                               linuxdoc_to_latex_command = lexrc.GetString();
+                       break;
+               case RC_DOCBOOK_TO_DVI_COMMAND:
+                       if ( lexrc.next())
+                               docbook_to_dvi_command = lexrc.GetString();
+                       break;
+               case RC_DOCBOOK_TO_HTML_COMMAND:
+                       if ( lexrc.next())
+                               docbook_to_html_command = lexrc.GetString();
+                       break;
+               case RC_DOCBOOK_TO_PDF_COMMAND:
+                       if ( lexrc.next())
+                               docbook_to_pdf_command = lexrc.GetString();
+                       break;
                case RC_LAST: break; // this is just a dummy
                }
        }
@@ -1201,9 +1240,6 @@ void LyXRC::output(ostream & os) const
                os << "\\chktex_command \"" << chktex_command << "\"\n";
        case RC_HTML_COMMAND:
                os << "\\html_command \"" << html_command << "\"\n";
-       case RC_SGML_EXTRA_OPTIONS:
-               os << "\\sgml_extra_options \"" << sgml_extra_options
-                  << "\"\n";
        case RC_KBMAP:
                os << "\\kbmap " << tostr(use_kbmap) << "\n";
        case RC_KBMAP_PRIMARY:
@@ -1316,6 +1352,24 @@ void LyXRC::output(ostream & os) const
                os << "\\show_banner " << tostr(show_banner) << "\n";
        case RC_USE_GUI:
                os << "\\use_gui " << tostr(show_banner) << "\n";
+       case RC_LINUXDOC_TO_LYX_COMMAND:
+               os << "\\linuxdoc_to_lyx_command \"" << linuxdoc_to_lyx_command
+                  << "\"\n";
+       case RC_LINUXDOC_TO_HTML_COMMAND:
+               os << "\\linuxdoc_to_html_command \"" << linuxdoc_to_html_command
+                  << "\"\n";
+       case RC_LINUXDOC_TO_LATEX_COMMAND:
+               os << "\\linuxdoc_to_latex_command \"" << linuxdoc_to_latex_command
+                  << "\"\n";
+       case RC_DOCBOOK_TO_DVI_COMMAND:
+               os << "\\docbook_to_dvi_command \"" << docbook_to_dvi_command
+                  << "\"\n";
+       case RC_DOCBOOK_TO_HTML_COMMAND:
+               os << "\\docbook_to_html_command \"" << docbook_to_html_command
+                  << "\"\n";
+       case RC_DOCBOOK_TO_PDF_COMMAND:
+               os << "\\docbook_to_pdf_command \"" << docbook_to_pdf_command
+                  << "\"\n";
        }
        os.flush();
 }
index 11d680324d972bff68252d08e357d0c68e7d6da8..9ffec09f5fa32e3ee38f622b8d884addf5c1d808 100644 (file)
@@ -121,8 +121,6 @@ public:
        /// command to run an html converter incl. options
        string html_command;
        ///
-       string sgml_extra_options;
-       ///
        string document_path;
        ///
        string template_path;
@@ -229,6 +227,18 @@ public:
        /// Do we have to use a GUI?
        bool use_gui;
        ///
+       string linuxdoc_to_lyx_command;
+       ///
+       string linuxdoc_to_html_command;
+       ///
+       string linuxdoc_to_latex_command;
+       ///
+       string docbook_to_dvi_command;
+       ///
+       string docbook_to_html_command;
+       ///
+       string docbook_to_pdf_command;
+       ///
        typedef map<string, int> Bindings;
        ///
        Bindings bindings;
index e00b9e7c9bf7f427378ee14c72e3f68ac70e9cf6..740e137c437e1eebc015f4dc132326d09442b48a 100644 (file)
@@ -467,12 +467,14 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
                                        "|LaTeX...%x30"
                                        "|Ascii Text as Lines...%x31"
                                        "|Ascii Text as Paragraphs%x32"
-                                       "|Noweb%x33"));
-       
+                                       "|Noweb%x33"
+                                       "|LinuxDoc%x34"));
+
        fl_setpup_shortcut(SubFileImport, 30, scex(_("FIM|Ll#l#L")));
        fl_setpup_shortcut(SubFileImport, 31, scex(_("FIM|Aa#a#A")));
        fl_setpup_shortcut(SubFileImport, 32, scex(_("FIM|Pp#p#P")));
        fl_setpup_shortcut(SubFileImport, 33, scex(_("FIM|Nn#n#N")));
+       fl_setpup_shortcut(SubFileImport, 34, scex(_("FIM|Dd#d#D")));
 
        // Export sub-menu
 
@@ -494,21 +496,24 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
                                           "|as LinuxDoc...%x40"
                                           "|as DVI...%x41"
                                           "|as PostScript...%x42"
-                                          "|as Ascii Text...%x43"));
+                                          "|as Ascii Text...%x43"
+                                          "|as HTML...%x44"));
         else if(DocBook)
                SubFileExport= fl_defpup(FL_ObjWin(ob),
                                         _("Export%t"
                                           "|as DocBook...%x40"
                                           "|as DVI...%x41"
                                           "|as PostScript...%x42"
-                                          "|as Ascii Text...%x43"));
+                                          "|as Ascii Text...%x43"
+                                          "|as HTML...%x44"));
 
        fl_setpup_shortcut(SubFileExport, 40, scex(_("FEX|Ll#l#L")));
        fl_setpup_shortcut(SubFileExport, 41, scex(_("FEX|Dd#d#D")));
        fl_setpup_shortcut(SubFileExport, 42, scex(_("FEX|Pp#p#P")));
        fl_setpup_shortcut(SubFileExport, 43, scex(_("FEX|Tt#t#T")));
+       fl_setpup_shortcut(SubFileExport, 44, scex(_("FEX|Hh#h#H")));
+
        if (!LinuxDoc && !DocBook) {
-               fl_setpup_shortcut(SubFileExport, 44, scex(_("FEX|Hh#h#H")));
                fl_setpup_shortcut(SubFileExport, 45, scex(_("FEX|mM#m#M")));
        }
        
@@ -575,13 +580,18 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
                fl_setpup_mode(SubFileImport, 33, FL_PUP_GREY);
        }
 
+       if ( lyxrc.linuxdoc_to_lyx_command == "none")
+               fl_setpup_mode(SubFileImport, 34, FL_PUP_GREY);
+
        if (!hasLaTeX) {
                // Disable export dvi and export postscript
                fl_setpup_mode(SubFileExport, 41, FL_PUP_GREY);
                fl_setpup_mode(SubFileExport, 42, FL_PUP_GREY);
        }
 
-       if (lyxrc.html_command == "none") {
+       if ((!LinuxDoc && !DocBook && lyxrc.html_command == "none") ||
+           ( LinuxDoc && lyxrc.linuxdoc_to_html_command == "none") ||
+           ( DocBook  && lyxrc.docbook_to_html_command  == "none")) {
                // Disable export HTML
                fl_setpup_mode(SubFileExport, 44, FL_PUP_GREY);
        }
@@ -644,6 +654,8 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
                break;
        case 33: tmpfunc->Dispatch(LFUN_IMPORT, "noweb");
                break;
+       case 34: tmpfunc->Dispatch(LFUN_IMPORT, "linuxdoc");
+               break;
        case 16: // export menu
        case 40:
                if (!LinuxDoc && !DocBook)
@@ -659,7 +671,13 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
                break;
        case 43: tmpfunc->Dispatch(LFUN_EXPORT, "ascii");
                break;
-       case 44: tmpfunc->Dispatch(LFUN_EXPORT, "html");
+       case 44:
+               if (!LinuxDoc && !DocBook)
+                       tmpfunc->Dispatch(LFUN_EXPORT, "html");
+               else if(LinuxDoc)
+                       tmpfunc->Dispatch(LFUN_EXPORT, "html-linuxdoc");
+               else
+                       tmpfunc->Dispatch(LFUN_EXPORT, "html-docbook");
                break;
        case 45: tmpfunc->Dispatch(LFUN_EXPORT, "custom"); 
                break;
@@ -706,12 +724,14 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
                                        "|LaTeX...%x15"
                                        "|Ascii Text as Lines...%x16"
                                        "|Ascii Text as Paragraphs...%x17"
-                                       "|Noweb...%x18"));
+                                       "|Noweb...%x18"
+                                       "|LinuxDoc...%x19"));
        
        fl_setpup_shortcut(SubFileImport, 15, scex(_("FIM|Ll#l#L")));
        fl_setpup_shortcut(SubFileImport, 16, scex(_("FIM|Aa#a#A")));
        fl_setpup_shortcut(SubFileImport, 17, scex(_("FIM|Pp#p#P")));
        fl_setpup_shortcut(SubFileImport, 18, scex(_("FIM|Nn#n#N")));
+       fl_setpup_shortcut(SubFileImport, 19, scex(_("FIM|Dd#d#D")));
 
        bool hasReLyX = lyxrc.relyx_command != "none";
        if (!hasReLyX) {
@@ -720,6 +740,9 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
                fl_setpup_mode(SubFileImport, 18, FL_PUP_GREY);
        }
 
+       if ( lyxrc.linuxdoc_to_lyx_command == "none")
+               fl_setpup_mode(SubFileImport, 19, FL_PUP_GREY);
+
        // This can be done cleaner later.
        int FileMenu = fl_defpup(FL_ObjWin(ob), 
                                 _("New..."
@@ -777,6 +800,8 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
                break;
        case 18: tmpfunc->Dispatch(LFUN_IMPORT, "noweb");
                break;
+       case 19: tmpfunc->Dispatch(LFUN_IMPORT, "linuxdoc");
+               break;
        case 5:
                tmpfunc->Dispatch(LFUN_QUIT);
                break;