]> git.lyx.org Git - features.git/commitdiff
Introducing a number of tags parametrizing various
authorMartin Vermeer <martin.vermeer@hut.fi>
Tue, 25 Nov 2003 17:23:36 +0000 (17:23 +0000)
committerMartin Vermeer <martin.vermeer@hut.fi>
Tue, 25 Nov 2003 17:23:36 +0000 (17:23 +0000)
XML formats that we may want to support

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

28 files changed:
lib/ChangeLog
lib/layouts/agu-dtd.layout [new file with mode: 0644]
lib/layouts/agu_stdclass.inc [new file with mode: 0644]
lib/layouts/agu_stdcounters.inc [new file with mode: 0644]
lib/layouts/agu_stdlists.inc [new file with mode: 0644]
lib/layouts/agu_stdsections.inc [new file with mode: 0644]
lib/layouts/db_lyxmacros.inc
lib/layouts/db_stdclass.inc
lib/layouts/db_stdlayouts.inc
lib/layouts/db_stdlists.inc
lib/layouts/db_stdstarsections.inc
lib/layouts/db_stdstruct.inc
lib/layouts/db_stdtitle.inc
lib/layouts/docbook-book.layout
lib/layouts/docbook-chapter.layout
lib/layouts/docbook-section.layout
src/ChangeLog
src/buffer.C
src/lyxlayout.C
src/lyxlayout.h
src/lyxtext.h
src/output_docbook.C
src/output_latex.C
src/paragraph.C
src/paragraph.h
src/sgml.C
src/sgml.h
src/text2.C

index 3958993e1340f710ebf849f0ece752c93c546e78..be33917e45d695c4a6e9972394e81c93441332df 100644 (file)
@@ -1,3 +1,23 @@
+
+2003-11-25  Martin Vermeer  <martin.vermeer@hut.fi>
+
+       * lib/layouts/agu-dtd.layout:
+       * lib/layouts/agu_stdclass.inc:
+       * lib/layouts/agu_stdcounters.inc:
+       * lib/layouts/agu_stdlists.inc:
+       * lib/layouts/agu_stdsections.inc:
+       * lib/layouts/db_lyxmacros.inc:
+       * lib/layouts/db_stdclass.inc:
+       * lib/layouts/db_stdlayouts.inc:
+       * lib/layouts/db_stdlists.inc:
+       * lib/layouts/db_stdstarsections.inc:
+       * lib/layouts/db_stdstruct.inc:
+       * lib/layouts/db_stdtitle.inc:
+       * lib/layouts/docbook-book.layout:
+       * lib/layouts/docbook-chapter.layout:
+       * lib/layouts/docbook-section.layout: Introducing a number of tags
+       parametrizing various XML formats that we may want to support
+
 2003-11-17  Roman Maurer <roman.maurer@amis.net>
 
        * examples/sl_splash.lyx: update
