Hi, once again I am trapped inside strong firewalls (no comments), it looks like a jail... That was the reason why I haven't realeased this patch earlier. I know it is friday but allow me to thank Juergen for the marvelous work in the inset tabular, there is no comparison with the old one regarding the clean code. Thanks Juergen! The only problem I have now is that when I export any linuxdoc or docbook document it always goes to the temporary directory. This happens for all the exported formats. I have tried to look in the code, the ofending code is easy to spot but I don't know why it works like that. Any hint? Thanks also goes to Dekel, all the exported code works as it should, and I can view all the formats, great work, congratulations. The patch follows. -- José
diff -ur lyx-1.1.6cvs.old/ChangeLog lyx-1.1.6cvs/ChangeLog --- lyx-1.1.6cvs.old/ChangeLog Thu Oct 26 18:00:12 2000 +++ lyx-1.1.6cvs/ChangeLog Fri Oct 27 09:19:37 2000 @@ -1,3 +1,15 @@ +2000-10-26 José Abílio Matos <[EMAIL PROTECTED]> + + * src/buffer.h (SimpleDocBookOnePar): becomes public and const. + * src/buffer.C (SimpleDocBookOnePar): this method goes const. + + * insettabular.h + * insettabular.C (DocBook): uses the tabular methods to export + docbook + + * src/insets/insettext.h + * src/insets/insettext.C (DocBook): Implemented export for docbooc. + 2000-10-26 Lars Gullik Bjønnes <[EMAIL PROTECTED]> * src/frontends/ButtonPolicies.h (operator<<): reinsert for State diff -ur lyx-1.1.6cvs.old/src/buffer.C lyx-1.1.6cvs/src/buffer.C --- lyx-1.1.6cvs.old/src/buffer.C Thu Oct 26 18:01:20 2000 +++ lyx-1.1.6cvs/src/buffer.C Fri Oct 27 09:16:42 2000 @@ -3260,7 +3260,7 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra, LyXParagraph * par, int & desc_on, - int depth) + int depth) const { bool emph_flag = false; Only in lyx-1.1.6cvs/src: buffer.C.orig diff -ur lyx-1.1.6cvs.old/src/buffer.h lyx-1.1.6cvs/src/buffer.h --- lyx-1.1.6cvs.old/src/buffer.h Thu Oct 12 18:00:55 2000 +++ lyx-1.1.6cvs/src/buffer.h Fri Oct 27 09:16:42 2000 @@ -166,6 +166,11 @@ void latexParagraphs(std::ostream & os, LyXParagraph * par, LyXParagraph * endpar, TexRow & texrow) const; + /// + void SimpleDocBookOnePar(std::ostream &, string & extra, + LyXParagraph * par, int & desc_on, + int depth) const ; + /// int runChktex(); @@ -366,10 +371,6 @@ /// void SimpleLinuxDocOnePar(std::ostream & os, LyXParagraph * par, int desc_on, int depth); - /// - void SimpleDocBookOnePar(std::ostream &, string & extra, - LyXParagraph * par, int & desc_on, - int depth); /// LinuxDoc. void push_tag(std::ostream & os, string const & tag, diff -ur lyx-1.1.6cvs.old/src/insets/insettabular.C lyx-1.1.6cvs/src/insets/insettabular.C --- lyx-1.1.6cvs.old/src/insets/insettabular.C Tue Oct 24 18:02:11 2000 +++ lyx-1.1.6cvs/src/insets/insettabular.C Fri Oct 27 09:16:42 2000 @@ -937,9 +937,9 @@ } -int InsetTabular::DocBook(Buffer const *, ostream &) const +int InsetTabular::DocBook(Buffer const * buf, ostream & os) const { - return 0; + return tabular->DocBook(buf,os); } Only in lyx-1.1.6cvs/src/insets: insettabular.C.orig diff -ur lyx-1.1.6cvs.old/src/insets/insettext.C lyx-1.1.6cvs/src/insets/insettext.C --- lyx-1.1.6cvs.old/src/insets/insettext.C Wed Oct 25 18:01:16 2000 +++ lyx-1.1.6cvs/src/insets/insettext.C Fri Oct 27 09:16:42 2000 @@ -1091,6 +1091,22 @@ } +int InsetText::DocBook(Buffer const * buf, ostream & os) const +{ + LyXParagraph * p = par; + unsigned int lines = 0; + int desc=0; + + string tmp; + while (p) { + buf->SimpleDocBookOnePar(os,tmp,p,desc,0); + p = p->next; + } + + return lines; +} + + void InsetText::Validate(LaTeXFeatures & features) const { LyXParagraph * p = par; Only in lyx-1.1.6cvs/src/insets: insettext.C.orig diff -ur lyx-1.1.6cvs.old/src/insets/insettext.h lyx-1.1.6cvs/src/insets/insettext.h --- lyx-1.1.6cvs.old/src/insets/insettext.h Tue Oct 17 06:03:10 2000 +++ lyx-1.1.6cvs/src/insets/insettext.h Fri Oct 27 09:16:42 2000 @@ -130,7 +130,7 @@ /// int Linuxdoc(Buffer const *, std::ostream &) const { return 0; } /// - int DocBook(Buffer const *, std::ostream &) const { return 0; } + int DocBook(Buffer const *, std::ostream &) const ; /// void Validate(LaTeXFeatures & features) const; /// diff -ur lyx-1.1.6cvs.old/src/tabular.C lyx-1.1.6cvs/src/tabular.C --- lyx-1.1.6cvs.old/src/tabular.C Tue Oct 24 06:01:21 2000 +++ lyx-1.1.6cvs/src/tabular.C Fri Oct 27 09:16:42 2000 @@ -2247,6 +2247,96 @@ } +int LyXTabular::DocBook(Buffer const * buf, ostream & os) const +{ + int ret = 0; + int cell = 0; + + //+--------------------------------------------------------------------- + //+ first the opening preamble + + //+--------------------------------------------------------------------- + + os << "<tgroup cols=\"" << columns_ + << "\" colsep=\"1\" rowsep=\"1\">" << endl; + + for (int i = 0; i < columns_; ++i) { + os << "<colspec colname=\"col" << i << "\" align=\""; + switch (column_info[i].alignment) { + case LYX_ALIGN_LEFT: + os << "left"; + break; + case LYX_ALIGN_RIGHT: + os << "right"; + break; + default: + os << "center"; + break; + } + os << "\"/>" << endl; + ++ret; + } + + //+--------------------------------------------------------------------- + //+ the single row and columns (cells) + + //+--------------------------------------------------------------------- + + os << "<tbody>" << endl; + for(int i = 0; i < rows_; ++i) { + os << "<row>" << endl; + for(int j = 0; j < columns_; ++j) { + if (IsPartOfMultiColumn(i,j)) + continue; + + os << "<entry align=\""; + switch(GetAlignment(cell)) { + case LYX_ALIGN_LEFT: + os << "left"; + break; + case LYX_ALIGN_RIGHT: + os << "right"; + break; + default: + os << "center"; + break; + } + + os << "\" valign=\""; + switch(GetVAlignment(cell)) { + case LYX_VALIGN_TOP: + os << "top"; + break; + case LYX_VALIGN_BOTTOM: + os << "bottom"; + break; + case LYX_VALIGN_CENTER: + os << "middle"; + } + os << "\""; + + if (IsMultiColumn(cell)) { + os << " namest=\"col" << j << "\" "; + os << "nameend=\"col" << j + cells_in_multicolumn(cell) - 1<< "\""; + } + + os << ">"; + ret += GetCellInset(cell)->DocBook(buf, os); + os << "</entry>"; + ++cell; + } + os << "</row>" << endl; + } + os << "</tbody>" << endl; + //+--------------------------------------------------------------------- + //+ the closing of the tabular + + //+--------------------------------------------------------------------- + + os << "</tgroup>"; + ++ret; + + return ret; +} + + static void print_n_chars(ostream & os, unsigned char ch, int const n) { for(int i=0; i < n; ++i) diff -ur lyx-1.1.6cvs.old/src/tabular.h lyx-1.1.6cvs/src/tabular.h --- lyx-1.1.6cvs.old/src/tabular.h Wed Oct 11 18:00:56 2000 +++ lyx-1.1.6cvs/src/tabular.h Fri Oct 27 09:16:42 2000 @@ -280,6 +280,8 @@ /// int Latex(Buffer const *, std::ostream &, bool, bool) const; /// + int DocBook(Buffer const * buf, ostream & os) const; + /// // helper function for Latex returns number of newlines /// int AsciiTopHLine(std::ostream &, int row,