emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [RFH] thoughts on porting an Emacs etc/schema/ change
@ 2021-05-24  4:57 Kyle Meyer
  0 siblings, 0 replies; only message in thread
From: Kyle Meyer @ 2021-05-24  4:57 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Mark A. Hershberger

I'm trying to figure out how to port changes to etc/schema/ files in the
Emacs repo back to the Org repo.  I'd appreciate feedback from anyone
who knows anything about the etc/schema/ files in Org's tree and/or
ox-odt.


Background
==========

Org has a few files in etc/schema:

  org$ git ls-files --stage etc/schema
  100644 87f84d1ea87e1e0eef759fac1bd7db74ce0a704e 0	etc/schema/od-manifest-schema-v1.2-os.rnc
  100644 8d679d62e4ef1a21707250cf4cabcd5b657d7683 0	etc/schema/od-schema-v1.2-os.rnc
  100644 f1e0ed7856f24c58488bbeac1df922a7d5100776 0	etc/schema/schemas.xml

Two of those are in Emacs's tree as is:

  emacs$ git ls-tree -r origin/emacs-27 -- etc/schema/ | grep od
  100644 blob 87f84d1ea87e1e0eef759fac1bd7db74ce0a704e	etc/schema/od-manifest-schema-v1.2-os.rnc
  100644 blob 8d679d62e4ef1a21707250cf4cabcd5b657d7683	etc/schema/od-schema-v1.2-os.rnc

The contents of Org's etc/schema/schemas.xml, on the other hand, are
_added_ within Emacs's etc/schema/schemas.xml.

  org$ git show f1e0ed7856f24c58488bbeac1df922a7d5100776
  <?xml version="1.0"?>
  <locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0">
    <documentElement prefix="office" typeId="OpenDocument"/>
    <documentElement prefix="manifest" localName="manifest" typeId="OpenDocument Manifest"/>
    <typeId id="OpenDocument" uri="od-schema-v1.2-os.rnc"/>
    <typeId id="OpenDocument Manifest" uri="od-manifest-schema-v1.2-os.rnc"/>
  </locatingRules>

  emacs$ git show origin/emacs-27:etc/schema/schemas.xml | wc -l
  65

  emacs$ git show origin/emacs-27:etc/schema/schemas.xml | grep -i 'opendoc\|od-'
    <documentElement prefix="office" typeId="OpenDocument"/>
    <documentElement prefix="manifest" localName="manifest" typeId="OpenDocument Manifest"/>
    <typeId id="OpenDocument" uri="od-schema-v1.2-os.rnc"/>
    <typeId id="OpenDocument Manifest" uri="od-manifest-schema-v1.2-os.rnc"/>


Changes on the Emacs master branch
==================================

A commit on Emacs's master branch (author cc'd) makes changes to these
files.

  emacs $ git ls-tree -r master -- etc/schema/ | grep od
  100644 blob 87f84d1ea87e1e0eef759fac1bd7db74ce0a704e	etc/schema/od-manifest-schema-v1.2-os.rnc

  emacs$ git show --numstat --format=%B f1f351def3d84813d2c4b2174dfef07b01bec058
  Update rnc to use Open Document's Relax-NG schema to version 1.3
  
  * Use the LibreOffice Relax-NG files since they include a hack to
     support 1.2.
  * rng source:
     https://raw.githubusercontent.com/freedesktop/libreoffice-core/master/
     schema/libreoffice/OpenDocument-schema-v1.3%2Blibreoffice.rng
  * translation to rnc with trang:
     trang -I rng -O rnc OpenDocument-schema-v1.3+libreoffice.rng \
         OpenDocument-schema-v1.3+libreoffice.rnc
  
  
  892     0       etc/schema/OpenDocument-schema-v1.3+libreoffice.rnc
  5914    5780    etc/schema/{od-schema-v1.2-os.rnc => OpenDocument-schema-v1.3.rnc}
  5       1       etc/schema/schemas.xml

Here are the changes to schemas.xml:

  emacs$ git diff f1f351def3d84813d2c4b2174dfef07b01bec058^- etc/schema/schemas.xml
  diff --git a/etc/schema/schemas.xml b/etc/schema/schemas.xml
  index 7fd91b8c72..f8acb0d40c 100644
  --- a/etc/schema/schemas.xml
  +++ b/etc/schema/schemas.xml
  @@ -31,6 +31,10 @@
     <namespace ns="http://relaxng.org/ns/structure/1.0" typeId="RELAX NG"/>
     <namespace ns="http://thaiopensource.com/ns/locating-rules/1.0"
               uri="locate.rnc"/>
  +  <namespace ns="urn:oasis:names:tc:opendocument:xmlns:office:1.0" typeId="LibreOffice"/>
  +  <namespace ns="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" typeId="LibreOffice"/>
  +  <namespace ns="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" typeId="LibreOffice"/>
  +  <namespace ns="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" typeId="OpenDocument Manifest"/>
   
     <documentElement localName="stylesheet" typeId="XSLT"/>
     <documentElement prefix="xsl" localName="transform" typeId="XSLT"/>
  @@ -59,7 +63,7 @@
   
     <documentElement prefix="office" typeId="OpenDocument"/>
     <documentElement prefix="manifest" localName="manifest" typeId="OpenDocument Manifest"/>
  -  <typeId id="OpenDocument" uri="od-schema-v1.2-os.rnc"/>
  +  <typeId id="LibreOffice" uri="OpenDocument-schema-v1.3+libreoffice.rnc"/>
     <typeId id="OpenDocument Manifest" uri="od-manifest-schema-v1.2-os.rnc"/>
   
   </locatingRules>


Porting to Org's tree
=====================

So, coming back to the Org repo, I guess that'd be

  * delete the od-schema-v1.2-os.rnc file and add
    OpenDocument-schema-v1.3.rnc

  * update the typeID line for od-schema-v1.2-os.rnc in Org's
    etc/schema/schemas.xml to match the
    OpenDocument-schema-v1.3+libreoffice.rnc line in the diff above

  * add the namespace lines to Org's etc/schema/schemas.xml (?)

But I know nothing about those files or ox-odt, so testing it on my end
would mostly be fumbling around to see if I spot any breakage when
exporting with ox-odt.

Does the above approach look reasonable?  Will it break ox-odt or be
problematic for some other reason?


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-24  5:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24  4:57 [RFH] thoughts on porting an Emacs etc/schema/ change Kyle Meyer

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).