On 11/05/2011 04:34 AM, Ludovic Dubost wrote:
Hi devs,
Is there a documentation and a tool to clean XWiki XML files for commit.
I used to use the SVN Application to clean the XML and commit in the
sandbox for the contributed apps.
But the SVN app does not work with git (even with the SVN bridge as it
seems svnkit is not compatible), so I'm left to export to commit.
How do developers usually do that ?
Ludovic
I use a bash script on the filesystem, relying on dos2unix and sed:
$ cat clean-xml.sh
dos2unix -q "$@"
sed -r -i -f /home/sgm/clean.sed "$@"
$ cat clean.sed
s/ encoding=".*" ?\?>/ encoding="UTF-8"?>/
s/<version>[0-9]+\.[0-9]+<\/version>/<version>1.1<\/version>/
s/<defaultLanguage>([^<]*)<\/defaultLanguage>/<defaultLanguage><\/defaultLanguage>/
s/<creator>([^<]*)<\/creator>/<creator>xwiki:XWiki.Admin<\/creator>/
s/<author>([^<]*)<\/author>/<author>xwiki:XWiki.Admin<\/author>/
s/<contentAuthor>([^<]*)<\/contentAuthor>/<contentAuthor>xwiki:XWiki.Admin<\/contentAuthor>/
s/<comment>([^<]*)<\/comment>/<comment><\/comment>/
s/<minorEdit>([^<]*)<\/minorEdit>/<minorEdit>false<\/minorEdit>/
Two things to note, it sets the author to the global xwiki:XWiki.Admin,
and the language to empty; that should be manually fixed if the target
project expects something else.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/