From a8224e992c926ec499807e5ee2245c9be95df528 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Wed, 9 Oct 2024 04:02:29 +0000 Subject: [PATCH 1/5] docs: PSJekyll.Site.get/set_Draft ( Fixes #42, Fixes #49 ) Adding docs, always using New-Item --- PSJekyll.types.ps1xml | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/PSJekyll.types.ps1xml b/PSJekyll.types.ps1xml index 8d8ccfb..1f506a7 100644 --- a/PSJekyll.types.ps1xml +++ b/PSJekyll.types.ps1xml @@ -849,7 +849,15 @@ $tryToResolveCName = try { Draft - param() + <# +.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. +#> +param() foreach ($specialFile in $this.File -match '[\\/]_drafts[\\/]') { $specialFile.pstypenames.add("PSJekyll.Draft.Post") @@ -859,7 +867,17 @@ foreach ($specialFile in $this.File -match '[\\/]_drafts[\\/]') { - param() + <# +.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. +#> +param() $unrolledArguments = @($args | . { process { $_ } }) $currentName = '' @@ -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 | & $psJekyll.FormatYaml.Script -YamlHeader $content From bcb10f4b36b2715445d5584749c75f8251655c33 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Wed, 9 Oct 2024 04:02:38 +0000 Subject: [PATCH 2/5] docs: PSJekyll.Site.get/set_Draft ( Fixes #42, Fixes #49 ) Adding docs, always using New-Item --- docs/PSJekyll/Site/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/PSJekyll/Site/README.md b/docs/PSJekyll/Site/README.md index 77535a5..1b74ef0 100644 --- a/docs/PSJekyll/Site/README.md +++ b/docs/PSJekyll/Site/README.md @@ -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) From dfd6cbc62a0160577cf5cfe89c6707bedbf1abc9 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Wed, 9 Oct 2024 04:02:38 +0000 Subject: [PATCH 3/5] docs: PSJekyll.Site.get/set_Draft ( Fixes #42, Fixes #49 ) Adding docs, always using New-Item --- docs/PSJekyll/Site/get_Draft.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 docs/PSJekyll/Site/get_Draft.md diff --git a/docs/PSJekyll/Site/get_Draft.md b/docs/PSJekyll/Site/get_Draft.md new file mode 100644 index 0000000..a72ecd4 --- /dev/null +++ b/docs/PSJekyll/Site/get_Draft.md @@ -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. + +--- From d12d43e63d83baa918b72b7fdcc812141cd263da Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Wed, 9 Oct 2024 04:02:38 +0000 Subject: [PATCH 4/5] docs: PSJekyll.Site.get/set_Draft ( Fixes #42, Fixes #49 ) Adding docs, always using New-Item --- docs/PSJekyll/Site/set_Draft.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 docs/PSJekyll/Site/set_Draft.md diff --git a/docs/PSJekyll/Site/set_Draft.md b/docs/PSJekyll/Site/set_Draft.md new file mode 100644 index 0000000..bf20a9c --- /dev/null +++ b/docs/PSJekyll/Site/set_Draft.md @@ -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. + +--- From dfcad2a32c0e23c0eddcfd7746029f092719bcfc Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Wed, 9 Oct 2024 04:02:41 +0000 Subject: [PATCH 5/5] docs: PSJekyll.Site.get/set_Draft ( Fixes #42, Fixes #49 ) Adding docs, always using New-Item --- docs/_data/PSModuleInfo.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/_data/PSModuleInfo.json b/docs/_data/PSModuleInfo.json index 82f209c..9d611ac 100644 --- a/docs/_data/PSModuleInfo.json +++ b/docs/_data/PSModuleInfo.json @@ -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" } } } \ No newline at end of file