On Wednesday 30 January 2002 22:06, Peter Bieringer wrote:
> Hi,
>
> during writing a LDP howto I ran into a strange bug.
> I've subscribed to the users-list because I don't want to get all the
> dev-traffic - hopefully someone can help me here also.
>
> Version 1.1.6fix4 is rebuilded today from available SRPMS.
>
> Topic: LyX doesn't "escape" "&" chars in exported URLs, but nsgmls
> don't like this:

  Thanks for reporting that bug. Actually I think that nsgmls only outputs a 
warning.

[bug report]

> possible fix:
>
> manual replace of "&" with "&"

  The correct fix is to escape all the chars inside the url, usually the only 
one that gives trouble is &, as I don't expect < and > to be present inside 
any url. Actually I think that & is not allowed also, but I know lots of url 
that use them so...

> But no idea for an automatic fix, because it's difficult to differ
> between standalone "&" and "&" of starting entinites.
>
> Any hints?

Try this patch, it should fix that:

diff -u -p -r1.33 inseturl.C
--- inseturl.C  2000/11/04 10:00:11     1.33
+++ inseturl.C  2002/02/01 10:09:38
@@ -10,6 +10,7 @@
 #include "LyXView.h"
 #include "debug.h"
 #include "frontends/Dialogs.h"
+#include "support/lstrings.h"

 using std::ostream;

@@ -76,8 +77,8 @@ int InsetUrl::Linuxdoc(Buffer const *, o

 int InsetUrl::DocBook(Buffer const *, ostream & os) const
 {
-       os << "<ulink url=\"" << getContents() << "\">"
-          << getOptions() << "</ulink>";
+       os << "<ulink url=\"" << subst(getContents(),"&","&amp;")
+          << "\">" << getOptions() << "</ulink>";
        return 0;
 }


>         Peter

-- 
José Abílio

Reply via email to