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 << "<ulink url=\"" >>> << subst(getParam("target"), from_ascii("&"), >>> from_ascii("&")) >>> << "\">" >>> << getParam("name") >>> << "</ulink>"; >>> 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