diff --git a/lib/layouts/agu-dtd.layout b/lib/layouts/agu-dtd.layout
new file mode 100644 (file)
index 0000000..e89cddb
--- /dev/null
@@ -0,0 +1,14 @@
+#% Do not delete the line below; configure depends on this
+#  \DeclareDocBookClass[AGU-article]{AGU Article (SGML)}
+# AGU XML textclass definition file.
+# Authors : Jose' Matos <jamatos@lyx.org>
+#           Martin Vermeer <martin.vermeer@hut.fi>
+
+
+Input agu_stdclass.inc
+Input numarticle.inc
+
+
+# Exclude higher, or equal, sections:
+NoStyle Part
+NoStyle Chapter
diff --git a/lib/layouts/agu_stdclass.inc b/lib/layouts/agu_stdclass.inc
new file mode 100644 (file)
index 0000000..d703636
--- /dev/null
@@ -0,0 +1,89 @@
+# Textclass definition file for AGU-Article.
+# Author : José Abílio Oliveira Matos <jamatos@lyx.org>
+#          Martin Vermeer <martin.vermeer@hut.fi>
+
+# This file is the counterpart of stdclass.inc
+# It is desirable, as far as possible, to have the same look and feel for
+# related layouts in latex and docbook.
+
+OutputType              docbook
+
+Columns                 1
+Sides                   1
+SecNumDepth             3
+TocDepth                3
+DefaultStyle            Standard
+
+
+Style Standard
+       Margin                Static
+       LatexType             Paragraph
+       LatexName             p
+       ParIndent             MM
+       ParSkip               0.4
+       Align                 Block
+       AlignPossible         Block
+       LabelType             No_Label
+       LatexParam            "para#"
+End
+
+
+CharStyle Firstname
+       LatexType             Command
+       LatexName             firstname
+       Font
+         Shape               SmallCaps
+       EndFont
+       LabelFont
+         Shape               Italic
+         Color               red
+       EndFont
+End
+
+CharStyle Surname
+       LatexType             Command
+       LatexName             firstname
+       Font
+         Shape               SmallCaps
+       EndFont
+       LabelFont
+         Shape               Italic
+         Color               red
+       EndFont
+End
+
+CharStyle Filename
+       LatexType             Command
+       LatexName             firstname
+       Font
+         Family              Typewriter
+       EndFont
+       LabelFont
+         Shape               Italic
+         Color               red
+       EndFont
+End
+
+CharStyle Literal
+       LatexType             Command
+       LatexName             firstname
+       Font
+         Family              Typewriter
+       EndFont
+       LabelFont
+         Shape               Italic
+         Color               red
+       EndFont
+End
+
+
+Input agu_stdlists.inc
+Input agu_stdsections.inc
+Input db_stdstarsections.inc
+Input db_stdtitle.inc
+Input db_stdstruct.inc
+Input db_lyxmacros.inc
+Input db_stdlayouts.inc
+Input stdcounters.inc
+Input agu_stdcounters.inc
+Input stdfloats.inc
diff --git a/lib/layouts/agu_stdcounters.inc b/lib/layouts/agu_stdcounters.inc
new file mode 100644 (file)
index 0000000..8443451
--- /dev/null
@@ -0,0 +1,34 @@
+# Author : José Matos <jamatos@lyx.org>
+#          Martin Vermeer <martin.vermeer@hut.fi>
+
+# This include file contains all the counters that are defined as standard
+# in AGU-Article LyX layouts.
+
+Counter
+       Name                 sect1
+       Within               section
+End
+
+Counter
+       Name                 sect2
+       Within               sect1
+End
+
+Counter
+       Name                 sect3
+       Within               sect2
+End
+
+Counter
+       Name                 sect4
+       Within               sect3
+End
+
+Counter
+       Name                 sect5
+       Within               sect4
+End
+
+Counter
+       Name                 para
+End
diff --git a/lib/layouts/agu_stdlists.inc b/lib/layouts/agu_stdlists.inc
new file mode 100644 (file)
index 0000000..769415d
--- /dev/null
@@ -0,0 +1,37 @@
+# Textclass definition file for AGU-Article.
+# Author : José Abílio Oliveira Matos <jamatos@lyx.org>
+#          Martin Vermeer <martin.vermeer@hut.fi>
+
+# This is the counterpart of stdlists.inc
+# It is desirable, as far as possible, to have the same look and feel for
+# related layouts in latex and docbook.
+
+Input stdlists.inc
+
+
+Style Itemize
+       LatexType             Item_Environment
+       LatexName             lst
+       Latexparam            "type=&quot;bulleted&quot;"
+       ItemTag               item
+End
+
+
+Style Enumerate
+       LatexType             Item_Environment
+       LatexName             lst
+       Latexparam            "type=&quot;ordered&quot;"
+       ItemTag               item
+End
+
+
+Style Description
+       LatexType             Item_environment
+       LatexName             lst
+       Latexparam            "type=&quot;unordered&quot;"
+       ItemTag               item
+End
+
+# maybe List is the same as simplelist (I need to check it).
+NoStyle List
+
diff --git a/lib/layouts/agu_stdsections.inc b/lib/layouts/agu_stdsections.inc
new file mode 100644 (file)
index 0000000..616d1f5
--- /dev/null
@@ -0,0 +1,86 @@
+# Textclass definition file for docbook.
+# Author : José Abílio Oliveira Matos <jamatos@lyx.org>
+#          Martin Vermeer <martin.vermeer@hut.fi>
+
+# This file is the counterpart of stdsections.inc
+# It is desirable, as far as possible, to have the same look and feel for
+# related layouts in latex and docbook.
+
+Input stdsections.inc
+
+Style Part
+       LatexType             Command
+       LatexName             part
+       InnerTag              head
+       LabelTag              label
+       CommandDepth          0
+End
+
+
+Style Chapter
+       LatexType             Command
+       LatexName             chapter
+       InnerTag              head
+       LabelTag              label
+       CommandDepth          1
+End
+
+
+Style Section
+       LatexType             Command
+       LatexName             section
+       InnerTag              head
+       LabelTag              label
+       CommandDepth          2
+       LatexParam            "s#"
+End
+
+
+Style Subsection
+       LatexType             Command
+       LatexName             subsect1
+       InnerTag              head
+       LabelTag              label
+       CommandDepth          3
+       LatexParam            "s#"
+End
+
+
+Style Subsubsection
+       LatexType             Command
+       LatexName             subsect2
+       InnerTag              head
+       LabelTag              label
+       CommandDepth          4
+       LatexParam            "s#"
+End
+
+
+Style Paragraph
+       LatexType             Command
+       LatexName             subsect3
+       InnerTag              head
+       LabelTag              label
+       CommandDepth          5
+       LatexParam            "s#"
+End
+
+
+Style Subparagraph
+       LatexType             Command
+       LatexName             subsect4
+       InnerTag              head
+       LabelTag              label
+       CommandDepth          6
+       LatexParam            "s#"
+End
+
+Style Subsubparagraph
+       LatexType             Command
+       LatexName             subsect5
+       InnerTag              head
+       LabelTag              label
+       CommandDepth          7
+       LatexParam            "s#"
+End
+
index 36c01a2e344a0c0b5585119039b4e17c8b8eda78..09e0a0c0c344327b99ec490d468bbd233e0f69b3 100644 (file)
@@ -2,7 +2,7 @@
 # Author : José Abílio Oliveira Matos <jamatos@lyx.org>
 
 # This is the counterpart of lyxmacros.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 lyxmacros.inc
@@ -11,7 +11,7 @@ Style Code
        CopyStyle             LyX-Code
        LatexType             Environment
        LatexName             programlisting
-       LatexParam            CDATA
+       InnerTag              CDATA
        PassThru              1
 End
 
index 154875cde8e0043106096d70d5a9b89c3891652d..845207050ead8bf4afd5f85b3bec4fd621c0123f 100644 (file)
@@ -2,7 +2,7 @@
 # Author : José Abílio Oliveira Matos <jamatos@lyx.org>
 
 # This file is the counterpart of stdclass.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.
 
 OutputType              docbook
@@ -38,7 +38,7 @@ CharStyle Filename
        EndFont
 End
 
-CharStyle FirstName
+CharStyle Firstname
        LatexType             Command
        LatexName             firstname
        Font
index 03fa96ce91112bc196d7aa653c3584d1825e7a17..ea6f2b8a80f49172fc3464f1a12814ff10d73bfe 100644 (file)
@@ -2,7 +2,7 @@
 # Author : José Abílio Oliveira Matos <jamatos@lyx.org>
 
 # This is the counterpart of stdlayouts.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 stdlayouts.inc
@@ -34,7 +34,7 @@ End
 Style Quotation
        LatexType             Environment
        LatexName             blockquote
-       LatexParam            para
+       InnerTag              para
 End
 
 # Quote should be an inline element
index 73340768fac6e15130590dadabc078b3cffecccf..739b1d265144004909cbb4e2171effe2f2e71ce3 100644 (file)
@@ -2,7 +2,7 @@
 # Author : José Abílio Oliveira Matos <jamatos@lyx.org>
 
 # This is the counterpart of stdlists.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 stdlists.inc
@@ -11,18 +11,23 @@ Input stdlists.inc
 Style Itemize
        LatexType             Item_Environment
        LatexName             itemizedlist
+       ItemTag               listitem
 End
 
 
 Style Enumerate
        LatexType             Item_Environment
        LatexName             orderedlist
+       ItemTag               listitem
 End
 
 
 Style Description
        LatexType             Item_environment
        LatexName             variablelist
+       InnerTag              varlistentry
+       LabelTag              term
+       ItemTag               listitem
 End
 
 # maybe List is the same as simplelist (I need to check it).
index b84ddb645b4ce11d788e9cdbac7467bbcff0e43a..27d96880b955482b527601729505607ba60a8a9c 100644 (file)
@@ -2,7 +2,7 @@
 # Author : José Abílio Oliveira Matos <jamatos@lyx.org>
 
 # This file is the counterpart of stdstarsections.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.
 
 # empty for now, it is possible to do it using bridgehead with attribute
index d30e3bef30ae78e55d3091370ae1489a6ccf5dfd..7a1d7e33b440ffc097c73afeaf231216b73e5990 100644 (file)
@@ -2,7 +2,7 @@
 # Author : José Abílio Oliveira Matos <jamatos@lyx.org>
 
 # This file is the counterpart of stdstruct.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 stdstruct.inc
@@ -10,7 +10,7 @@ Input stdstruct.inc
 Style Abstract
        LatexType             Environment
        LatexName             abstract
-       LatexParam            para
+       InnerTag              para
 End
 
 NoStyle Bibliography
index e1025fa254a9dd4cba65ffc0a244c0920f4231cb..97067bf6455a1c98dd6f467c1c3ba570bb446765 100644 (file)
@@ -13,7 +13,7 @@ Style Title
        LatexType             Command
        LatexName             articleinfo
        CommandDepth          2
-       InnerTag              "title"
+       InnerTag              title
 End
 
 
@@ -28,7 +28,7 @@ Style Authorgroup
        CopyStyle             Author
        LatexType             Environment
        LatexName             authorgroup
-       LatexParam            author
+       InnerTag              author
 End
 
 
@@ -68,7 +68,8 @@ Style RevisionHistory
        Margin                Static
        LatexType             Command
        LatexName             revhistory
-       LatexParam            "3|!-- --"
+       CommandDepth          3
+       InnerTag              "!-- --"
        LeftMargin            MMM
        RightMargin           MMM
        ParIndent             MM
@@ -88,7 +89,8 @@ Style Revision
        Margin                Dynamic
        LatexType             Command
        LatexName             revision
-       LatexParam            "4|revnumber"
+       CommandDepth          4
+       InnerTag              revnumber
        LabelSep              xxx
        ParSkip               0.4
        TopSep                0.9
