Commit 59c35fac authored by Tomáš Hübelbauer's avatar Tomáš Hübelbauer

Extend to cover any Office files

parent 6f08c86b
Copy-Item Title.docx Title.zip
Expand-Archive Title.zip -DestinationPath out/Title -Force
Remove-Item Title.zip
# Format XML files
Get-ChildItem out/Title -Filter *.xml -Recurse |
Foreach-Object {
$path = $_.FullName
$xml = [xml](Get-Content -literalPath $path)
$xml.Save($path)
git add "$path"
# Iterate Office files in the repository
Get-ChildItem .\* -Include ("*.docx", "*.xlsx", "*.pptx") -Recurse |
Foreach-Object {
$officePath = $_.FullName
Write-Output "Extracting $officePath"
Copy-Item $officePath "$officePath.zip"
Expand-Archive "$officePath.zip" -DestinationPath "$officePath.git" -Force
Remove-Item "$officePath.zip"
# Format XML files for nice diff
Get-ChildItem "$officePath.git" -Filter *.xml -Recurse |
Foreach-Object {
$xmlPath = $_.FullName
Write-Output "Formatting $xmlPath"
([xml](Get-Content -literalPath $xmlPath)).Save($xmlPath)
Write-Output "Tracking $xmlPath"
git add "$xmlPath"
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment