Re: public identifier for DocBook XML export + unescaped '&' in

2017-01-12 Thread Richard Heck
On 01/08/2017 05:30 PM, Martin A. Brown wrote:
> Hello,
>
>>> Yes, I can and I yes it works.  I have attached the patch.  I 
>>> have never touched C++ before, so this is just the dumbest thing 
>>> I could suggest, though it seems to do the trick.
>> Thanks, I've committed these. They're sufficiently minor that we 
>> don't really NEED a license agreement, but if you'd like to be 
>> added to the LyX credits (especially if we're going to have you 
>> help us clean up the DocBook export), just send a message to this 
>> list saying something like: "I hereby license my contributions to 
>> LyX under the General Public License, version 2 or any later 
>> version."
> For my contributions to LyX, I hereby license my contributions to 
> LyX under the General Public License, version 2 or any later 
> version.

I've added you to the credits.

Richard



Re: public identifier for DocBook XML export + unescaped '&' in

2017-01-11 Thread Scott Kostyshak
On Sun, Jan 08, 2017 at 02:30:09PM -0800, Martin A. Brown wrote:
> 
> Hello,
> 
> >> Yes, I can and I yes it works.  I have attached the patch.  I 
> >> have never touched C++ before, so this is just the dumbest thing 
> >> I could suggest, though it seems to do the trick.
> >
> >Thanks, I've committed these. They're sufficiently minor that we 
> >don't really NEED a license agreement, but if you'd like to be 
> >added to the LyX credits (especially if we're going to have you 
> >help us clean up the DocBook export), just send a message to this 
> >list saying something like: "I hereby license my contributions to 
> >LyX under the General Public License, version 2 or any later 
> >version."
> 
> For my contributions to LyX, I hereby license my contributions to 
> LyX under the General Public License, version 2 or any later 
> version.
> 
> -Martin
> 
> P.S.  Thanks for the direction on that, Richard.

Thanks for your patch, Martin.

docbook in LyX hasn't received much love lately. If you're curious about
trying to solve other LyX + docbook issues, take a look at the following
open issues:
http://www.lyx.org/trac/query?status=!closed=docbook+export

Scott


signature.asc
Description: PGP signature


Re: public identifier for DocBook XML export + unescaped '&' in

2017-01-08 Thread Martin A. Brown

Hello,

>> Yes, I can and I yes it works.  I have attached the patch.  I 
>> have never touched C++ before, so this is just the dumbest thing 
>> I could suggest, though it seems to do the trick.
>
>Thanks, I've committed these. They're sufficiently minor that we 
>don't really NEED a license agreement, but if you'd like to be 
>added to the LyX credits (especially if we're going to have you 
>help us clean up the DocBook export), just send a message to this 
>list saying something like: "I hereby license my contributions to 
>LyX under the General Public License, version 2 or any later 
>version."

For my contributions to LyX, I hereby license my contributions to 
LyX under the General Public License, version 2 or any later 
version.

-Martin

P.S.  Thanks for the direction on that, Richard.

-- 
Martin A. Brown
http://linux-ip.net/


Re: public identifier for DocBook XML export + unescaped '&' in

