Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 69 additions & 71 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,92 +5,90 @@ env:

on:
push:
pull_request:

jobs:
build:
if: |
github.event_name == 'push' ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v5
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
10.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal --configuration Release --logger "trx;LogFileName=${{ runner.workspace }}/OpenXmlPowerTools/TestResult/test_results.trx"
- name: Publish Unit Test Results
uses: actions/upload-artifact@v5
if: failure()
with:
name: TestResult
path: "TestResult/**/*"
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
10.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal --configuration Release --logger "trx;LogFileName=${{ runner.workspace }}/OpenXmlPowerTools/TestResult/test_results.trx"
- name: Upload build artifacts
uses: actions/upload-artifact@v6
if: matrix.os == 'ubuntu-latest'
with:
name: build-artifacts
path: |
OpenXmlPowerTools/bin/Release/
- name: Publish Unit Test Results
uses: actions/upload-artifact@v6
if: failure()
with:
name: TestResult
path: "TestResult/**/*"

deployRelease:
if: github.ref == 'refs/heads/release'
if: github.event_name == 'push' && github.ref == 'refs/heads/release'
runs-on: ubuntu-latest
needs: build
needs: build
steps:
- uses: actions/checkout@v5
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
10.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: NugetPush
env:
- uses: actions/checkout@v6
- name: Download build artifacts
uses: actions/download-artifact@v6
with:
name: build-artifacts
- name: NugetPush
env:
NUGET_TOKEN_EXISTS: ${{ secrets.NUGET_TOKEN }}
if: env.NUGET_TOKEN_EXISTS != ''
run: |
dotnet nuget push ./OpenXmlPowerTools/bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TOKEN}} --source https://api.nuget.org/v3/index.json
- name: Github Release
shell: bash
env:
GITHUB_TOKEN: ${{ github.TOKEN }}
if: env.GITHUB_TOKEN != ''
run: |
gh release create ${{env.CURRENT_VERSION}} ./OpenXmlPowerTools/bin/Release/*.*nupkg --generate-notes
if: env.NUGET_TOKEN_EXISTS != ''
run: |
dotnet nuget push *.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TOKEN}} --source https://api.nuget.org/v3/index.json
- name: Github Release
shell: bash
env:
GITHUB_TOKEN: ${{ github.TOKEN }}
if: env.GITHUB_TOKEN != ''
run: |
gh release create ${{env.CURRENT_VERSION}} *.*nupkg --generate-notes

deployTest:
if: github.ref == 'refs/heads/main'
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: build
needs: build
steps:
- uses: actions/checkout@v5
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
10.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: NugetPush
env:
- uses: actions/checkout@v6
- name: Download build artifacts
uses: actions/download-artifact@v6
with:
name: build-artifacts
- name: NugetPush
env:
NUGET_TOKEN_EXISTS: ${{ secrets.NUGET_TEST_TOKEN }}
if: env.NUGET_TOKEN_EXISTS != ''
run: |
ls ./OpenXmlPowerTools/bin/Release
dotnet nuget push ./OpenXmlPowerTools/bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TEST_TOKEN}} --source https://apiint.nugettest.org/v3/index.json

- name: Github Prerelease
shell: bash
env:
GITHUB_TOKEN: ${{ github.TOKEN }}
if: env.GITHUB_TOKEN != ''
run: |
gh release create ${{env.CURRENT_VERSION}} ./OpenXmlPowerTools/bin/Release/*.*nupkg --prerelease --generate-notes
if: env.NUGET_TOKEN_EXISTS != ''
run: |
ls
dotnet nuget push *.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TEST_TOKEN}} --source https://apiint.nugettest.org/v3/index.json
- name: Github Prerelease
shell: bash
env:
GITHUB_TOKEN: ${{ github.TOKEN }}
if: env.GITHUB_TOKEN != ''
run: |
gh release create ${{env.CURRENT_VERSION}} *.*nupkg --prerelease --generate-notes
16 changes: 13 additions & 3 deletions OpenXmlPowerTools.Tests/MarkupSimplifierTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ public class MarkupSimplifierTests
{
private const WordprocessingDocumentType DocumentType = WordprocessingDocumentType.Document;

private const string SmartTagDocumentTextValue = "The countries include Algeria, Botswana, and Sri Lanka.";

private const string SmartTagDocumentTextValue = "The countries include Algeria, Botswana, and Sri Lanka. This is privileged information!";
private const string SmartTagDocumentXmlString =
@"<w:document xmlns:w=""http://schemas.openxmlformats.org/wordprocessingml/2006/main"">
<w:body>
Expand Down Expand Up @@ -45,7 +44,18 @@ public class MarkupSimplifierTests
</w:smartTag>
</w:smartTag>
<w:r>
<w:t>.</w:t>
<w:t xml:space=""preserve"">. This is </w:t>
</w:r>
<w:smartTag w:uri=""schemas-workshare-com/workshare"" w:element=""confidentialinformationexposure"">
<w:smartTagPr>
<w:attr w:name=""TagType"" w:val=""5""/>
</w:smartTagPr>
<w:r>
<w:t>privileged</w:t>
</w:r>
</w:smartTag>
<w:r>
<w:t xml:space=""preserve""> information!</w:t>
</w:r>
</w:p>
</w:body>
Expand Down
2 changes: 1 addition & 1 deletion OpenXmlPowerTools.Tests/OpenXmlPowerTools.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Codeuctivity.HtmlRenderer" Version="4.0.458" />
<PackageReference Include="Codeuctivity.SkiaSharpCompare" Version="3.1.214" />
<PackageReference Include="Codeuctivity.SkiaSharpCompare" Version="3.2.245" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="3.119.1" />
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
Expand Down
20 changes: 13 additions & 7 deletions OpenXmlPowerTools/MarkupSimplifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,20 @@ private static object RemoveCustomXmlAndContentControlsTransform(
{
if (node is XElement element)
{
if (simplifyMarkupSettings.RemoveSmartTags &&
element.Name == W.smartTag)
if (simplifyMarkupSettings.RemoveSmartTags)
{
return element
.Elements()
.Select(e =>
RemoveCustomXmlAndContentControlsTransform(e,
simplifyMarkupSettings));
if (element.Name == W.smartTag)
{
return element
.Elements()
.Select(e =>
RemoveCustomXmlAndContentControlsTransform(e,
simplifyMarkupSettings));
}
if (element.Name == W.smartTagPr)
{
return null;
}
}

if (simplifyMarkupSettings.RemoveContentControls &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Configuration.ConfigurationManager" Version="10.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="10.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading