Commit 89935d76 authored by Tomáš Hübelbauer's avatar Tomáš Hübelbauer

Generate 'generated' comments

parent c8839e45
$generatedWarning = "Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff"
# Iterate Office files in the repository
Get-ChildItem .\* -Include ("*.docx", "*.xlsx", "*.pptx") -Recurse |
Foreach-Object {
......@@ -7,7 +9,7 @@ Get-ChildItem .\* -Include ("*.docx", "*.xlsx", "*.pptx") -Recurse |
$diff = (git diff --staged "$officePath") | Out-String
If (-Not ($diff)) {
Write-Output "Skipping $officePath"
return
#return
}
Write-Output "Extracting $officePath"
......@@ -15,24 +17,27 @@ Get-ChildItem .\* -Include ("*.docx", "*.xlsx", "*.pptx") -Recurse |
Expand-Archive "$officePath.zip" -DestinationPath "$officePath.git" -Force
Remove-Item "$officePath.zip"
"# ``" + $_.Name + "```n`n$generatedWarning" | Out-File -literalPath "$officePath.git/README.md" -Encoding UTF8
# Format XML files for nice diff
Get-ChildItem "$officePath.git" -Include ("*.xml", "*.rels") -Recurse |
Foreach-Object {
$xmlPath = $_.FullName
$txtPath = "$xmlPath.txt"
Write-Output "Formatting $xmlPath"
$xml = ([xml](Get-Content -literalPath $xmlPath))
$xml.InsertBefore($xml.CreateComment(" $generatedWarning "), $xml.DocumentElement) | Out-Null
$xml.Save($xmlPath)
# Export only text nodes for text-only lossy diff
Write-Output "Generating $txtPath"
$txt = ""
$txt = "# $generatedWarning`n"
$nodes = $xml.SelectNodes("//text()")
foreach ($node in $nodes) {
$txt += $node.Value + "`n"
}
$txtPath = "$xmlPath.txt"
$txt | Out-File -literalPath $txtPath -Encoding UTF8
}
......
# `Excel.xlsx`
Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff -->
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
<Default Extension="xml" ContentType="application/xml" />
......

# Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff -->
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml" />
<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml" />
......

# Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff -->
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
<Application>Microsoft Excel</Application>
<DocSecurity>0</DocSecurity>
......
Microsoft Excel
# Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
Microsoft Excel
0
false
Listy
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff -->
<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<dc:creator>Tom</dc:creator>
<cp:lastModifiedBy>Tom</cp:lastModifiedBy>
......
Tom
# Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
Tom
Tom
2017-12-31T09:16:52Z
2017-12-31T12:22:50Z
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff -->
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml" />
<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml" />
......

# Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff -->
<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="3" uniqueCount="3">
<si>
<t>This file has been updated to demonstrate Excel diffing experience.</t>
......
This file has been updated to demonstrate Excel diffing experience.
# Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
This file has been updated to demonstrate Excel diffing experience.
Thank you!
This text has been added to showcase diffing.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff -->
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac x16r2" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" xmlns:x16r2="http://schemas.microsoft.com/office/spreadsheetml/2015/02/main">
<fonts count="1" x14ac:knownFonts="1">
<font>
......

# Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff -->
<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Motiv Office">
<a:themeElements>
<a:clrScheme name="Office">
......

# Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff -->
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x15" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main">
<fileVersion appName="xl" lastEdited="7" lowestEdited="7" rupBuild="18431" />
<workbookPr defaultThemeVersion="166925" />
......

# Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff -->
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac">
<dimension ref="A1:C3" />
<sheetViews>
......
0
# Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
0
2
1
# `Word.docx`
Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff -->
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
<Default Extension="xml" ContentType="application/xml" />
......

# Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff -->
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml" />
<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml" />
......

# Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff -->
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
<Template>Normal.dotm</Template>
<TotalTime>5</TotalTime>
......
Normal.dotm
# Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
Normal.dotm
5
1
23
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff -->
<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<dc:title>
</dc:title>
......
Tom
# Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
Tom
Tom
19
2017-12-31T06:50:00Z
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff -->
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings" Target="webSettings.xml" />
<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml" />
......

# Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff -->
<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 w16se w16cid wp14">
<w:body>
<w:p w:rsidR="00DE075A" w:rsidRDefault="00F80B87" w:rsidP="00DE075A">
......
Title
# Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
Title
😊
This file has been updated to serve as an example of the Word file diffing experience.
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff -->
<w:fonts xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" mc:Ignorable="w14 w15 w16se w16cid">
<w:font w:name="Calibri">
<w:panose1 w:val="020F0502020204030204" />
......

# Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff -->
<w:settings xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:sl="http://schemas.openxmlformats.org/schemaLibrary/2006/main" mc:Ignorable="w14 w15 w16se w16cid">
<w:zoom w:percent="100" />
<w:defaultTabStop w:val="720" />
......

# Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff -->
<w:styles xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" mc:Ignorable="w14 w15 w16se w16cid">
<w:docDefaults>
<w:rPrDefault>
......

# Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff -->
<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Motiv Office">
<a:themeElements>
<a:clrScheme name="Kancelář">
......

# Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff -->
<w:webSettings xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" mc:Ignorable="w14 w15 w16se w16cid">
<w:optimizeForBrowser />
<w:allowPNG />
......

# Generated. Do not edit. https://github.com/TomasHubelbauer/modern-office-git-diff
......@@ -7,9 +7,3 @@
## Verify PowerShell script runs okay on non-Windows PowerShell
I suspect there will be a problem with relying on the XML functionality which is likely to be missing when not on Windows (is .NET).
## Generate README.md in generated folders and XML/TXT comment in generated files
- All subdirectories `README.md` with more information link to the repository
- All XML files XML comment atop the DOCTYPE as a first thing
- All TXT files `#` comment as a first thing
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