2017-01-08 Thread Richard Heck
On 01/07/2017 06:55 PM, Martin A. Brown wrote:
> Richard,
>
>>> I have used LyX on and off for many years and, working 
>>> sporadically with TLDP [0], I have handled a few documents that 
>>> were written in LyX.  Thank you to the LyX team for your work on 
>>> this tool over the years.
>>>
>>> I have two questions today, after examining the DocBook XML 
>>> output from the 2.2.x series.
>>>
>>> Question 1
>>> --
>>> Is it possible to change the public identifier for the DocBook 
>>> XML 4.2 output processor to use:
>>>
>>>   -//OASIS//DTD DocBook XML V4.2//EN   # -- my suggestion
>>>   -//OASIS//DTD DocBook XML//EN# -- current identifier [1]
>>>
>>> I have checked the XML catalogs on several different platforms 
>>> and I cannot find a reference to the latter identifier, and I 
>>> think it may simply be an oversight.  The system identifier (the 
>>> URL [2]) is correct.
>> This code goes way, way back to 2004. It seems to have been 
>> introduced at 33243f700. It appears that the one without "V4.2" was 
>> meant to be for XML, whereas the other one was meant to be for 
>> SGML. It's easy enough to change it so we output the same thing 
>> both times, but let me cc José and see if he has any thoughts.
> OK, great!  And thank you for the quick reply!
>
> The SGML public identifier (on line 2032) is correct.
>
>   -//OASIS//DTD DocBook V4.2//EN # -- for DocBook SGML at V4.2
>   -//OASIS//DTD DocBook XML V4.2//EN # -- for DocBook XML at V4.2
>
>>> Question 2
>>> --
>>> When running the DocBook XML export function, I discover that not 
>>> all text with '&' is not getting properly escaped with the XML 
>>> entity .  There's clearly code to handle that:
>>>
>>>   http://www.lyx.org/trac/browser/lyxgit/src/sgml.cpp#L46
>>>
>>> To the best of my ability I traced down a case of a Hyperlink 
>>> whose text is not properly XML-escaped.  I think this is the 
>>> line, but I'm not certain:
>>>
>>>   http://www.lyx.org/trac/browser/lyxgit/src/insets/InsetHyperlink.cpp#L235
>>>
>>>   int InsetHyperlink::docbook(odocstream & os, OutputParams const &) const
>>>   {
>>>   os << ">>  << subst(getParam("target"), from_ascii("&"), 
>>> from_ascii(""))
>>>  << "\">"
>>>  << getParam("name")
>>>  << "";
>>>   return 0;
>>>   }
>>>
>>> I think that getParam("name") also needs to be run through 
>>> sgml::escapeString.
>> Yes, that seems right. Since you have the git repo, can you make 
>> this change and test it? I'm not sure anyone on the development 
>> team actually uses the docbook classes.
> Yes, I can and I yes it works.  I have attached the patch.  I have never 
> touched C++ before, so this is just the dumbest thing I could suggest, though 
> it seems to do the trick.

Thanks, I've committed these. They're sufficiently minor that we don't
really NEED a license agreement, but if you'd like to be added to the
LyX credits (especially if we're going to have you help us clean up the
DocBook export), just send a message to this list saying something like:
"I hereby license my contributions to LyX under the General Public
License, version 2 or any later version."

Richard



Re: public identifier for DocBook XML export + unescaped '&' in

2017-01-07 Thread Martin A. Brown

>> I have two questions today, after examining the DocBook XML output 
>> from the 2.2.x series.
>
>You might want to read http://www.lyx.org/trac/ticket/7009

I see.

>I believe if someone competent told us (hint) what we are supposed 
>to output, the patch to port docbook for something up-to-date would 
>be actually pretty small.

Well, I think the only tricky bit for generating valid DocBook XML 
from LyX has been the  bits and author specification.  
While I'm very comfortable with DocBook, I confess to being little 
more than a sometime user of LyX.  I may be able to help and provide 
some suggestions, but if I can produce valid DocBook XML 4.2 with 
the export tool, that's great with me!

I think there would be a bit of work to switch the output routines 
to produce a DocBook in the 5.x series, but I have only stumbled 
across the two (minor) issues as a result of a recent resubmission 
of documents to TLDP.

I cannot claim significant experience with DocBook 5.x.  I have a 
bit more with DocBook 4.x and would be happy to advise if there are 
pending questions.  I will trawl the lyx ticket queue.

Thank you again to all contributors for the LyX tool,

-Martin

-- 
Martin A. Brown
http://linux-ip.net/


Re: public identifier for DocBook XML export + unescaped '&' in

2017-01-07 Thread Martin A. Brown

Richard,

>> I have used LyX on and off for many years and, working 
>> sporadically with TLDP [0], I have handled a few documents that 
>> were written in LyX.  Thank you to the LyX team for your work on 
>> this tool over the years.
>>
>> I have two questions today, after examining the DocBook XML 
>> output from the 2.2.x series.
>>
>> Question 1
>> --
>> Is it possible to change the public identifier for the DocBook 
>> XML 4.2 output processor to use:
>>
>>   -//OASIS//DTD DocBook XML V4.2//EN   # -- my suggestion
>>   -//OASIS//DTD DocBook XML//EN# -- current identifier [1]
>>
>> I have checked the XML catalogs on several different platforms 
>> and I cannot find a reference to the latter identifier, and I 
>> think it may simply be an oversight.  The system identifier (the 
>> URL [2]) is correct.
>
>This code goes way, way back to 2004. It seems to have been 
>introduced at 33243f700. It appears that the one without "V4.2" was 
>meant to be for XML, whereas the other one was meant to be for 
>SGML. It's easy enough to change it so we output the same thing 
>both times, but let me cc José and see if he has any thoughts.