index bc34131e45c254bd1d961804160611a6ec9abc96..66f673b800d8d496924dadaf7cba41b5ece7f5c0 100644 (file)
@@ -11,5 +11,5 @@ Input report
 Style Title
        LatexType             Command
        LatexName             bookinfo
-       LatexParam            "1|"
+       CommandDepth          1
 End
index 00dd927b3a1c85c25b53485ee13bf02079e2fa2f..7c9c98915eb0a055eaccd1e5fcb0bf9f827c5709 100644 (file)
@@ -10,7 +10,7 @@ Input stnumarticle.inc
 Style Title
        LatexType             Command
        LatexName             "!-- --"
-       LatexParam            "2|"
+       CommandDepth          2
 End
 
 
index af744bf6979390a4eae4cca6f1ac46b7c90864bb..3c84684a7aefc8adebb4c56b3a8f07c26650b684 100644 (file)
@@ -10,7 +10,7 @@ Input numarticle.inc
 Style Title
        LatexType             Command
        LatexName             "!-- --"
-       LatexParam            "3|"
+       CommandDepth          3
 End
 
 
index 8e9465f0b427d3c118667dd97176a6c9acb8a53e..100fb7b37a635e540a94b106712e302587b8619e 100644 (file)
@@ -1,4 +1,19 @@
 
+2003-11-25  Martin Vermeer  <martin.vermeer@hut.fi>
+
+       * src/buffer.C:
+       * src/lyxlayout.C:
+       * src/lyxlayout.h:
+       * src/lyxtext.h:
+       * src/output_docbook.C:
+       * src/output_latex.C:
+       * src/paragraph.C:
+       * src/paragraph.h:
+       * src/sgml.C:
+       * src/sgml.h:
+       * src/text2.C: Introducing a number of tags parametrizing various
+       XML formats that we may want to support
+
 2003-11-25  André Pönitz  <poenitz@gmx.net>
 
        * InsetList.[Ch] (begein, end): inline as suggested by profiler
index 2cc84449377e59820af902e1ba9c5f19b8e67cb9..ce10f735432be8abe1ecbaf78612e02074510c01 100644 (file)
@@ -16,6 +16,7 @@
 #include "buffer_funcs.h"
 #include "bufferlist.h"
 #include "bufferparams.h"
+#include "counters.h"
 #include "Bullet.h"
 #include "Chktex.h"
 #include "debug.h"
@@ -1148,6 +1149,7 @@ void Buffer::makeDocBookFile(string const & fname,
        ofs << "<!-- DocBook file was created by LyX " << lyx_version
            << "\n  See http://www.lyx.org/ for more information -->\n";
 
+       params().getLyXTextClass().counters().reset();
        docbookParagraphs(*this, paragraphs(), ofs, runparams);
 
        ofs << "\n\n";
index 79c506831ca6b9df45885444698c42160dc8af7e..4067415a567d32e60d50090222d6b6c19291c406 100644 (file)
@@ -82,6 +82,8 @@ enum LayoutTags {
        LT_TOPSEP,
        LT_TOCLEVEL,
        LT_INNERTAG,
+       LT_LABELTAG,
+       LT_ITEMTAG,
        LT_INTITLE // keep this last!
 };
 
@@ -145,6 +147,7 @@ bool LyXLayout::Read(LyXLex & lexrc, LyXTextClass const & tclass)
                { "innertag",       LT_INNERTAG },
                { "intitle",        LT_INTITLE },
                { "itemsep",        LT_ITEMSEP },
+               { "itemtag",        LT_ITEMTAG },
                { "keepempty",      LT_KEEPEMPTY },
                { "labelbottomsep", LT_LABEL_BOTTOMSEP },
                { "labelcounter",   LT_LABELCOUNTER },
@@ -153,6 +156,7 @@ bool LyXLayout::Read(LyXLex & lexrc, LyXTextClass const & tclass)
                { "labelsep",       LT_LABELSEP },
                { "labelstring",    LT_LABELSTRING },
                { "labelstringappendix", LT_LABELSTRING_APPENDIX },
+               { "labeltag",       LT_LABELTAG },
                { "labeltype",      LT_LABELTYPE },
                { "latexfooter",    LT_LATEXFOOTER },
                { "latexheader",    LT_LATEXHEADER },
@@ -331,7 +335,7 @@ bool LyXLayout::Read(LyXLex & lexrc, LyXTextClass const & tclass)
 
                case LT_LATEXPARAM:
                        if (lexrc.next())
-                               latexparam_ = lexrc.getString();
+                               latexparam_ = subst(lexrc.getString(), "&quot;", "\"");
                        break;
 
                case LT_INNERTAG:
@@ -339,6 +343,16 @@ bool LyXLayout::Read(LyXLex & lexrc, LyXTextClass const & tclass)
                                innertag_ = lexrc.getString();
                        break;
 
+               case LT_LABELTAG:
+                       if (lexrc.next())
+                               labeltag_ = lexrc.getString();
+                       break;
+
+               case LT_ITEMTAG:
+                       if (lexrc.next())
+                               itemtag_ = lexrc.getString();
+                       break;
+
                case LT_PREAMBLE:
                        preamble_ = lexrc.getLongString("EndPreamble");
                        break;
index 772d9aeca45e110dc8135b20573c8ed30f4215f2..25452e7a0f37957f8d0a46fa70949af0c60a97e3 100644 (file)
@@ -65,6 +65,10 @@ public:
        ///
        std::string const & innertag() const { return innertag_; }
        ///
+       std::string const & labeltag() const { return labeltag_; }
+       ///
+       std::string const & itemtag() const { return itemtag_; }
+       ///
        std::string const & labelstring_appendix() const {
                return labelstring_appendix_;
        }
@@ -211,6 +215,10 @@ private:
        std::string latexparam_;
        /// Internal tag to use (e.g., <title></title> for sect header)
        std::string innertag_;
+       /// Internal tag to use e.g. to surround varlistentry label)
+       std::string labeltag_;
+       /// Internal tag to surround the item text in a list)
+       std::string itemtag_;
        /// Macro definitions needed for this layout
        std::string preamble_;
 };
