Skip to content
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

EZOut 1.9.8 #96

Merged
merged 27 commits into from
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ab0724f
Format-RichText: Supporting -Hyperlink (Fixes #93)
StartAutomating Dec 14, 2022
7a11715
Format-RichText: Supporting -Hyperlink (Fixes #93)
Dec 14, 2022
68b2225
Format-RichText: Supporting -Hyperlink (Fixes #93)
Dec 14, 2022
8875215
Format-RichText: Supporting -Hyperlink (Fixes #93)
Dec 14, 2022
a2dc904
Format-RichText: Supporting -Hyperlink (Fixes #93)
Dec 14, 2022
2cdaee9
Format-RichText: Supporting -Hyperlink (Fixes #93)
Dec 14, 2022
cf062e2
Format-RichText: Outputting a single string (Fixes #95)
StartAutomating Dec 15, 2022
0de32bf
Format-RichText: Outputting a single string (Fixes #95)
Dec 15, 2022
6d60dbb
Format-RichText: Outputting a single string (Fixes #95)
Dec 15, 2022
cab84ae
Format-RichText: Outputting a single string (Fixes #95)
Dec 15, 2022
6c3f7e9
Format-RichText: Outputting a single string (Fixes #95)
Dec 15, 2022
9e370a8
Updating Module Version [1.9.8] and CHANGELOG
StartAutomating Dec 15, 2022
655f085
Updating Module Version [1.9.8] and CHANGELOG
Dec 15, 2022
8d7d941
Updating Module Version [1.9.8] and CHANGELOG
Dec 15, 2022
b5cb866
Updating Module Version [1.9.8] and CHANGELOG
Dec 15, 2022
1e37abb
Updating Module Version [1.9.8] and CHANGELOG
Dec 15, 2022
482bf8d
Updating Module Version [1.9.8] and CHANGELOG
StartAutomating Dec 15, 2022
6c09a57
Merge branch 'EZ-Hyperlinks' of https://github.com/StartAutomating/EZ…
StartAutomating Dec 15, 2022
27d5a0c
Merge branch 'EZ-Hyperlinks' of https://github.com/StartAutomating/EZ…
Dec 15, 2022
8bc097a
Merge branch 'EZ-Hyperlinks' of https://github.com/StartAutomating/EZ…
Dec 15, 2022
3fce8e3
Merge branch 'EZ-Hyperlinks' of https://github.com/StartAutomating/EZ…
Dec 15, 2022
035ed93
Format-RichText/Format-Markdown: Standardizing parameter names
StartAutomating Dec 15, 2022
fe85ed4
Merge branch 'EZ-Hyperlinks' of https://github.com/StartAutomating/EZ…
StartAutomating Dec 15, 2022
006b23a
Merge branch 'EZ-Hyperlinks' of https://github.com/StartAutomating/EZ…
Dec 15, 2022
1327040
Merge branch 'EZ-Hyperlinks' of https://github.com/StartAutomating/EZ…
Dec 15, 2022
fdb0252
Merge branch 'EZ-Hyperlinks' of https://github.com/StartAutomating/EZ…
Dec 15, 2022
49cf978
Merge branch 'EZ-Hyperlinks' of https://github.com/StartAutomating/EZ…
Dec 15, 2022
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 1.9.8:

* Format-RichText now supports -Hyperlink (Fixes #93)
* Format-RichText now outputs a single string (Fixes #95)

---

## 1.9.7:
* Format-RichText now unbolds bright colors (Fixes #88)
* Now Blogging with GitPub (Fixes #89)
Expand Down
124 changes: 80 additions & 44 deletions EZOut.format.ps1xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-16"?>
<!-- Generated with EZOut 1.9.7: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
<!-- Generated with EZOut 1.9.8: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
<Configuration>
<SelectionSets>
<SelectionSet>
Expand Down Expand Up @@ -984,12 +984,13 @@ if ($Request -or $Host.UI.SupportsHTML) {
if (-not ($canUseANSI -or $canUseHTML)) { return $false}
return $true
})]
[OutputType([string])]
param(
# The input object
[Parameter(ValueFromPipeline)]
[PSObject]
$InputObject,

# The foreground color
[string]$ForegroundColor,

Expand Down Expand Up @@ -1024,6 +1025,12 @@ if ($Request -or $Host.UI.SupportsHTML) {

# If set, will invert text
[switch]$Invert,

# If provided, will create a hyperlink to a given uri
[Alias('Hyperlink', 'Href')]
[uri]
$Link,

# If set, will not clear formatting
[switch]$NoClear
)
Expand All @@ -1039,8 +1046,10 @@ if ($Request -or $Host.UI.SupportsHTML) {
$standardColors = 'Black', 'Red', 'Green', 'Yellow', 'Blue','Magenta', 'Cyan', 'White'
$brightColors = 'BrightBlack', 'BrightRed', 'BrightGreen', 'BrightYellow', 'BrightBlue','BrightMagenta', 'BrightCyan', 'BrightWhite'

$allOutput = @()

$n =0
$cssClasses = @()
$cssClasses = @()
$colorAttributes =
@(:nextColor foreach ($hc in $ForegroundColor,$BackgroundColor) {
$n++
Expand Down Expand Up @@ -1217,6 +1226,17 @@ if ($Request -or $Host.UI.SupportsHTML) {
if ($canUseHTML) { "border-bottom: 3px double;"}
elseif ($canUseANSI) {'' +$esc + "[21m" }
}

if ($Hyperlink) {
if ($canUseHTML) {
# Hyperlinks need to be a nested element
# so we will not add it to style attributes for HTML
}
elseif ($canUseANSI) {
# For ANSI,
'' + $esc + ']8m;;' + $Hyperlink + $esc + '\'
}
}

)

Expand All @@ -1226,61 +1246,76 @@ if ($Request -or $Host.UI.SupportsHTML) {
if ($styleAttributes) { " style='$($styleAttributes -join ';')'"}
)$(
if ($cssClasses) { " class='$($cssClasses -join ' ')'"}
)&gt;"
)&gt;" + $(
if ($Hyperlink) {
"&lt;a href='$hyperLink'&gt;"
}
)
} elseif ($canUseANSI) {
$styleAttributes -join ''
}
}

process {
if ($header) {
"$header" + "$(if ($inputObject) { $inputObject | Out-String})".Trim()
}
elseif ($inputObject) {
($inputObject | Out-String).Trim()
}
$allOutput +=
if ($header) {
"$header" + "$(if ($inputObject) { $inputObject | Out-String})".Trim()
}
elseif ($inputObject) {
($inputObject | Out-String).Trim()
}
}

end {

if (-not $NoClear) {
if ($canUseHTML) {
"&lt;/span&gt;"
}
elseif ($canUseANSI) {
if ($Bold -or $Faint -or $colorAttributes -match '\[1;') {
"$esc[22m"
}
if ($Italic) {
"$esc[23m"
}
if ($Underline -or $doubleUnderline) {
"$esc[24m"
}
if ($Blink) {
"$esc[25m"
}
if ($Invert) {
"$esc[27m"
}
if ($hide) {
"$esc[28m"
}
if ($Strikethru) {
"$esc[29m"
}
if ($ForegroundColor) {
"$esc[39m"
}
if ($BackgroundColor) {
"$esc[49m"
$allOutput +=
if ($canUseHTML) {
if ($Hyperlink) {
"&lt;/a&gt;"
}
"&lt;/span&gt;"
}

if (-not ($Underline -or $Bold -or $Invert -or $ForegroundColor -or $BackgroundColor)) {
'' + $esc + '[0m'
elseif ($canUseANSI) {
if ($Bold -or $Faint -or $colorAttributes -match '\[1;') {
"$esc[22m"
}
if ($Italic) {
"$esc[23m"
}
if ($Underline -or $doubleUnderline) {
"$esc[24m"
}
if ($Blink) {
"$esc[25m"
}
if ($Invert) {
"$esc[27m"
}
if ($hide) {
"$esc[28m"
}
if ($Strikethru) {
"$esc[29m"
}
if ($ForegroundColor) {
"$esc[39m"
}
if ($BackgroundColor) {
"$esc[49m"
}

if ($Hyperlink) {
"$esc]8;;$esc\"
}

if (-not ($Underline -or $Bold -or $Invert -or $ForegroundColor -or $BackgroundColor)) {
'' + $esc + '[0m'
}
}
}
}

$allOutput -join ''
}
</ScriptBlock>
</ExpressionBinding>
Expand Down Expand Up @@ -1615,6 +1650,7 @@ $BackgroundColor

# If set, will create a link. The -InputObject will be used as the link content
[Parameter(ValueFromPipelineByPropertyName)]
[Alias('Hyperlink', 'Href')]
[string]
$Link,

Expand Down
10 changes: 9 additions & 1 deletion EZOut.psd1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@{
ModuleToProcess = 'EZOut.psm1'
ModuleVersion = '1.9.7'
ModuleVersion = '1.9.8'
GUID = 'cef786f0-8a0b-4a5d-a2c6-b433095354cd'
Author = 'James Brundage'
CompanyName = 'Start-Automating'
Expand Down Expand Up @@ -65,6 +65,14 @@

Tags = '.ps1xml', 'Format','Output','Types', 'Colorized'
ReleaseNotes = @'
## 1.9.8:

* Format-RichText now supports -Hyperlink (Fixes #93)
* Format-RichText now outputs a single string (Fixes #95)

---


## 1.9.7:
* Format-RichText now unbolds bright colors (Fixes #88)
* Now Blogging with GitPub (Fixes #89)
Expand Down
1 change: 1 addition & 0 deletions Format-Markdown.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ function Format-Markdown

# If set, will create a link. The -InputObject will be used as the link content
[Parameter(ValueFromPipelineByPropertyName)]
[Alias('Hyperlink', 'Href')]
[string]
$Link,

Expand Down
Loading