Skip to content

Instantly share code, notes, and snippets.

@bycpx
Created October 13, 2010 19:07
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bycpx/624661 to your computer and use it in GitHub Desktop.
Save bycpx/624661 to your computer and use it in GitHub Desktop.
Enable textual diff of iWork Pages documents.
*.pages/index.xml.gz diff=iworkpages
[diff "iworkpages"]
textconv = xsltproc $GIT_DIR/Pages.xsl
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sf="http://developer.apple.com/namespaces/sf">
<xsl:template match="sf:p">
<xsl:apply-templates/>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="sf:lnbr">
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template>
<xsl:value-of select="text()"/>
</xsl:template>
</xsl:stylesheet>
@NHDaly
Copy link

NHDaly commented Nov 27, 2013

Hey, this is so awesome and exactly what i'm looking for, but I can't get it to work.. It doesn't change my calls to git diff at all..

I also tried running Pages.xsl by itself, but with no luck:

$ xsltproc Pages.xsl thesis.pages
thesis.pages:1: parser error : Start tag expected, '<' not found
PK
^
unable to parse thesis.pages

Any ideas on what I might be missing? Has the format of *.pages files changed since you published this gist?

Thanks! :)

@NHDaly
Copy link

NHDaly commented Nov 29, 2013

Hey! Actually, I went ahead and forked this gist to fix it to work with the newer .pages format. I had to add a shell script, because now the *.pages files are actually .zip files, so they have to be unzipped and then the unzipped files need to be deleted.

I wasn't able to add ".git/config" to my gist like you have, though, and my guess is because git has changed the rules since you posted this gist?

Anyway. If you want to pull from my updated gist, this should work for Pages '09 files:
https://gist.github.com/NHDaly/7669596

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment