On Tue, Nov 11, 2003 at 10:05:45AM +0000, Jose' Matos spake thusly:
 
> On Sunday 09 November 2003 14:27, Martin Vermeer wrote:

...

> >     LatexParam            "4|revnumber"

...

> > Does this make sense?
> 
>   Completly. :-)
> 
> > - Martin
> 
> -- 
> José Abílio

 
Patch attached.

I'll check it in later today if no objections come up.

(Pity André's not around, I think even the whitespace is OK)

- Martin

-- 
Martin Vermeer  [EMAIL PROTECTED]
Helsinki University of Technology 
Dept. of Surveying, Inst. of Geodesy
P.O. Box 1200, FIN-02015 HUT, Finland
:wq
Index: lib/layouts/db_stdsections.inc
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/layouts/db_stdsections.inc,v
retrieving revision 1.4
diff -u -p -r1.4 db_stdsections.inc
--- lib/layouts/db_stdsections.inc      15 Sep 2003 15:20:18 -0000      1.4
+++ lib/layouts/db_stdsections.inc      14 Nov 2003 11:00:21 -0000
@@ -1,8 +1,9 @@
 # Textclass definition file for docbook.
 # Author : José Abílio Oliveira Matos <[EMAIL PROTECTED]>
+# Modified by Martin Vermeer <[EMAIL PROTECTED]>
 
 # This file is the counterpart of stdsections.inc
-# It is desireable, as far as possible, to have the same look and feeling for
+# It is desirable, as far as possible, to have the same look and feel for
 # related layouts in latex and docbook.
 
 Input stdsections.inc
@@ -10,47 +11,55 @@ Input stdsections.inc
 Style Part
        LatexType             Command
        LatexName             part
-       LatexParam            "0|"
+       InnerTag              "title"
+       CommandDepth          0
 End
 
 
 Style Chapter
        LatexType             Command
        LatexName             chapter
-       LatexParam            "1|"
+       InnerTag              "title"
+       CommandDepth          1
 End
 
 
 Style Section
        LatexType             Command
        LatexName             sect1
-       LatexParam            "2|"
+       InnerTag              "title"
+       CommandDepth          2
 End
 
 
 Style Subsection
        LatexType             Command
        LatexName             sect2
-       LatexParam            "3|"
+       InnerTag              "title"
+       CommandDepth          3
 End
 
 
 Style Subsubsection
        LatexType             Command
        LatexName             sect3
-       LatexParam            "4|"
+       InnerTag              "title"
+       CommandDepth          4
 End
 
 
 Style Paragraph
        LatexType             Command
        LatexName             sect4
-       LatexParam            "5|"
+       InnerTag              "title"
+       CommandDepth          5
 End
 
 
 Style Subparagraph
        LatexType             Command
        LatexName             sect5
-       LatexParam            "6|"
+       InnerTag              "title"
+       CommandDepth          6
 End
+
Index: lib/layouts/db_stdtitle.inc
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/layouts/db_stdtitle.inc,v
retrieving revision 1.7
diff -u -p -r1.7 db_stdtitle.inc
--- lib/layouts/db_stdtitle.inc 15 Sep 2003 15:20:18 -0000      1.7
+++ lib/layouts/db_stdtitle.inc 14 Nov 2003 11:00:21 -0000
@@ -1,8 +1,9 @@
 # Textclass definition file for docbook.
 # Author : José Abílio Oliveira Matos <[EMAIL PROTECTED]>
-
-# This file is the counterpart of stdstile.inc
-# It is desireable, as far as possible, to have the same look and feeling for
+# Modified Martin Vermeer <[EMAIL PROTECTED]> 
+#
+# This file is the counterpart of stdstyle.inc
+# It is desireable, as far as possible, to have the same look and feel for
 # related layouts in latex and docbook.
 
 Input stdtitle.inc
@@ -11,7 +12,8 @@ Input stdtitle.inc
 Style Title
        LatexType             Command
        LatexName             articleinfo
-       LatexParam            "2|"
+       CommandDepth          2
+       InnerTag              "title"
 End
 
 
Index: src/lyxlayout.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxlayout.C,v
retrieving revision 1.22
diff -u -p -r1.22 lyxlayout.C
--- src/lyxlayout.C     6 Oct 2003 15:42:26 -0000       1.22
+++ src/lyxlayout.C     14 Nov 2003 11:00:21 -0000
@@ -33,6 +33,7 @@ enum LayoutTags {
        LT_ALIGNPOSSIBLE,
        LT_MARGIN,
        LT_BOTTOMSEP,
+       LT_COMMANDDEPTH,
        LT_COPYSTYLE,
        LT_DEPENDSON,
        LT_OBSOLETEDBY,
@@ -80,7 +81,8 @@ enum LayoutTags {
        LT_SPACING,
        LT_TOPSEP,
        LT_TOCLEVEL,
-       LT_INTITLE
+       LT_INNERTAG,
+       LT_INTITLE // keep this last!
 };
 
 /////////////////////
@@ -118,6 +120,7 @@ LyXLayout::LyXLayout ()
        pass_thru = false;
        is_environment = false;
        toclevel = 0;
+       commanddepth = 0;
 }
 
 
@@ -129,6 +132,7 @@ bool LyXLayout::Read(LyXLex & lexrc, LyX
                { "align",              LT_ALIGN },
                { "alignpossible",      LT_ALIGNPOSSIBLE },
                { "bottomsep",          LT_BOTTOMSEP },
+               { "commanddepth",   LT_COMMANDDEPTH },
                { "copystyle",          LT_COPYSTYLE },
                { "dependson",          LT_DEPENDSON },
                { "end",                LT_END },
@@ -138,6 +142,7 @@ bool LyXLayout::Read(LyXLex & lexrc, LyX
                { "fill_top",           LT_FILL_TOP },
                { "font",               LT_FONT },
                { "freespacing",        LT_FREE_SPACING },
+               { "innertag",       LT_INNERTAG },
                { "intitle",            LT_INTITLE },
                { "itemsep",            LT_ITEMSEP },
                { "keepempty",          LT_KEEPEMPTY },
@@ -314,6 +319,11 @@ bool LyXLayout::Read(LyXLex & lexrc, LyX
                                nextnoindent = false;
                        break;
 
+               case LT_COMMANDDEPTH:
+                       lexrc.next();
+                       commanddepth = lexrc.getInteger();
+                       break;
+
                case LT_LATEXNAME:
                        if (lexrc.next())
                                latexname_ = lexrc.getString();
@@ -322,6 +332,11 @@ bool LyXLayout::Read(LyXLex & lexrc, LyX
                case LT_LATEXPARAM:
                        if (lexrc.next())
                                latexparam_ = lexrc.getString();
+                       break;
+
+               case LT_INNERTAG:
+                       if (lexrc.next())
+                               innertag_ = lexrc.getString();
                        break;
 
                case LT_PREAMBLE:
Index: src/lyxlayout.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxlayout.h,v
retrieving revision 1.16
diff -u -p -r1.16 lyxlayout.h
--- src/lyxlayout.h     6 Oct 2003 15:42:26 -0000       1.16
+++ src/lyxlayout.h     14 Nov 2003 11:00:21 -0000
@@ -63,6 +63,8 @@ public:
        ///
        std::string const & latexparam() const { return latexparam_; }
        ///
+       std::string const & innertag() const { return innertag_; }
+       ///
        std::string const & labelstring_appendix() const {
                return labelstring_appendix_;
        }
@@ -178,6 +180,8 @@ public:
        int optionalargs;
        /// Which counter to step
        std::string counter;
+       /// Depth of XML command
+       int commanddepth;
 
 private:
        /// Name of the layout/paragraph environment
@@ -205,6 +209,8 @@ private:
        std::string labelstring_appendix_;
        /// LaTeX parameter for environment
        std::string latexparam_;
+       /// Internal tag to use (e.g., <title></title> for sect header)
+       std::string innertag_;
        /// Macro definitions needed for this layout
        std::string preamble_;
 };
Index: src/output_docbook.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/output_docbook.C,v
retrieving revision 1.1
diff -u -p -r1.1 output_docbook.C
--- src/output_docbook.C        5 Nov 2003 12:06:03 -0000       1.1
+++ src/output_docbook.C        14 Nov 2003 11:00:21 -0000
@@ -55,16 +55,13 @@ void docbookParagraphs(Buffer const & bu
        Paragraph::depth_type cmd_depth = 0;
        Paragraph::depth_type depth = 0; // paragraph depth
 
-       string item_name;
        string command_name;
 
        ParagraphList::iterator par = const_cast<ParagraphList&>(paragraphs).begin();
        ParagraphList::iterator pend = const_cast<ParagraphList&>(paragraphs).end();
 
        for (; par != pend; ++par) {
-               string sgmlparam;
-               string c_depth;
-               string c_params;
+               string inner_tag;
                int desc_on = 0; // description mode
 
                LyXLayout_ptr const & style = par->layout();
@@ -91,6 +88,7 @@ void docbookParagraphs(Buffer const & bu
                }
 
                // Write opening SGML tags.
+               string item_name;
                switch (style->latextype) {
                case LATEX_PARAGRAPH:
                        sgml::openTag(os, depth + command_depth,
@@ -104,11 +102,9 @@ void docbookParagraphs(Buffer const & bu
                        
                        command_name = style->latexname();
 
-                       sgmlparam = style->latexparam();
-                       c_params = split(sgmlparam, c_depth,'|');
-
-                       cmd_depth = atoi(c_depth);
-
+                       cmd_depth = style->commanddepth;
+                       inner_tag = style->innertag();
+                       
                        if (command_flag) {
                                if (cmd_depth < command_base) {
                                        for (Paragraph::depth_type j = command_depth;
@@ -150,9 +146,8 @@ void docbookParagraphs(Buffer const & bu
                        }
 
                        sgml::openTag(os, depth + command_depth, false, command_name);
-
-                       item_name = c_params.empty() ? "title" : c_params;
-                       sgml::openTag(os, depth + 1 + command_depth, false, item_name);
+                       // Inner tagged header text, e.g. <title> for sectioning:
+                       sgml::openTag(os, depth + 1 + command_depth, false, inner_tag);
                        break;
 
                case LATEX_ENVIRONMENT:
@@ -208,9 +203,7 @@ void docbookParagraphs(Buffer const & bu
                // write closing SGML tags
                switch (style->latextype) {
                case LATEX_COMMAND:
-                       end_tag = c_params.empty() ? "title" : c_params;
-                       sgml::closeTag(os, depth + command_depth,
-                                    false, end_tag);
+                       sgml::closeTag(os, depth + command_depth, false, inner_tag);
                        break;
                case LATEX_ENVIRONMENT:
                        if (!style->latexparam().empty()) {

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to