index 8af10531b39349b7e1f1b68a1c9a0469ccc21d3d..ba8329128fc57ca9e891c991864d371e0bbe282d 100644 (file)
@@ -18,6 +18,7 @@
 #include "Bidi.h"
 #include "layout.h"
 #include "lyxfont.h"
+#include "lyxtextclass.h"
 #include "ParagraphList_fwd.h"
 #include "RowList_fwd.h"
 #include "textcursor.h"
@@ -478,4 +479,8 @@ private:
 /// return the default height of a row in pixels, considering font zoom
 extern int defaultRowHeight();
 
+///
+std::string expandLabel(LyXTextClass const & textclass,
+               LyXLayout_ptr const & layout, bool appendix);
+
 #endif // LYXTEXT_H
index 047b6a0300497bc7bcb37931a4ac344c42bf5d3a..8602b672830d0a4b7ba59c5978b541ef2c71225b 100644 (file)
@@ -15,6 +15,8 @@
 
 #include "buffer.h"
 #include "bufferparams.h"
+#include "counters.h"
+#include "lyxtext.h"
 #include "paragraph.h"
 #include "paragraph_funcs.h"
 #include "ParagraphParameters.h"
@@ -24,6 +26,7 @@
 
 #include "support/lstrings.h"
 #include "support/lyxlib.h"
+#include "support/tostr.h"
 
 #include <stack>
 
@@ -32,6 +35,7 @@
 
 using lyx::support::atoi;
 using lyx::support::split;
+using lyx::support::subst;
 
 using std::endl;
 using std::ostream;
