Hey guys,

The attached patch prevents multiple entries in
LaTeXFeatures::features by placing a check in LaTeXFeatures::require.

It also implements HTML urls when the HTML Type Checkbox is ticked.
\htmladdnormallink can still be overridden in the preamble.

Comments?,


-- 
========================================================================
| Michael Koziarski                   |"Conventional wisdom is often   |
| Data Engineer, Linux user           | long on convention and short   |
| & Objectivist.                      | on wisdom" --                  |
| http://www.koziarski.com            | Warren E. Buffett, BRK.A       |
========================================================================
Index: po/POTFILES.in
===================================================================
RCS file: /cvs/lyx/lyx-devel/po/POTFILES.in,v
retrieving revision 1.240
diff -u -r1.240 POTFILES.in
--- po/POTFILES.in      2001/12/20 15:11:49     1.240
+++ po/POTFILES.in      2001/12/29 20:05:44
@@ -174,7 +174,6 @@
 src/kbsequence.C
 src/language.C
 src/LaTeX.C
-src/layout.C
 src/LColor.C
 src/LyXAction.C
 src/lyx_cb.C
@@ -184,6 +183,7 @@
 src/lyx_main.C
 src/lyxrc.C
 src/LyXSendto.C
+src/lyxtextclasslist.C
 src/lyxvc.C
 src/LyXView.C
 src/mathed/formulabase.C
Index: src/ChangeLog
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/ChangeLog,v
retrieving revision 1.487
diff -u -r1.487 ChangeLog
--- src/ChangeLog       2001/12/28 21:52:59     1.487
+++ src/ChangeLog       2001/12/29 20:06:05
@@ -1,3 +1,10 @@
+2001-12-29  Michael A. Koziarski <[EMAIL PROTECTED]>
+
+       * LaTeXFeatures.C (require): Prevent duplicate entries in the
+       features list.
+
+       * LaTeXFeatures.C (getPackages): add html package support.
+       
 2001-12-28  Lars Gullik Bjønnes  <[EMAIL PROTECTED]>
 
        * screen.C (topCursorVisible): introduce a temp var for
Index: src/LaTeXFeatures.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/LaTeXFeatures.C,v
retrieving revision 1.52
diff -u -r1.52 LaTeXFeatures.C
--- src/LaTeXFeatures.C 2001/12/28 13:26:49     1.52
+++ src/LaTeXFeatures.C 2001/12/29 20:06:08
@@ -41,7 +41,9 @@
 
 void LaTeXFeatures::require(string const & name)
 {
-       // INSET_GRAPHICS: remove this when InsetFig is thrown.
+       if (isRequired(name))
+               return;
+       // INSET_GRAPHICS: remove this when InsetFig is thrown.
        if (name == "graphics") {
                features.push_back("graphicx");
                features.push_back("graphics");
@@ -174,11 +176,17 @@
        // prettyref.sty
        if (isRequired("prettyref"))
                packages << "\\usepackage{prettyref}\n";
-
+       
        /**
         * The rest of these packages are somewhat more complicated
         * than those above.
         **/
+
+       // html.sty
+       if (isRequired("html"))
+               packages << "\\usepackage{html}\n" 
+                        << "\\latex{\\renewcommand{"
+                        << "\\htmladdnormallink}[2]{#1 (\\url{#2})}}\n";
 
        // color.sty
        if (isRequired("color")) {
Index: src/insets/ChangeLog
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/insets/ChangeLog,v
retrieving revision 1.264
diff -u -r1.264 ChangeLog
--- src/insets/ChangeLog        2001/12/27 15:54:25     1.264
+++ src/insets/ChangeLog        2001/12/29 20:06:25
@@ -1,3 +1,8 @@
+2001-12-29  Michael A. Koziarski <[EMAIL PROTECTED]>
+
+       * inseturl.C: Add Proper HTML url when the HTML Type checkbox is
+       on.
+
 2001-12-27  Juergen Vigna  <[EMAIL PROTECTED]>
 
        * insettabular.C (ascii): export as tab-separated-values if the
Index: src/insets/inseturl.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/insets/inseturl.C,v
retrieving revision 1.40
diff -u -r1.40 inseturl.C
--- src/insets/inseturl.C       2001/11/30 11:56:04     1.40
+++ src/insets/inseturl.C       2001/12/29 20:06:26
@@ -51,11 +51,17 @@
 
 int InsetUrl::latex(Buffer const *, ostream & os,
                    bool fragile, bool /*free_spc*/) const
+
 {
-       if (!getOptions().empty())
-               os << getOptions() + ' ';
        if (fragile)
                os << "\\protect";
+       if (getCmdName() == "htmlurl") { // HTML URL
+                       os << "\\htmladdnormallink{" << getOptions() << "}{"
+                          << getContents() << "}";
+                       return 0; // everything ok
+       }
+       if (!getOptions().empty())
+               os << getOptions() + ' ';
        os << "\\url{" << getContents() << '}';
        return 0;
 }
@@ -91,5 +97,7 @@
 
 void InsetUrl::validate(LaTeXFeatures & features) const
 {
+       if ( getCmdName() == "htmlurl" )
+               features.require("html");
        features.require("url");
 }

Reply via email to