]> git.lyx.org Git - lyx.git/commitdiff
Fix a bug. Cosmetics.
authorRichard Heck <rgheck@comcast.net>
Sat, 6 Jun 2009 03:32:55 +0000 (03:32 +0000)
committerRichard Heck <rgheck@comcast.net>
Sat, 6 Jun 2009 03:32:55 +0000 (03:32 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29983 a592a061-630c-0410-9148-cb99ea01b6c8

src/Layout.cpp
src/Layout.h
src/output_xhtml.cpp

index 7b7bc52670a366c066d644791892474290eb14e2..85af8a73fd29b2fcc8a96198f64ee41cb55d2f62 100644 (file)
@@ -98,6 +98,7 @@ enum LayoutTags {
        LT_HTMLITEMATTR,
        LT_HTMLLABEL,
        LT_HTMLLABELATTR, 
+       LT_HTMLLABELFIRST,
        LT_HTMLPREAMBLE,
        LT_HTMLSTYLE,
        LT_INTITLE // keep this last!
@@ -165,6 +166,7 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
                { "htmlitemattr",   LT_HTMLITEMATTR },
                { "htmllabel",      LT_HTMLLABEL },
                { "htmllabelattr",  LT_HTMLLABELATTR },
+               { "htmllabelfirst", LT_HTMLLABELFIRST },
                { "htmlpremable",   LT_HTMLPREAMBLE },
                { "htmlstyle",      LT_HTMLSTYLE },
                { "htmltag",        LT_HTMLTAG },
@@ -503,6 +505,10 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
                        lex >> htmllabelattr_;
                        break;
 
+               case LT_HTMLLABELFIRST:
+                       lex >> htmllabelfirst_;
+                       break;
+                       
                case LT_HTMLSTYLE:
                        htmlstyle_ = from_utf8(lex.getLongString("EndHTMLStyle"));
                        break;
index e41c3069e5fc3ce7128efa233ef798bac8a2a92c..aeca0f4f83ae7c9b6a84b672704d0aefb61a0fe2 100644 (file)
@@ -120,6 +120,8 @@ public:
        std::string const & htmllabel() const { return htmllabel_; }
        /// 
        std::string const & htmllabelattr() const { return htmllabelattr_; }
+       ///
+       bool htmllabelfirst() const { return htmllabelfirst_; }
        /// 
        docstring const & htmlstyle() const { return htmlstyle_; }
        /// 
@@ -306,6 +308,13 @@ private:
        std::string htmllabel_;
        /// Attributes for the label.
        std::string htmllabelattr_;
+       /// Whether to put the label before the item, or within the item.
+       /// I.e., do we have (true):
+       ///    <label>...</label><item>...</item>
+       /// or instead (false):
+       ///    <item><label>...</label>...</item>
+       /// The latter is the default.
+       bool htmllabelfirst_;
        /// CSS information needed by this layout.
        docstring htmlstyle_;
        /// Any other info for the HTML header.
index 77ecb834cb7f5c229fd1aa815c658d13c4454c89..3e212ae9452c911f78fb5b30806b471565f2ba78 100644 (file)
@@ -196,6 +196,8 @@ ParagraphList::const_iterator makeParagraphs(Buffer const & buf,
                Layout const & lay = par->layout();
                if (!lay.counter.empty())
                        buf.params().documentClass().counters().step(lay.counter);
+               // FIXME We should see if there's a label to be output and
+               // do something with it.
                if (par != pbegin)
                        os << '\n';
                bool const opened = openTag(os, lay);
@@ -209,14 +211,14 @@ ParagraphList::const_iterator makeParagraphs(Buffer const & buf,
        return pend;
 }
 
+
 ParagraphList::const_iterator makeEnvironment(Buffer const & buf,
                                              odocstream & os,
                                              OutputParams const & runparams,
                                              ParagraphList const & paragraphs,
                                              ParagraphList::const_iterator const & pbegin,
-                                             ParagraphList::const_iterator const & pend) {
-       
+                                             ParagraphList::const_iterator const & pend) 
+{
        ParagraphList::const_iterator par = pbegin;
        Layout const & bstyle = par->layout();
        depth_type const origdepth = pbegin->params().depth();
@@ -241,7 +243,6 @@ ParagraphList::const_iterator makeEnvironment(Buffer const & buf,
                case LATEX_ENVIRONMENT:
                case LATEX_LIST_ENVIRONMENT:
                case LATEX_ITEM_ENVIRONMENT: {
-                       // FIXME Factor this out.
                        // There are two possiblities in this case. 
                        // One is that we are still in the environment in which we 
                        // started---which we will be if the depth is the same.
@@ -272,22 +273,23 @@ ParagraphList::const_iterator makeEnvironment(Buffer const & buf,
                                par->simpleLyXHTMLOnePar(buf, os, runparams, 
                                        outerFont(distance(paragraphs.begin(), par), paragraphs), sep);
                                ++par;
-                               // We may not want to close the tag yet, in particular,
-                               if (item_tag_opened 
-                                               // if we're not at the end...
-                                   && par != pend 
+                               if (item_tag_opened) {
+                                       // We may not want to close the tag yet, in particular,
+                                       // if we're not at the end...
+                                       if (par != pend 
                                    //  and are doing items...
-                                   && style.latextype == LATEX_ITEM_ENVIRONMENT
-                                   // and if the depth has changed...
-                                   && par->params().depth() != origdepth) {
-                                               // then we'll save this layout for later, and close it when
-                                               // we get another item.
+                                    && style.latextype == LATEX_ITEM_ENVIRONMENT
+                                    // and if the depth has changed...
+                                    && par->params().depth() != origdepth) {
+                                    // then we'll save this layout for later, and close it when
+                                    // we get another item.
                                                lastlay = &cstyle;
-                               } else {
-                                               closeItemTag(os, cstyle); // FIXME
+                                       } else {
+                                               closeItemTag(os, cstyle);
+                                       }
                                        os << '\n';
                                }
-                       } 
+                       }
                        // The other possibility is that the depth has increased, in which
                        // case we need to recurse.
                        else {