]> git.lyx.org Git - features.git/commitdiff
add support for xml, now just for docbook
authorJosé Matox <jamatos@lyx.org>
Thu, 13 May 2004 11:21:58 +0000 (11:21 +0000)
committerJosé Matox <jamatos@lyx.org>
Thu, 13 May 2004 11:21:58 +0000 (11:21 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8751 a592a061-630c-0410-9148-cb99ea01b6c8

lib/ChangeLog
lib/configure.m4
src/ChangeLog
src/buffer.C
src/converter.C
src/converter.h
src/outputparams.h

index 66054605c640eae9e3fe965d656209c5a3c0bbf1..c15f69f51cf77aac87869eea056486d15df02653 100644 (file)
@@ -1,3 +1,7 @@
+2004-05-13  José Matos  <jamatos@lyx.org>
+
+       * configure.m4: add support for docbook-xml.
+
 2004-05-12  José Matos  <jamatos@lyx.org>
 
        * layouts/db_stdclass.inc: do not use small caps for name.
index 43d5810313c2c05bbade7085dfa73683577f925c..7b5888a922cf96c34ac3d10d5ef227f437680757 100644 (file)
@@ -521,6 +521,7 @@ cat >$outfile <<EOF
 \\Format date       ""     "date command"          "" ""       ""
 \\Format dateout    tmp    "date (output)"         "" ""       ""
 \\Format docbook    sgml    DocBook                B  ""       ""
+\\Format docbook-xml xml    "Docbook (xml)"        "" "" ""
 \\Format dvi        dvi     DVI                    D  "$DVI_VIEWER"    ""
 \\Format eps        eps     EPS                    "" "$EPS_VIEWER"    ""
 \\Format fax        ""      Fax                    "" ""       ""
@@ -554,6 +555,7 @@ cat >$outfile <<EOF
 \\Format xpm        xpm     XPM                    "" "$RASTERIMAGE_VIEWER"    "$RASTERIMAGE_EDITOR"
 
 \\converter date       dateout    "date +%d-%m-%Y > \$\$o"     ""
+\\converter docbook    docbook-xml "cp \$\$i \$\$o" "xml"
 \\converter docbook    dvi        "$docbook_to_dvi_command"    ""
 \\converter docbook    html       "$docbook_to_html_command"   ""
 \\converter dvi        pdf3       "$dvi_to_pdf_command"        ""
index e91d34ea25d80f4fa6660e488f147e9621723a06..e5c9c3db694f7eb75a317b44845db02de9436145 100644 (file)
@@ -1,3 +1,10 @@
+2004-05-13  José Matos  <jamatos@lyx.org>
+
+       * converter.h:
+       * converter.C (Converter, readFlags): add xml member.
+       * outputparams.h: add XML flavor.
+       * buffer.C (makeDocBookFile): add support for the sgml/xml distinction.
+
 2004-05-03  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
 
        * lyxfunc.C (dispatch): 
index 054c7f0659b52cec0b71fa2c2c7545c474587e50..5b84c1714713dbcc2bfd12a7e26e50b7ffc5b79d 100644 (file)
@@ -20,6 +20,7 @@
 #include "Bullet.h"
 #include "Chktex.h"
 #include "debug.h"
+#include "encoding.h"
 #include "errorlist.h"
 #include "exporter.h"
 #include "format.h"
@@ -1065,6 +1066,10 @@ void Buffer::makeDocBookFile(string const & fname,
        string top_element = tclass.latexname();
 
        if (!only_body) {
+               if (runparams.flavor == OutputParams::XML)
+                       ofs << "<?xml version=\"1.0\" encoding=\""
+                           << params().language->encoding()->Name() << "\"?>\n";
+
                ofs << subst(tclass.class_header(), "#", top_element);
 
                string preamble = params().preamble;
@@ -1090,7 +1095,8 @@ void Buffer::makeDocBookFile(string const & fname,
        }
        sgml::openTag(ofs, 0, false, top);
 
-       ofs << "<!-- SGML/XML file was created by LyX " << lyx_version
+       ofs << "<!-- " << ((runparams.flavor == OutputParams::XML)? "XML" : "SGML")
+           << " file was created by LyX " << lyx_version
            << "\n  See http://www.lyx.org/ for more information -->\n";
 
        params().getLyXTextClass().counters().reset();
index 038738cbf1225928e96fbf6c9bcea628f6a655f1..10ebfeaf7bbe09159109af8bcef832f7a0cb494c 100644 (file)
@@ -104,7 +104,7 @@ private:
 
 Converter::Converter(string const & f, string const & t, string const & c,
          string const & l): from(f), to(t), command(c), flags(l),
-                            From(0), To(0), latex(false),
+                            From(0), To(0), latex(false), xml(false),
                             original_dir(false), need_aux(false)
 {}
 
@@ -118,6 +118,8 @@ void Converter::readFlags()
                flag_value = split(flag_value, flag_name, '=');
                if (flag_name == "latex")
                        latex = true;
+               else if (flag_name == "xml")
+                       xml = true;
                else if (flag_name == "originaldir")
                        original_dir = true;
                else if (flag_name == "needaux")
@@ -264,6 +266,8 @@ OutputParams::FLAVOR Converters::getFlavor(Graph::EdgePath const & path)
                if (conv.latex)
                        if (contains(conv.to, "pdf"))
                                return OutputParams::PDFLATEX;
+               if (conv.xml)
+                       return OutputParams::XML;
        }
        return OutputParams::LATEX;
 }
index 6775fb0f1afacc2b2449bff06d50586753ab7b37..3945dd5c3b1a7864a37a6fb706faaf2452a887aa 100644 (file)
@@ -48,6 +48,8 @@ public:
 
        /// The converter is latex or its derivatives
        bool latex;
+       /// The converter is xml
+       bool xml;
        /// Do we need to run the converter in the original directory?
        bool original_dir;
        /// This converter needs the .aux files
index 8071f2454e0a665d5422b3d000470665d8891e94..6bbe7a181c76ba104785235aaf5f27492ce78755 100644 (file)
@@ -19,7 +19,8 @@ struct OutputParams {
        //
        enum FLAVOR {
                LATEX,
-               PDFLATEX
+               PDFLATEX,
+               XML
        };
 
        OutputParams()