@@ -28,11 +28,14 @@ if (-not $site.PagesByUrl) {
2828}
2929$pagesByUrl = $site.PagesByUrl
3030
31+ $site.FilesProcessed = $filesProcessed = [Ordered ]@ {}
3132$site.FileQueue = $fileQueue = [Collections.Queue ]::new()
3233foreach ($file in $allFiles ) { $fileQueue.Enqueue ($file ) }
3334
3435:nextFile while ($fileQueue.Count ) {
3536 $file = $fileQueue.Dequeue ()
37+ if ($filesProcessed [$file.FullName ]) { continue }
38+ if ($file.FullName -match ' [\//]_' ) { continue }
3639 if ($Site -and $Site.Exclude ) {
3740 $included = $false
3841 :exclude do {
@@ -54,7 +57,11 @@ foreach ($file in $allFiles) { $fileQueue.Enqueue($file) }
5457 }
5558 $included = $true
5659 } until ($included )
60+ if (-not $included ) {
61+ continue nextFile
62+ }
5763 }
64+ $filesProcessed [$file.FullName ] = $true
5865 $fileRoot = $file.Directory.FullName
5966 Push-Location $fileRoot
6067 # Get the file name by removing the extension.
@@ -404,20 +411,23 @@ foreach ($file in $allFiles) { $fileQueue.Enqueue($file) }
404411 $outputFiles
405412 } else {
406413 # otherwise, we'll save output to a file.
414+ if (-not $output ) {
415+ $null = $null
416+ } else {
417+ # If the file does not exists
418+ if (-not (Test-Path - Path $outFile )) {
419+ # create an empty file.
420+ $null = New-Item - Path $outFile - ItemType File - Force
421+ }
407422
408- # If the file does not exists
409- if (-not (Test-Path - Path $outFile )) {
410- # create an empty file.
411- $null = New-Item - Path $outFile - ItemType File - Force
412- }
413-
414- $output > $outFile
415- # and if that worked,
416- if ($? ) {
417- # output the file.
418- $page.OutputFile = Get-Item - Path $outFile
419- $page.OutputFile
420- }
423+ $output > $outFile
424+ # and if that worked,
425+ if ($? ) {
426+ # output the file.
427+ $page.OutputFile = Get-Item - Path $outFile
428+ $page.OutputFile
429+ }
430+ }
421431 }
422432 # endregion Output
423433
0 commit comments