On Fri, Nov 28, 2003 at 07:43:12PM +0000, Jose' Matos spake thusly:
 
>   Noun can be translated to docbook as <phrase role="noun">...</phrase>, and 
> something related to linuxdoc.

Here is the patch for 'latexparam' in CharStyle, to make this kind of thing 
possible.

OK to commit this?

- Martin

Index: lyxtextclass.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtextclass.C,v
retrieving revision 1.44
diff -u -p -r1.44 lyxtextclass.C
--- lyxtextclass.C      27 Nov 2003 16:57:12 -0000      1.44
+++ lyxtextclass.C      29 Nov 2003 12:13:05 -0000
@@ -525,6 +525,7 @@ enum CharStyleTags {
        CS_LABELFONT,
        CS_LATEXTYPE,
        CS_LATEXNAME,
+       CS_LATEXPARAM,
        CS_PREAMBLE,
        CS_END
 };
@@ -537,6 +538,7 @@ void LyXTextClass::readCharStyle(LyXLex 
                { "font", CS_FONT },
                { "labelfont", CS_LABELFONT },
                { "latexname", CS_LATEXNAME },
+               { "latexparam", CS_LATEXPARAM },
                { "latextype", CS_LATEXTYPE },
                { "preamble", CS_PREAMBLE}
        };
@@ -545,6 +547,7 @@ void LyXTextClass::readCharStyle(LyXLex 
 
        string latextype;
        string latexname;
+       string latexparam;
        LyXFont font(LyXFont::ALL_INHERIT);
        LyXFont labelfont(LyXFont::ALL_INHERIT);
        string preamble;
@@ -567,6 +570,10 @@ void LyXTextClass::readCharStyle(LyXLex 
                        lexrc.next();
                        latexname = lexrc.getString();
                        break;
+               case CS_LATEXPARAM:
+                       lexrc.next();
+                       latexparam = subst(lexrc.getString(), "&quot;", "\"");
+                       break;
                case CS_LABELFONT:
                        labelfont.lyxRead(lexrc);
                        break;
@@ -590,6 +597,7 @@ void LyXTextClass::readCharStyle(LyXLex 
                cs.name = name;
                cs.latextype = latextype;
                cs.latexname = latexname;
+               cs.latexparam = latexparam;
                cs.font = font;
                cs.labelfont = labelfont;
                cs.preamble = preamble;
Index: lyxtextclass.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtextclass.h,v
retrieving revision 1.23
diff -u -p -r1.23 lyxtextclass.h
--- lyxtextclass.h      27 Nov 2003 16:57:12 -0000      1.23
+++ lyxtextclass.h      29 Nov 2003 12:13:05 -0000
@@ -27,6 +27,7 @@ struct CharStyle {
        std::string name;
        std::string latextype;
        std::string latexname;
+       std::string latexparam;
        LyXFont font;
        LyXFont labelfont;
        std::string preamble;
Index: insets/insetcharstyle.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcharstyle.C,v
retrieving revision 1.4
diff -u -p -r1.4 insetcharstyle.C
--- insets/insetcharstyle.C     28 Nov 2003 10:12:04 -0000      1.4
+++ insets/insetcharstyle.C     29 Nov 2003 12:13:05 -0000
@@ -49,6 +49,7 @@ InsetCharStyle::InsetCharStyle(BufferPar
        params_.type = cs->name;
        params_.latextype = cs->latextype;
        params_.latexname = cs->latexname;
+       params_.latexparam = cs->latexparam;
        params_.font = cs->font;
        params_.labelfont = cs->labelfont;
        init();
@@ -92,8 +93,8 @@ void InsetCharStyle::setButtonLabel()
 {
        LyXFont font(params_.labelfont);
        font.realize(LyXFont(LyXFont::ALL_SANE));
-       font.decSize();
-       setLabel("Style: " + params_.type);
+       string const s = "Style: " + params_.type;
+       setLabel(isOpen() ? s : getNewLabel(s) );
        setLabelFont(font);
 }
 
@@ -153,7 +154,10 @@ int outputVerbatim(std::ostream & os, In
 int InsetCharStyle::latex(Buffer const &, ostream & os,
                     OutputParams const &) const
 {
-       os << "%\n\\" << params_.latexname << "{";
+       os << "%\n\\" << params_.latexname;
+       if (!params_.latexparam.empty())
+               os << params_.latexparam;
+       os << "{";
        int i = outputVerbatim(os, inset);
        os << "}%\n";
                i += 2;
@@ -164,7 +168,10 @@ int InsetCharStyle::latex(Buffer const &
 int InsetCharStyle::linuxdoc(Buffer const &, std::ostream & os,
                             OutputParams const &) const
 {
-       os << "<" << params_.latexname << ">";
+       os << "<" << params_.latexname;
+       if (!params_.latexparam.empty())
+               os << " " << params_.latexparam;
+       os << ">";
        int const i = outputVerbatim(os, inset);
        os << "</" << params_.latexname << ">";
        return i;
@@ -174,7 +181,10 @@ int InsetCharStyle::linuxdoc(Buffer cons
 int InsetCharStyle::docbook(Buffer const &, std::ostream & os,
                            OutputParams const &) const
 {
-       os << "<" << params_.latexname << ">";
+       os << "<" << params_.latexname;
+       if (!params_.latexparam.empty())
+               os << " " << params_.latexparam;
+       os << ">";
        int const i = outputVerbatim(os, inset);
        os << "</" << params_.latexname << ">";
        return i;
Index: insets/insetcharstyle.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcharstyle.h,v
retrieving revision 1.1
diff -u -p -r1.1 insetcharstyle.h
--- insets/insetcharstyle.h     12 Nov 2003 14:38:26 -0000      1.1
+++ insets/insetcharstyle.h     29 Nov 2003 12:13:05 -0000
@@ -30,6 +30,8 @@
        ///
        std::string latexname;
        ///
+       std::string latexparam;
+       ///
        LyXFont font;
        ///
        LyXFont labelfont;

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to