On Wed, Jan 23, 2013 at 1:57 PM, Steve Litt <sl...@troubleshooters.com> wrote:
> On Wed, 23 Jan 2013 15:15:15 +0000 (UTC), Guenter Milde said:
>> Please don't be discouraged to continue the work on and publication of
>> the lyx2xml script. I think it is a useful addition to LyX.
>
> I have a question for you...
>
> When is somebody going to write a lyx2yaml script?
>
> Another question: Instead of having LyX's native format being
> human-opaque XML, why not make it YAML, the ultimate in human
> readability and writeability?

I want XML because of XSLT (and XPath, and XQuery): I can write XSLs
to convert from one schema to another, and this then gets to be
completely external to LyX.  If the LyX XML schema changes, of course,
the XSLs need updating, but it's XSLT code, not C++ or what have you
-- it's a simpler update.  It's more than that.  You can serve XML and
XSLs from some web server and let the browser apply the XSLs to create
XHTML.  And more.  There's lots of databases that specialize in XML
documents and make it easy to search them in regular ways (i.e., with
XPath or XQuery).  I'm probably only scratching the surface here.

Also, properly formatted XML is not human-opaque, but merely annoying.

Don't get me wrong: I'm *not* a fan of XML.  I'm a fan of the DSLs and
tooling that has been built around XML, which -for me- overcome the
downsides to XML itself.

Of course, if our world had been built on programming languages with
hygienic macro facilities with all the power expect of a Scheme, then
we could write these DSLs as needed.  XML is so much wheel
re-invention, but there's a ton of value in standardizing these DSLs:
you can write portable code in them, and you need only know those
standard DSLs instead of having to learn and hack on ad-hoc DSLs.

In a sense YAML saddens me: it's even more wheel re-invention, but
without the DSLs to go with it that XML has.  Why would I want this
for any purpose other than UI?  And why would I want it even for that
purpose when LyX *is* the UI?

> http://en.wikipedia.org/wiki/Yaml

I don't really care what it is as long as there's a trivial,
*lossless* mapping onto XML.  (My script's translation of .lyx to XML
is lossless, though the return trip will not obtain the same original
.lyx because some things in .lyx content need to get normalized in the
conversion to XML.  But no data and metadata get lost in the
conversion.)

> As I understand, the LyX project's preferred scripting language is
> Python, and PyYaml is an excellent YAML parser and emitter.
>
> I don't have time or knowledge to write a lyx2yaml script, but if
> somebody else takes the captain's chair, I'll for sure help.

Well, there's http://yaxml.rubyforge.org/ , which is a tool that
converts between (in both directions) YAXML and YAML.  Pair this with
my lyx2xml script and you have a way to convert to YAML.

I don't think converting directly from .lyx to YAML is going to be any
easier than converting directly to XML is, but if it's *as* easy then
FYI you'll still run into pretty much the same issues I did in
lyx2xml.

Nico
--

Reply via email to