Skip to content

Commit

Permalink
fix: PSJekyll.Template.IncludeMargin ( Fixes #69 )
Browse files Browse the repository at this point in the history
Fixing conditional
  • Loading branch information
James Brundage committed Oct 9, 2024
2 parents 8679b98 + dfcad2a commit 47ee7ba
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 10 deletions.
34 changes: 26 additions & 8 deletions PSJekyll.types.ps1xml
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,15 @@ $tryToResolveCName = try {
<ScriptProperty>
<Name>Draft</Name>
<GetScriptBlock>
param()
&lt;#
.SYNOPSIS
Gets drafts in a Jekyll site.
.DESCRIPTION
Gets drafts in a Jekyll site, using PowerShell.

This will return the file objects in the `_drafts` folder.
#&gt;
param()

foreach ($specialFile in $this.File -match '[\\/]_drafts[\\/]') {
$specialFile.pstypenames.add("PSJekyll.Draft.Post")
Expand All @@ -859,7 +867,17 @@ foreach ($specialFile in $this.File -match '[\\/]_drafts[\\/]') {

</GetScriptBlock>
<SetScriptBlock>
param()
&lt;#
.SYNOPSIS
Sets a draft in a Jekyll site.
.DESCRIPTION
Sets a draft in a Jekyll site, using PowerShell.

This will create a new draft in the `_drafts` folder.

If no metadata is provided, it will default to the current date and the title of the draft.
#&gt;
param()

$unrolledArguments = @($args | . { process { $_ } })
$currentName = ''
Expand Down Expand Up @@ -889,14 +907,14 @@ if (-not $metadata.date) {
$metadata.date = [DateTime]::Now.ToString("yyyy-MM-dd HH:mm:ss K")
}
if (-not $metadata.title) {
$metadata.title = $Name
$metadata.title = $Name -replace '\.+?$'
}



Set-Content -Path (
$this.Directory,"_drafts",($Name | toMarkdownFileName) -join ([IO.Path]::DirectorySeparatorChar) -replace '^\\'
) -Value $(
New-Item -Path (
$this.Directory,"_drafts",($Name | toMarkdownFileName) -join
([IO.Path]::DirectorySeparatorChar) -replace
'^\\' -replace '[\\/]', [IO.Path]::DirectorySeparatorChar
) -Force -Value $(
@(
$metadata | &amp; $psJekyll.FormatYaml.Script -YamlHeader
$content
Expand Down
2 changes: 2 additions & 0 deletions docs/PSJekyll/Site/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
* [set_Data](set_Data.md)
* [get_Domain](get_Domain.md)
* [set_Domain](set_Domain.md)
* [get_Draft](get_Draft.md)
* [set_Draft](set_Draft.md)
15 changes: 15 additions & 0 deletions docs/PSJekyll/Site/get_Draft.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
PSJekyll.Site.get_Draft()
-------------------------

### Synopsis
Gets drafts in a Jekyll site.

---

### Description

Gets drafts in a Jekyll site, using PowerShell.

This will return the file objects in the `_drafts` folder.

---
17 changes: 17 additions & 0 deletions docs/PSJekyll/Site/set_Draft.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
PSJekyll.Site.set_Draft()
-------------------------

### Synopsis
Sets a draft in a Jekyll site.

---

### Description

Sets a draft in a Jekyll site, using PowerShell.

This will create a new draft in the `_drafts` folder.

If no metadata is provided, it will default to the current date and the title of the draft.

---
4 changes: 2 additions & 2 deletions docs/_data/PSModuleInfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"Docker",
"GitHubAction"
],
"LicenseUri": "https://github.com/PowerShellWeb/PSJekyll/blob/main/LICENSE",
"ProjectUri": "https://github.com/PowerShellWeb/PSJekyll"
"ProjectUri": "https://github.com/PowerShellWeb/PSJekyll",
"LicenseUri": "https://github.com/PowerShellWeb/PSJekyll/blob/main/LICENSE"
}
}
}

0 comments on commit 47ee7ba

Please sign in to comment.