-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pwsh scripts to generate markdown artifact(s) for VT support across
conhost and windows terminal
- Loading branch information
Showing
3 changed files
with
388 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
#requires -version 6.1 | ||
|
||
[cmdletbinding()] | ||
param( | ||
$solutionRoot = "..\..", | ||
$interfacePath = @(join-path $solutionRoot "src\terminal\adapter\ITermDispatch.hpp"), | ||
$consoleAdapterPath = $(join-path $solutionRoot "src\terminal\adapter\adaptDispatch.hpp"), | ||
$terminalAdapterPath = $(join-path $solutionRoot "src\cascadia\terminalcore\terminaldispatch.hpp") | ||
) | ||
|
||
$base = @{} | ||
$conhost = @{} | ||
$terminal = @{} | ||
$prefix = "https://vt100.net/docs/vt510-rm/" | ||
|
||
# extract base interface | ||
$baseScanner = [regex]'(?x)virtual\s\w+\s(?<method>\w+)(?s)[^;]+;(?-s).*?(?<seq>(?<=\/\/\s).+)' | ||
|
||
$baseScanner.Matches((get-content -raw $interfacePath)) | foreach-object { | ||
$match = $_ | ||
$_.groups["seq"].value.split(",") | ForEach-Object { | ||
$base[$_.trim()] = $match.groups["method"].value | ||
} | ||
} | ||
|
||
# match overrides of ITermDispatch | ||
$scanner = [regex]'(?x)\s+\w+\s(?<method>\w+)(?s)[^;]+override;' | ||
|
||
$scanner.Matches((Get-Content -raw $consoleAdapterPath)) | ForEach-Object { | ||
#write-verbose $_.groups[0].value | ||
$conhost[$_.groups["method"].value] = $true | ||
} | ||
|
||
$scanner.Matches((Get-Content -raw $terminalAdapterPath)) | ForEach-Object { | ||
#write-verbose $_.groups[0].value | ||
$terminal[$_.groups["method"].value] = $true | ||
} | ||
|
||
# "Sequence","Associated","Description","Origin","Heading","Subheading", "ImplementedBy", "ConsoleHost","Terminal" | ||
$sequences = import-csv .\sequences.csv | ||
|
||
$heading = $null | ||
$subheading = $null | ||
|
||
@" | ||
# VT Function Support | ||
## Table of Contents | ||
* [Code Extension Functions](#code-extension-functions) | ||
* [Control Coding](#control-coding) | ||
* [Character Coding](#character-coding) | ||
* [Graphic Character Sets](#graphic-character-sets) | ||
* [Terminal Management Functions](#terminal-management-functions) | ||
* [Identification, status, and Initialization](#identification-status-and-initialization) | ||
* [Emulations](#emulations) | ||
* [Set-Up](#set-up) | ||
* [Display Coordinate System and Addressing](#display-coordinate-system-and-addressing) | ||
* [Active Position and Cursor](#active-position-and-cursor) | ||
* [Margins and Scrolling](#margins-and-scrolling) | ||
* [Cursor Movement](#cursor-movement) | ||
* [Horizontal Tabulation](#horizontal-tabulation) | ||
* [Page Size and Arrangement](#page-size-and-arrangement) | ||
* [Page Movement](#page-movement) | ||
* [Status Display](#status-display) | ||
* [Right to Left](#right-to-left) | ||
* [Window Management](#window-management) | ||
* [Visual Attributes and Renditions](#visual-attributes-and-renditions) | ||
* [Line Renditions](#line-renditions) | ||
* [Character Renditions](#character-renditions) | ||
* [Audible Indicators](#audible-indicators) | ||
* [Mode States](#mode-states) | ||
* [ANSI](#ansi) | ||
* [DEC Private](#dec-private) | ||
* [Editing Functions](#editing-functions) | ||
* [OLTP Features](#oltp-features) | ||
* [Rectangular Area Operations](#rectangular-area-operations) | ||
* [Data Integrity](#data-integrity) | ||
* [Macros](#macros) | ||
* [Saving and Restoring Terminal State](#saving-and-restoring-terminal-state) | ||
* [Cursor Save Buffer](#cursor-save-buffer) | ||
* [Terminal State Interrogation](#terminal-state-interrogation) | ||
* [Keyboard Processing Functions](#keyboard-processing-functions) | ||
* [Soft Key Mapping (UDK)](#soft-key-mapping-udk) | ||
* [Soft Fonts (DRCS)](#soft-fonts-drcs) | ||
* [Printing](#printing) | ||
* [Terminal Communication and Synchronization](#terminal-communication-and-synchronization) | ||
* [Text Locator Extension](#text-locator-extension) | ||
* [Session Management Extension](#session-management-extension) | ||
* [Documented Exceptions](#documented-exceptions) | ||
$($sequences | ForEach-Object { | ||
if ($method = $base[$_.sequence]) { | ||
$_.ImplementedBy = $method | ||
$_.ConsoleHost = $conhost[$method] | ||
$_.Terminal = $terminal[$method] | ||
} | ||
# "Sequence","Associated","Description","Origin","Heading","Subheading", "ImplementedBy", "ConsoleHost","Terminal" | ||
$shouldRenderHeader = $false | ||
if ($heading -ne $_.heading) { | ||
$heading = $_.heading | ||
@" | ||
## $heading | ||
"@ | ||
$shouldRenderHeader = $true | ||
} | ||
if ($subheading -ne $_.subheading) { | ||
$subheading = $_.subheading | ||
@" | ||
### $subheading | ||
"@ | ||
$shouldRenderHeader = $true | ||
} | ||
if ($shouldRenderHeader) { | ||
@" | ||
|Symbol|Function|Origin 🖳|Console Host|Terminal| | ||
|:-|:--|:--:|:--:|:--:| | ||
"@ | ||
} | ||
@" | ||
|[$($_.Sequence)]($prefix$($_.sequence).html)|$($_.description)|$($_.origin)|$(if ($_.consolehost) {"✓"})|$(if ($_.terminal) {"✓"})| | ||
"@ | ||
}) | ||
--- | ||
Generated on $(get-date -DisplayHint DateTime) | ||
"@ |
Oops, something went wrong.