Skip to content

Enable running pandoc on about topic files #2012

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 5, 2018
Merged
Changes from all commits
Commits
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
36 changes: 35 additions & 1 deletion appveyor.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,25 @@ param(
$global:ProgressPreference = 'SilentlyContinue'
if($ShowProgress){$ProgressPreference = 'Continue'}

# Pandoc source URL
$panDocVersion = "2.0.6"
$pandocSourceURL = "https://github.com/jgm/pandoc/releases/download/$panDocVersion/pandoc-$panDocVersion-windows.zip"

$pandocDestinationPath = New-Item (Join-Path ([System.IO.Path]::GetTempPath()) "PanDoc") -ItemType Directory -Force
$pandocZipPath = Join-Path $pandocDestinationPath "pandoc-$panDocVersion-windows.zip"
Invoke-WebRequest -Uri $pandocSourceURL -OutFile $pandocZipPath

Expand-Archive -Path (Join-Path $pandocDestinationPath "pandoc-$panDocVersion-windows.zip") -DestinationPath $pandocDestinationPath -Force
$pandocExePath = Join-Path (Join-Path $pandocDestinationPath "pandoc-$panDocVersion") "pandoc.exe"

# Find the reference folder path w.r.t the script
$ReferenceDocset = Join-Path $PSScriptRoot 'reference'

# Variable to collect any errors in during processing
$allErrors = @()

# Go through all the directories in the reference folder
Get-ChildItem $ReferenceDocset -Directory -Exclude 'docs-conceptual','mapping' | ForEach-Object -Process {
Get-ChildItem $ReferenceDocset -Directory -Exclude 'docs-conceptual','mapping', 'bread-pscore' | ForEach-Object -Process {
$Version = $_.Name
$VersionFolder = $_.FullName
# For each of the directories, go through each module folder
Expand All @@ -26,6 +37,29 @@ Get-ChildItem $ReferenceDocset -Directory -Exclude 'docs-conceptual','mapping' |
$MamlOutputFolder = Join-Path "$PSScriptRoot\maml" "$Version\$ModuleName"
$CabOutputFolder = Join-Path "$PSScriptRoot\updatablehelp" "$Version\$ModuleName"

# Process the about topics if any
$AboutFolder = Join-Path $ModulePath "About"

if(Test-Path $AboutFolder)
{
Get-ChildItem "$aboutfolder/about_*.md" | ForEach-Object {
$aboutFileFullName = $_.FullName
$aboutFileOutputName = "$($_.BaseName).help.txt"
$aboutFileOutputFullName = Join-Path $MamlOutputFolder $aboutFileOutputName

$pandocArgs = @(
"--from=markdown",
"--to=plain+multiline_tables+inline_code_attributes",
"--columns=75",
"--output=$aboutFileOutputFullName",
$aboutFileFullName,
"--quiet"
)

& $pandocExePath $pandocArgs
}
}

try {
# For each module, create a single maml help file
# Adding warningaction=stop to throw errors for all warnings, erroraction=stop to make them terminating errors
Expand Down