@@ -57,20 +61,21 @@ void docbookParagraphs(Buffer const & buf,
 
        string command_name;
 
+       string item_tag;
+
        ParagraphList::iterator par = const_cast<ParagraphList&>(paragraphs).begin();
        ParagraphList::iterator pend = const_cast<ParagraphList&>(paragraphs).end();
 
+    Counters & counters = buf.params().getLyXTextClass().counters();
+       
        for (; par != pend; ++par) {
-               string inner_tag;
-               int desc_on = 0; // description mode
 
                LyXLayout_ptr const & style = par->layout();
 
                // environment tag closing
                for (; depth > par->params().depth(); --depth) {
-                       if (!environment_inner[depth].empty()) 
                        sgml::closeEnvTags(os, false, environment_inner[depth], 
-                                       command_depth + depth);
+                               item_tag, command_depth + depth);
                        sgml::closeTag(os, depth + command_depth, false, environment_stack[depth]);
                        environment_stack[depth].erase();
                        environment_inner[depth].erase();
@@ -80,19 +85,25 @@ void docbookParagraphs(Buffer const & buf,
                   && environment_stack[depth] != style->latexname()
                   && !environment_stack[depth].empty()) {
                                sgml::closeEnvTags(os, false, environment_inner[depth], 
-                                       command_depth + depth);
+                                       item_tag, command_depth + depth);
                        sgml::closeTag(os, depth + command_depth, false, environment_stack[depth]);
 
                        environment_stack[depth].erase();
                        environment_inner[depth].erase();
                }
-
+               
+               string ls = "";
+               bool labelid = false;
                // Write opening SGML tags.
-               string item_name;
                switch (style->latextype) {
                case LATEX_PARAGRAPH:
+                       if (!style->latexparam().empty()) {
+                               counters.step("para");
+                               int i = counters.value("para");
+                               ls = "id=\"" + subst(style->latexparam(), "#", tostr(i)) + '"';
+                       }
                        sgml::openTag(os, depth + command_depth,
-                                   false, style->latexname());
+                                   false, style->latexname(), ls);
                        break;
 
                case LATEX_COMMAND:
@@ -103,7 +114,6 @@ void docbookParagraphs(Buffer const & buf,
                        command_name = style->latexname();
 
                        cmd_depth = style->commanddepth;
-                       inner_tag = style->innertag();
                        
                        if (command_flag) {
                                if (cmd_depth < command_base) {
@@ -130,6 +140,9 @@ void docbookParagraphs(Buffer const & buf,
                                command_stack.push_back(string());
                        command_stack[command_depth] = command_name;
 
+                       if (!style->latexparam().empty()) {
+                               counters.step(style->counter);
+                       }
                        // treat label as a special case for
                        // more WYSIWYM handling.
                        // This is a hack while paragraphs can't have
@@ -141,13 +154,29 @@ void docbookParagraphs(Buffer const & buf,
                                        command_name += " id=\"";
                                        command_name += (static_cast<InsetCommand *>(inset))->getContents();
                                        command_name += '"';
-                                       desc_on = 3;
+                                       labelid = true;
+                               }
+                       } else {
+                               if (!style->latexparam().empty()) {
+                                       ls = expandLabel(buf.params().getLyXTextClass(), style, false);
+                                       ls = "id=\"" + subst(style->latexparam(), "#", ls) + '"';
                                }
                        }
+                       
+                       sgml::openTag(os, depth + command_depth, false, command_name, ls);
+
+                       // Label around sectioning number:
+                       if (!style->labeltag().empty()) {
+                               sgml::openTag(os, depth + 1 + command_depth, false, 
+                                       style->labeltag());
+                               os << expandLabel(buf.params().getLyXTextClass(), style, false);
+                               sgml::closeTag(os, depth + 1 + command_depth, false, 
+                                       style->labeltag());
+                       }
 
-                       sgml::openTag(os, depth + command_depth, false, command_name);
                        // Inner tagged header text, e.g. <title> for sectioning:
-                       sgml::openTag(os, depth + 1 + command_depth, false, inner_tag);
+                       sgml::openTag(os, depth + 1 + command_depth, false, 
+                               style->innertag());
                        break;
 
                case LATEX_ENVIRONMENT:
@@ -164,31 +193,30 @@ void docbookParagraphs(Buffer const & buf,
                                }
                                environment_stack[depth] = style->latexname();
                                environment_inner[depth] = "!-- --";
-                               sgml::openTag(os, depth + command_depth, false, environment_stack[depth]);
+                               // outputs <environment_stack[depth] latexparam()>
+                               sgml::openTag(os, depth + command_depth, false, 
+                                               environment_stack[depth], style->latexparam());
                        } else {
-                                       sgml::closeEnvTags(os, false, environment_inner[depth], 
-                                               command_depth + depth);
+                               sgml::closeEnvTags(os, false, environment_inner[depth], 
+                                       style->itemtag(), command_depth + depth);
                        }
 
                        if (style->latextype == LATEX_ENVIRONMENT) {
-                               if (!style->latexparam().empty()) {
-                                       if (style->latexparam() == "CDATA")
+                               if (!style->innertag().empty()) {
+                                       if (style->innertag() == "CDATA")
                                                os << "<![CDATA[";
                                        else
-                                               sgml::openTag(os, depth + command_depth, false, style->latexparam());
+                                               sgml::openTag(os, depth + command_depth, false, 
+                                                       style->innertag());
                                }
                                break;
                        }
 
-                       desc_on = (style->labeltype == LABEL_MANUAL);
+                       environment_inner[depth] = style->innertag();
 
-                       environment_inner[depth] = desc_on ? "varlistentry" : "listitem";
-                       sgml::openTag(os, depth + 1 + command_depth,
+                       if (!environment_inner[depth].empty())
+                               sgml::openTag(os, depth + 1 + command_depth,
                                    false, environment_inner[depth]);
-
-                       item_name = desc_on ? "term" : "para";
-                       sgml::openTag(os, depth + 1 + command_depth,
-                                   false, item_name);
                        break;
                default:
                        sgml::openTag(os, depth + command_depth,
@@ -196,27 +224,26 @@ void docbookParagraphs(Buffer const & buf,
                        break;
                }
 
-               par->simpleDocBookOnePar(buf, os, outerFont(par, paragraphs), desc_on,
-                                        runparams, depth + 1 + command_depth);
+               par->simpleDocBookOnePar(buf, os, outerFont(par, paragraphs),
+                                        runparams, depth + 1 + command_depth, labelid);
 
-               string end_tag;
                // write closing SGML tags
                switch (style->latextype) {
                case LATEX_COMMAND:
-                       sgml::closeTag(os, depth + command_depth, false, inner_tag);
+                       sgml::closeTag(os, depth + command_depth, false, 
+                               style->innertag());
                        break;
                case LATEX_ENVIRONMENT:
-                       if (!style->latexparam().empty()) {
-                               if (style->latexparam() == "CDATA")
+                       if (!style->innertag().empty()) {
+                               if (style->innertag() == "CDATA")
                                        os << "]]>";
                                else
-                                       sgml::closeTag(os, depth + command_depth, false, style->latexparam());
+                                       sgml::closeTag(os, depth + command_depth, false, 
+                                               style->innertag());
                        }
                        break;
                case LATEX_ITEM_ENVIRONMENT:
-                       if (desc_on == 1) break;
-                       end_tag = "para";
-                       sgml::closeTag(os, depth + 1 + command_depth, false, end_tag);
+                       item_tag = style->itemtag();
                        break;
                case LATEX_PARAGRAPH:
                        sgml::closeTag(os, depth + command_depth, false, style->latexname());
@@ -231,7 +258,7 @@ void docbookParagraphs(Buffer const & buf,
        for (int d = depth; d >= 0; --d) {
                if (!environment_stack[depth].empty()) {
                                sgml::closeEnvTags(os, false, environment_inner[depth], 
-                                       command_depth + depth);
+                                       item_tag, command_depth + depth);
                }
        }
 
index 3b6b3449bfe036348d1f87e605dbce55f876e1ea..62807cf5aa1d3c55bd32cd8eb1898b39c7b58ad0 100644 (file)
@@ -131,20 +131,14 @@ TeXEnvironment(Buffer const & buf,
        }
 
        if (style->isEnvironment()) {
+               os << "\\begin{" << style->latexname() << '}';
                if (style->latextype == LATEX_LIST_ENVIRONMENT) {
-                       os << "\\begin{" << style->latexname() << "}{"
-                          << pit->params().labelWidthString() << "}\n";
+                       os << "{" << pit->params().labelWidthString() << "}\n";
                } else if (style->labeltype == LABEL_BIBLIO) {
                        // ale970405
-                       os << "\\begin{" << style->latexname() << "}{"
-                          <<  bibitemWidest(buf)
-                          << "}\n";
-               } else if (style->latextype == LATEX_ITEM_ENVIRONMENT) {
-                       os << "\\begin{" << style->latexname() << '}'
-                          << style->latexparam() << '\n';
+                       os << "{" <<  bibitemWidest(buf) << "}\n";
                } else
-                       os << "\\begin{" << style->latexname() << '}'
-                          << style->latexparam() << '\n';
+                       os << style->latexparam() << '\n';
                texrow.newline();
        }
        ParagraphList::iterator par = pit;
index 35101a0327db470d3a223816a7db97c67653d8cd..0a5efb303a036315482a638f37230476471c96ff 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "buffer.h"
 #include "bufferparams.h"
+#include "counters.h"
 #include "encoding.h"
 #include "debug.h"
 #include "gettext.h"
@@ -39,8 +40,9 @@
 #include "insets/insetoptarg.h"
 
 #include "support/lstrings.h"
-#include "support/textutils.h"
 #include "support/std_sstream.h"
+#include "support/textutils.h"
+#include "support/tostr.h"
 
 #include <boost/tuple/tuple.hpp>
 
@@ -1329,19 +1331,43 @@ void Paragraph::simpleLinuxDocOnePar(Buffer const & buf,
 void Paragraph::simpleDocBookOnePar(Buffer const & buf,
                                    ostream & os,
                                    LyXFont const & outerfont,
-                                   int & desc_on,
                                    OutputParams const & runparams,
-                                   lyx::depth_type depth) const
+                                   lyx::depth_type depth,
+                                   bool labelid) const
 {
        bool emph_flag = false;
 
        LyXLayout_ptr const & style = layout();
+       LyXLayout_ptr const & defaultstyle 
+               = buf.params().getLyXTextClass().defaultLayout();
 
        LyXFont font_old = (style->labeltype == LABEL_MANUAL ? style->labelfont : style->font);
 
        int char_line_count = depth;
-       //if (!style.free_spacing)
-       //      os << string(depth,' ');
+       bool label_closed = true;
+       bool para_closed = true;
+       
+       if (style->latextype == LATEX_ITEM_ENVIRONMENT) {
+               string ls = "";
+               Counters & counters = buf.params().getLyXTextClass().counters();
+               if (!style->free_spacing)
+                       os << string(depth,' ');
+               if (!style->labeltag().empty()) {
+                       os << "<" << style->labeltag() << ">\n";
+                       label_closed = false;
+               } else {
+                       if (!defaultstyle->latexparam().empty()) {
+                               counters.step("para");
+                               ls = tostr(counters.value("para"));
+                               ls = " id=\"" 
+                                       + subst(defaultstyle->latexparam(), "#", ls) + '"';
+                       }
+                       os << "<" << style->itemtag() << ">\n" 
+                          << string(depth, ' ') << "<" 
+                          << defaultstyle->latexname() << ls << ">\n";
+                       para_closed = false;
+               }
+       }
 
        // parsing main loop
        for (pos_type i = 0; i < size(); ++i) {
@@ -1370,7 +1396,8 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
                if (isInset(i)) {
                        InsetOld const * inset = getInset(i);
                        // don't print the inset in position 0 if desc_on == 3 (label)
-                       if (i || desc_on != 3) {
+                       //if (i || desc_on != 3) {
+                       if (!labelid) {
                                if (style->latexparam() == "CDATA")
                                        os << "]]>";
                                inset->docbook(buf, os, runparams);
@@ -1387,10 +1414,13 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
                                os << c;
                        } else if (isFreeSpacing() || c != ' ') {
                                        os << str;
-                       } else if (desc_on == 1) {
+                       } else if (!style->labeltag().empty() && !label_closed) {
                                ++char_line_count;
-                               os << "\n</term><listitem><para>";
-                               desc_on = 2;
+                               os << "\n</" << style->labeltag() << "><" 
+                                  << style->itemtag() << "><" 
+                                  << defaultstyle->latexname() << ">";
+                               label_closed = true;
+                               para_closed = false;
                        } else {
                                os << ' ';
                        }
@@ -1407,9 +1437,15 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
        }
 
        // resets description flag correctly
-       if (desc_on == 1) {
+       if (!label_closed) {
                // <term> not closed...
-               os << "</term>\n<listitem><para>&nbsp;</para>";
+               os << "</" << style->labeltag() << ">\n<" 
+                  << style->itemtag() << "><" 
+                  << defaultstyle->latexname() << ">&nbsp;";
+       }
+       if (!para_closed) {
+               os << "\n" << string(depth, ' ') << "</" 
+                  << defaultstyle->latexname() << ">\n";
        }
        if (style->free_spacing)
                os << '\n';
index 6d92ad9c524a47e7a8f12994506e1551821b11ac..fca8d25163e77b0d775ab233b87ce0395473dde2 100644 (file)
@@ -129,9 +129,9 @@ public:
        void simpleDocBookOnePar(Buffer const & buf,
                                 std::ostream &,
                                 LyXFont const & outerfont,
-                                int & desc_on,
                                 OutputParams const & runparams,
-                                lyx::depth_type depth) const;
+                                lyx::depth_type depth,
+                                bool labelid) const;
 
        ///
        bool hasSameLayout(Paragraph const & par) const;
index bd1734976012946068d6ad7b3acb49a293bf7ca4..7ebaf187a694782a4d7f21052c1fc83b7372b79a 100644 (file)
@@ -85,12 +85,16 @@ pair<bool, string> escapeChar(char c)
 
 
 int openTag(ostream & os, Paragraph::depth_type depth,
-           bool mixcont, string const & latexname)
+           bool mixcont, string const & latexname,
+               string const & latexparam)
 {
        if (!latexname.empty() && latexname != "!-- --") {
                if (!mixcont)
                        os << string(depth, ' ');
-               os << '<' << latexname << '>';
+               os << '<' << latexname;
+               if (!latexparam.empty())
+                       os << " " << latexparam;
+               os << '>';
        }
 
        if (!mixcont)
@@ -118,13 +122,13 @@ int closeTag(ostream & os, Paragraph::depth_type depth,
 
 unsigned int closeEnvTags(ostream & os, bool mixcont,
                        string const & environment_inner_depth,
+                       string const & itemtag,
                        lyx::depth_type total_depth)
 {
        unsigned int lines = 0;
        if (environment_inner_depth != "!-- --") {
-               string item_name= "listitem";
-               lines += closeTag(os, total_depth, mixcont, item_name);
-               if (environment_inner_depth == "varlistentry")
+               lines += closeTag(os, total_depth, mixcont, itemtag);
+               if (!environment_inner_depth.empty())
                        lines += closeTag(os, total_depth, mixcont,
                                environment_inner_depth);
        }
index 9abc8861335d04cce177a330d697fb7041173207..d247402f44fdc5ce46a628ee73730c8b343ba70f 100644 (file)
@@ -29,7 +29,8 @@ std::pair<bool, std::string> escapeChar(char c);
 
 /// FIXME
 int openTag(std::ostream & os, lyx::depth_type depth,
-           bool mixcont, std::string const & latexname);
+           bool mixcont, std::string const & latexname,
+               std::string const & latexparam = std::string());
 
 /// FIXME
 int closeTag(std::ostream & os, lyx::depth_type depth,
@@ -39,6 +40,7 @@ int closeTag(std::ostream & os, lyx::depth_type depth,
 unsigned int closeEnvTags(std::ostream & os, 
                bool mixcont,
                std::string const & environment_inner_depth,
+               std::string const & item_tag,
                lyx::depth_type total_depth);
 
 }
index 4414a28977dd2388c48cb4a362bf6799b1a5d957..73d96266eecdc224a1e5295d5fa2298f1ef3b7e9 100644 (file)
@@ -724,8 +724,6 @@ void LyXText::setParagraph(
 }
 
 
-namespace {
-
 string expandLabel(LyXTextClass const & textclass,
        LyXLayout_ptr const & layout, bool appendix)
 {
@@ -748,6 +746,8 @@ string expandLabel(LyXTextClass const & textclass,
 }
 
 
+namespace {
+
 void incrementItemDepth(ParagraphList::iterator pit,
                        ParagraphList::iterator first_pit)
 {