OK, great!  And thank you for the quick reply!

The SGML public identifier (on line 2032) is correct.

  -//OASIS//DTD DocBook V4.2//EN # -- for DocBook SGML at V4.2
  -//OASIS//DTD DocBook XML V4.2//EN # -- for DocBook XML at V4.2

>> Question 2
>> --
>> When running the DocBook XML export function, I discover that not 
>> all text with '&' is not getting properly escaped with the XML 
>> entity .  There's clearly code to handle that:
>>
>>   http://www.lyx.org/trac/browser/lyxgit/src/sgml.cpp#L46
>>
>> To the best of my ability I traced down a case of a Hyperlink 
>> whose text is not properly XML-escaped.  I think this is the 
>> line, but I'm not certain:
>>
>>   http://www.lyx.org/trac/browser/lyxgit/src/insets/InsetHyperlink.cpp#L235
>>
>>   int InsetHyperlink::docbook(odocstream & os, OutputParams const &) const
>>   {
>>   os << ">  << subst(getParam("target"), from_ascii("&"), 
>> from_ascii(""))
>>  << "\">"
>>  << getParam("name")
>>  << "";
>>   return 0;
>>   }
>>
>> I think that getParam("name") also needs to be run through 
>> sgml::escapeString.
>
>Yes, that seems right. Since you have the git repo, can you make 
>this change and test it? I'm not sure anyone on the development 
>team actually uses the docbook classes.

Yes, I can and I yes it works.  I have attached the patch.  I have 
never touched C++ before, so this is just the dumbest thing I could 
suggest, though it seems to do the trick.

Best regards,

-Martin

-- 
Martin A. Brown
http://linux-ip.net/diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 2b2660e..94e94fa 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -2026,7 +2026,7 @@ void Buffer::writeDocBookSource(odocstream & os, string const & fname,
 		if (! tclass.class_header().empty())
 			os << from_ascii(tclass.class_header());
 		else if (runparams.flavor == OutputParams::XML)
-			os << "PUBLIC \"-//OASIS//DTD DocBook XML//EN\" "
+			os << "PUBLIC \"-//OASIS//DTD DocBook XML V4.2//EN\" "
 			<< "\"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd\";;
 		else
 			os << " PUBLIC \"-//OASIS//DTD DocBook V4.2//EN\"";
diff --git a/src/insets/InsetHyperlink.cpp b/src/insets/InsetHyperlink.cpp
index 54f1f2c..039f553 100644
--- a/src/insets/InsetHyperlink.cpp
+++ b/src/insets/InsetHyperlink.cpp
@@ -22,6 +22,7 @@
 #include "LaTeXFeatures.h"
 #include "OutputParams.h"
 #include "output_xhtml.h"
+#include "sgml.h"
 
 #include "support/docstream.h"
 #include "support/FileName.h"
@@ -232,7 +233,7 @@ int InsetHyperlink::docbook(odocstream & os, OutputParams const &) const
 	os << ""
-	   << getParam("name")
+	   << sgml::escapeString(getParam("name"))
 	   << "";
 	return 0;
 }


Re: public identifier for DocBook XML export + unescaped '&' in

2017-01-07 Thread Pavel Sanda
Martin A. Brown wrote:
> I have two questions today, after examining the DocBook XML output 
> from the 2.2.x series.

You mmight want to read http://www.lyx.org/trac/ticket/7009

I believe if someone competent told us (hint) what we are supposed
to output, the patch to port docbook for something up-to-date
would be actually pretty small.

Pavel


Re: public identifier for DocBook XML export + unescaped '&' in

