]> git.lyx.org Git - lyx.git/blobdiff - src/output_docbook.C
more cursor dispatch
[lyx.git] / src / output_docbook.C
index cc8e8d670ab93fb1dc5f784ec2a5f8213cecbc47..c57bb0d32127c754a9ec7d7f5b695a3cafde0be0 100644 (file)
@@ -16,6 +16,7 @@
 #include "buffer.h"
 #include "bufferparams.h"
 #include "counters.h"
+#include "debug.h"
 #include "lyxtext.h"
 #include "paragraph.h"
 #include "paragraph_funcs.h"
@@ -100,7 +101,7 @@ void docbookParagraphs(Buffer const & buf,
                        if (!style->latexparam().empty()) {
                                counters.step("para");
                                int i = counters.value("para");
-                               ls = "id=\"" + subst(style->latexparam(), "#", tostr(i)) + '"';
+                               ls = subst(style->latexparam(), "#", tostr(i));
                        }
                        sgml::openTag(os, depth + command_depth,
                                    false, style->latexname(), ls);
@@ -140,7 +141,7 @@ void docbookParagraphs(Buffer const & buf,
                                command_stack.push_back(string());
                        command_stack[command_depth] = command_name;
 
-                       if (!style->latexparam().empty()) {
+                       if (style->latexparam().find('#') != string::npos) {
                                counters.step(style->counter);
                        }
                        // treat label as a special case for
@@ -148,19 +149,21 @@ void docbookParagraphs(Buffer const & buf,
                        // This is a hack while paragraphs can't have
                        // attributes, like id in this case.
                        if (par->size() && par->isInset(0)) {
-                               InsetOld * inset = par->getInset(0);
-                               InsetOld::Code lyx_code = inset->lyxCode();
-                               if (lyx_code == InsetOld::LABEL_CODE) {
+                               InsetBase * inset = par->getInset(0);
+                               if (inset->lyxCode() == InsetOld::LABEL_CODE) {
                                        command_name += " id=\"";
                                        command_name += (static_cast<InsetCommand *>(inset))->getContents();
                                        command_name += '"';
                                        labelid = true;
                                }
-                       } else {
-                               if (!style->latexparam().empty()) {
-                                       ls = expandLabel(buf.params().getLyXTextClass(), style, false);
-                                       ls = "id=\"" + subst(style->latexparam(), "#", ls) + '"';
-                               }
+                       }
+                       if (!labelid && !style->latexparam().empty()) {
+                               ls = style->latexparam();
+                               if (ls.find('#') != string::npos) {
+                                       string el = expandLabel(buf.params().getLyXTextClass(), 
+                                               style, false);
+                                       ls = subst(ls, "#", el);
+                               } 
                        }
                        
                        sgml::openTag(os, depth + command_depth, false, command_name, ls);