diff --git a/.github/workflows/DockEmoji.yml b/.github/workflows/DockEmoji.yml new file mode 100644 index 0000000..8eccdd0 --- /dev/null +++ b/.github/workflows/DockEmoji.yml @@ -0,0 +1,41 @@ + +name: Dock Emoji +on: + push: + branches: + - main + - master + paths-ignore: + - 'docs/**' + - '*.help.txt' + - '*.md' +jobs: + DockEmoji: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Log in to the Container registry + uses: docker/login-action@master + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@master + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Build and push Docker image + uses: docker/build-push-action@master + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} +env: + IMAGE_NAME: ${{ github.repository }} + REGISTRY: ghcr.io diff --git a/Build/GitHub/Jobs/DockEmoji.psd1 b/Build/GitHub/Jobs/DockEmoji.psd1 new file mode 100644 index 0000000..5a9ea02 --- /dev/null +++ b/Build/GitHub/Jobs/DockEmoji.psd1 @@ -0,0 +1,41 @@ +@{ + 'runs-on'='ubuntu-latest' + 'permissions' = @{ + 'contents'='read' + 'packages'='write' + } + steps = @( + @{ + 'name'='Checkout repository' + 'uses'='actions/checkout@v4' + }, + @{ + 'name'='Log in to the Container registry' + 'uses'='docker/login-action@master' + 'with'=@{ + 'registry'='${{ env.REGISTRY }}' + 'username'='${{ github.actor }}' + 'password'='${{ secrets.GITHUB_TOKEN }}' + } + }, + @{ + 'name'='Extract metadata (tags, labels) for Docker' + 'id'='meta' + 'uses'='docker/metadata-action@master' + 'with'=@{ + 'images'='${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}' + } + }, + @{ + 'name'='Build and push Docker image' + 'uses'='docker/build-push-action@master' + 'with'=@{ + 'context'='.' + 'push'='true' + 'tags'='${{ steps.meta.outputs.tags }}' + 'labels'='${{ steps.meta.outputs.labels }}' + } + } + + ) +} \ No newline at end of file diff --git a/Build/GitHub/On/PushToMain.psd1 b/Build/GitHub/On/PushToMain.psd1 new file mode 100644 index 0000000..63811ab --- /dev/null +++ b/Build/GitHub/On/PushToMain.psd1 @@ -0,0 +1,6 @@ +@{ + push = @{ + branches =@('main','master') + "paths-ignore" = @("docs/**","*.help.txt", "*.md") + } +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 2912500..9325e92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## Emoji 0.1.5: + +* Emoji.Symbol.HTML (#66) +* ... and new views (#62) +* Emoji Docker Support (#63, #64, #65) + +--- + ## Emoji 0.1.4: * Emoji.Symbol.CSS (#58) diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..17dbe08 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM mcr.microsoft.com/powershell +ENV PSModulePath ./Modules +COPY . ./Modules/Emoji +RUN pwsh -c "New-Item -Path /root/.config/powershell/Microsoft.PowerShell_profile.ps1 -Value 'Import-Module Emoji' -Force" + diff --git a/Emoji.format.ps1xml b/Emoji.format.ps1xml index 0e6a320..5b1d1d2 100644 --- a/Emoji.format.ps1xml +++ b/Emoji.format.ps1xml @@ -296,6 +296,75 @@ + + Html + + Emoji.Symbol + + + + + + + + + + + Left + + + + + + + Emoji + + + + + $CellColorValue = $($Script:_LastCellStyle ='Foreground.Green';$Script:_LastCellStyle) + + $CellColorValue = if ($psStyle) { + @(foreach ($styleProp in $CellColorValue) { + if ($styleProp -match '^\$') { + $ExecutionContext.SessionState.InvokeCommand.InvokeScript($styleProp) + } + elseif ($styleProp -match '\.') { + $targetObject = $psStyle + foreach ($dotProperty in $styleProp -split '(?<!\.)\.') { + if ( + ($targetObject.psobject.Members['Item'] -and + ($targetObject.Item -is [Management.Automation.PSMethodInfo]) + ) -or + $targetObject -is [Collections.IDictionary] + ) { + $targetObject = $targetObject[$dotProperty] + } else { + $targetObject = $targetObject.$dotProperty + } + } + if ($targetObject) { + $targetObject + } + } + else { + $psStyle.$styleProp + } + }) -join '' + } + + $output = . {$_.'Name'} + @($CellColorValue; $output; $psStyle.Reset) -join '' + + + + HTML + + + + + + Emoji.Symbol @@ -502,5 +571,22 @@ + + HTML + + Emoji.Symbol + + + + + + + HTML + + + + + + \ No newline at end of file diff --git a/Emoji.psd1 b/Emoji.psd1 index d1d7944..a834136 100644 --- a/Emoji.psd1 +++ b/Emoji.psd1 @@ -1,5 +1,5 @@ @{ - ModuleVersion = '0.1.4' + ModuleVersion = '0.1.5' RootModule = 'Emoji.psm1' Description = '⟩⚡PowerShell Emoji 😎😉😍🥰🤔😟' @@ -18,17 +18,19 @@ LicenseURI = 'https://github.com/StartAutomating/blob/main/LICENSE' Tags = 'Emoji', 'PowerShell' ReleaseNotes = @' -## Emoji 0.1.4: +## Emoji 0.1.5: -* Emoji.Symbol.CSS (#58) -* ... and new views (#60) -* Also making color more tolerant of strict mode (#59) +* Emoji.Symbol.HTML (#66) +* ... and new views (#62) +* Emoji Docker Support (#63, #64, #65) --- Full history in [CHANGELOG](https://github.com/StartAutomating/Emoji/blob/main/CHANGELOG.md) -Like it? [Star It](https://github.com/StartAutomating/Emoji)! Love it? [Support It!](https://github.com/sponsors/StartAutomating) +> Like It? [Star It](https://github.com/StartAutomating/Emoji) +> Love It? [Support It](https://github.com/sponsors/StartAutomating) + '@ } Recommends = 'Posh','PipeScript','EZOut' diff --git a/Emoji.types.ps1xml b/Emoji.types.ps1xml index efa6475..660b146 100644 --- a/Emoji.types.ps1xml +++ b/Emoji.types.ps1xml @@ -607,6 +607,23 @@ $className = $this.Name.ToLower() -replace '\s','-' + + HTML + + <# +.SYNOPSIS + Gets an Emoji as HTML +.DESCRIPTION + Gets an Emoji as an HTML span +.EXAMPLE + (Get-Emoji -Name 'Grinning Face').HTML +#> +param() + +"<span>$([Web.HttpUtility]::HtmlEncode($this.Emoji))</span>" + + + Number diff --git a/README.md b/README.md index 4e7bd55..a350fd7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,13 @@ +
+emoji + + + +
+❤️ + +
+ # Emoji ⟩⚡PowerShell Emoji 😎😉😍🥰🤔😟 diff --git a/README.ps.md b/README.ps.md index de29f37..1a7e67d 100644 --- a/README.ps.md +++ b/README.ps.md @@ -1,3 +1,13 @@ +
+emoji + + + +
+❤️ + +
+ # Emoji ⟩⚡PowerShell Emoji 😎😉😍🥰🤔😟 diff --git a/Types/Emoji.Symbol/Emoji.Symbol.format.ps1 b/Types/Emoji.Symbol/Emoji.Symbol.format.ps1 index 12b6d6a..b12b819 100644 --- a/Types/Emoji.Symbol/Emoji.Symbol.format.ps1 +++ b/Types/Emoji.Symbol/Emoji.Symbol.format.ps1 @@ -28,6 +28,12 @@ Write-FormatView -TypeName Emoji.Symbol -Property CSS -AlignProperty @{ CSS = 'Left' } -AutoSize -Name CSS +Write-FormatView -TypeName Emoji.Symbol -Property Emoji, Name, HTML -AlignProperty @{ + Html = 'Left' +} -AutoSize -Name Html -StyleProperty @{ + Name = 'Foreground.Green' +} + Write-FormatView -TypeName Emoji.Symbol -Action { Write-FormatViewExpression -ScriptBlock { $_.Emoji.PadRight(4) @@ -59,4 +65,8 @@ Write-FormatView -TypeName Emoji.Symbol -Action { Write-FormatViewExpression -Text "*/" Write-FormatViewExpression -Newline Write-FormatViewExpression -Property CSS -} -Name CSS \ No newline at end of file +} -Name CSS + +Write-FormatView -TypeName Emoji.Symbol -Action { + Write-FormatViewExpression -Property HTML +} -Name HTML \ No newline at end of file diff --git a/Types/Emoji.Symbol/get_HTML.ps1 b/Types/Emoji.Symbol/get_HTML.ps1 new file mode 100644 index 0000000..d43e221 --- /dev/null +++ b/Types/Emoji.Symbol/get_HTML.ps1 @@ -0,0 +1,11 @@ +<# +.SYNOPSIS + Gets an Emoji as HTML +.DESCRIPTION + Gets an Emoji as an HTML span +.EXAMPLE + (Get-Emoji -Name 'Grinning Face').HTML +#> +param() + +"$([Web.HttpUtility]::HtmlEncode($this.Emoji))"