2017-01-07 Thread Richard Heck
On 01/07/2017 12:46 PM, Martin A. Brown wrote:
> Hello all,
>
> I have used LyX on and off for many years and, working sporadically with TLDP 
> [0], I have handled a few documents that were written in LyX.  Thank you to 
> the LyX team for your work on this tool over the years.
>
> I have two questions today, after examining the DocBook XML output from the 
> 2.2.x series.
>
> Question 1
> --
> Is it possible to change the public identifier for the DocBook XML 4.2 output 
> processor to use:
>
>   -//OASIS//DTD DocBook XML V4.2//EN   # -- my suggestion
>   -//OASIS//DTD DocBook XML//EN# -- current identifier [1]
>
> I have checked the XML catalogs on several different platforms and I cannot 
> find a reference to the latter identifier, and I think it may simply be an 
> oversight.  The system identifier (the URL [2]) is correct.

This code goes way, way back to 2004. It seems to have been introduced
at 33243f700. It appears that the one without "V4.2" was meant to be for
XML, whereas the other one was meant to be for SGML. It's easy enough to
change it so we output the same thing both times, but let me cc José and
see if he has any thoughts.

> Question 2
> --
> When running the DocBook XML export function, I discover that not  all text 
> with '&' is not getting properly escaped with the XML entity .  There's 
> clearly code to handle that:
>
>   http://www.lyx.org/trac/browser/lyxgit/src/sgml.cpp#L46
>
> To the best of my ability I traced down a case of a Hyperlink whose text is 
> not properly XML-escaped.  I think this is the line, but I'm not certain:
>
>   http://www.lyx.org/trac/browser/lyxgit/src/insets/InsetHyperlink.cpp#L235
>
>   int InsetHyperlink::docbook(odocstream & os, OutputParams const &) const
>   {
>   os << "  << subst(getParam("target"), from_ascii("&"), 
> from_ascii(""))
>  << "\">"
>  << getParam("name")
>  << "";
>   return 0;
>   }
>
> I think that getParam("name") also needs to be run through sgml::escapeString.

Yes, that seems right. Since you have the git repo, can you make this
change and test it? I'm not sure anyone on the development team actually
uses the docbook classes.

Richard



public identifier for DocBook XML export + unescaped '&' in

2017-01-07 Thread Martin A. Brown

Hello all,

I have used LyX on and off for many years and, working sporadically 
with TLDP [0], I have handled a few documents that were written in 
LyX.  Thank you to the LyX team for your work on this tool over the 
years.

I have two questions today, after examining the DocBook XML output 
from the 2.2.x series.

Question 1
--
Is it possible to change the public identifier for the DocBook XML 
4.2 output processor to use:

  -//OASIS//DTD DocBook XML V4.2//EN   # -- my suggestion
  -//OASIS//DTD DocBook XML//EN# -- current identifier [1]

I have checked the XML catalogs on several different platforms and I 
cannot find a reference to the latter identifier, and I think it may 
simply be an oversight.  The system identifier (the URL [2]) is 
correct.

(You may wonder why I noticed this.  Any network-connected system 
will likely use the system identifier to fetch the DocBook DTDs.  
If running 'xsltproc --nonet', then the DTDs have to be located 
using the public identifier, which is used as a key into the local 
system's XML catalogs.  No matching DTD can be found for the above 
public identifier, hence the document cannot be processed.)

I have not contributed to LyX before, though I have a checkout of 
the LyX git repo and could provide a patch.  (If this is an 
acceptable change, though, then I'd be happy if anybody wished to 
make the change; no worries around attribution.)


Question 2
--
When running the DocBook XML export function, I discover that not 
all text with '&' is not getting properly escaped with the XML 
entity .  There's clearly code to handle that:

  http://www.lyx.org/trac/browser/lyxgit/src/sgml.cpp#L46

To the best of my ability I traced down a case of a Hyperlink whose 
text is not properly XML-escaped.  I think this is the line, but I'm 
not certain:

  http://www.lyx.org/trac/browser/lyxgit/src/insets/InsetHyperlink.cpp#L235

  int InsetHyperlink::docbook(odocstream & os, OutputParams const &) const
  {
  os << ""
 << getParam("name")
 << "";
  return 0;
  }

I think that getParam("name") also needs to be run through sgml::escapeString.

Thank you in advance for any consideration,

-Martin

 [0] http://tldp.org/
 [1] http://www.lyx.org/trac/browser/lyxgit/src/Buffer.cpp#L2026
 [2] http://www.lyx.org/trac/browser/lyxgit/src/Buffer.cpp#L2027

-- 
Martin A. Brown
http://linux-ip.net/