Skip to content

Commit

Permalink
Version 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dennykorsukewitz committed Feb 8, 2023
1 parent fa3884e commit e03efbd
Show file tree
Hide file tree
Showing 55 changed files with 262 additions and 97 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/badges.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
name: Badges

on:
# Runs on pushes targeting the default branch
push:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
Badges:
name: Badges
runs-on: ubuntu-22.04 # ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
env:
fetch-depth: "1"
with:
path: repository

- name: Get Badge Data
run: |
SNIPPETS_TOTAL=$(find repository/snippets/ -type f | wc -l)
SNIPPETS_FUNCTIONS=$(find repository/snippets/Functions -type f | wc -l)
SNIPPETS_OBJECTMANAGER=$(find repository/snippets/ObjectManager -type f | wc -l)
SNIPPETS_MODULES=$(find repository/snippets/Modules -type f | wc -l)
SNIPPETS_GENERATED=$((SNIPPETS_FUNCTIONS + SNIPPETS_OBJECTMANAGER + SNIPPETS_MODULES))
SNIPPETS_STATIC=$((SNIPPETS_TOTAL - SNIPPETS_GENERATED))
{
echo "SNIPPETS_TOTAL=$SNIPPETS_TOTAL"
echo "SNIPPETS_GENERATED=$SNIPPETS_GENERATED"
echo "SNIPPETS_STATIC=$SNIPPETS_STATIC"
} >> "$GITHUB_ENV"
- name: Create Total Snippet Counter Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST }}
gistID: e2729bfd9b81d9c032ded617a3f924e7
filename: ${{ github.event.repository.name }}:snippets-total.json
label: Snippets Total
message: ${{ env.SNIPPETS_TOTAL }}
color: blue

- name: Create Generated Snippet Counter Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST }}
gistID: e2729bfd9b81d9c032ded617a3f924e7
filename: ${{ github.event.repository.name }}:snippets-generated.json
label: Snippets Generated
message: ${{ env.SNIPPETS_GENERATED }}
color: blue

- name: Create Static Snippet Counter Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST }}
gistID: e2729bfd9b81d9c032ded617a3f924e7
filename: ${{ github.event.repository.name }}:snippets-static.json
label: Snippets Static
message: ${{ env.SNIPPETS_STATIC }}
color: blue
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.env
coverage
node_modules
1 change: 0 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.vscode/**
.vscode-test/**
.gitignore
vsc-extension-quickstart.md
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

All notable changes to the "Znuny (DK4Znuny-VisualStudioCode)" extension will be documented in this file.

## [1.0.2]

- Snippets
- Escaped '\$' to use scalarref (scalar reference)
- Escaped '\@' to use arrayref (array reference)
- Escaped '\%' to use hashref (hash reference)
- Escaped '\&' to use coderef (code reference)
- Escaped '\*' to use globref (glob reference)
- Applied new escaped strings to snippets

## [1.0.1]

- Snippets
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ Znuny (DK4Znuny-VisualStudioCode) is an extension that helps you to make Znuny d

| Versions | Status |
| ------ | ------ |
| ![GitHub label version](https://img.shields.io/github/labels/dennykorsukewitz/DK4/dev) | [![GitHub commits since tagged version](https://img.shields.io/github/commits-since/dennykorsukewitz/DK4Znuny-VisualStudioCode/1.0.1/dev)](https://github.com/dennykorsukewitz/DK4Znuny-VisualStudioCode/compare/1.0.1...dev) ![GitHub Workflow Lint](https://github.com/dennykorsukewitz/DK4Znuny-VisualStudioCode/actions/workflows/lint.yml/badge.svg?branch=dev&style=flat&label=Lint) ![GitHub Workflow Pages](https://github.com/dennykorsukewitz/DK4Znuny-VisualStudioCode/actions/workflows/pages.yml/badge.svg?branch=dev&style=flat&label=GitHub%20Pages) |
| ![GitHub label version](https://img.shields.io/github/labels/dennykorsukewitz/DK4/dev) | [![GitHub commits since tagged version](https://img.shields.io/github/commits-since/dennykorsukewitz/DK4Znuny-VisualStudioCode/1.0.2/dev)](https://github.com/dennykorsukewitz/DK4Znuny-VisualStudioCode/compare/1.0.2...dev) ![GitHub Workflow Lint](https://github.com/dennykorsukewitz/DK4Znuny-VisualStudioCode/actions/workflows/lint.yml/badge.svg?branch=dev&style=flat&label=Lint) ![GitHub Workflow Pages](https://github.com/dennykorsukewitz/DK4Znuny-VisualStudioCode/actions/workflows/pages.yml/badge.svg?branch=dev&style=flat&label=GitHub%20Pages) |

## Features

### Snippets
### Snippets ![Snippets Total Counter](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2Fdennykorsukewitz%2Fe2729bfd9b81d9c032ded617a3f924e7%2Fraw%2F5d77e9225ca53b6853ce4a5eda187b3edffc2426%2FDK4Znuny-VisualStudioCode%3Asnippets-total.json)

Znuny code snippets for fast, consistent and error free coding.

![snippets](doc/images/snippets.gif)

#### Static
#### Static ![Snippets Static Counter](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2Fdennykorsukewitz%2Fe2729bfd9b81d9c032ded617a3f924e7%2Fraw%2F5d77e9225ca53b6853ce4a5eda187b3edffc2426%2FDK4Znuny-VisualStudioCode%3Asnippets-static.json)

Statically created snippets.

Expand All @@ -39,7 +39,7 @@ Statically created snippets.
- Selenium
- VariableCheck

#### Generated
#### Generated ![Snippets Generated Counter](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2Fdennykorsukewitz%2Fe2729bfd9b81d9c032ded617a3f924e7%2Fraw%2F5d77e9225ca53b6853ce4a5eda187b3edffc2426%2FDK4Znuny-VisualStudioCode%3Asnippets-generated.json)

Snippets created generically using the existing perl POD.

Expand Down
26 changes: 22 additions & 4 deletions bin/znuny.GenerateVSCSnippets.pl
Original file line number Diff line number Diff line change
Expand Up @@ -943,15 +943,33 @@ =head2 _PrepareContent()
sub _PrepareContent {
my ( $Content ) = @_;

# $ => \\$ (in json) => \$ (in VSC)
# $ => \\$ (in code-snippets json) => \$ (in VSC)
$Content =~ s{\$}{\\\\\$}g;

# } => \\} (in json) => \} (in VSC)
$Content =~ s{\}}{\\\\\}}g;
# \\\$ => \\\\$ (in code-snippets json) => \\$ (in VSC)
$Content =~ s{ \\\\\\\$}{ \\\\\\\\\\\\\$}g;

# \@ => \\@ (in code-snippets json) => \@ (in VSC)
$Content =~ s{\\@}{\\\\\@}g;

# \% => \\% (in code-snippets json) => \% (in VSC)
$Content =~ s{\\%}{\\\\\%}g;

# \& => \\& (in code-snippets json) => \& (in VSC)
$Content =~ s{\\&}{\\\\\&}g;

# " => \\" (in json) => \" (in VSC)
# \* => \\* (in code-snippets json) => \* (in VSC)
$Content =~ s{\\\*}{\\\\\*}g;

# \: => \\: (in code-snippets json) => \* (in VSC)
$Content =~ s{\\\:}{\\\\\:}g;

# " => \\" (in code-snippets json) => \" (in VSC)
$Content =~ s{\"}{\\\\\"}g;

# } => \\} (in code-snippets json) => \} (in VSC)
$Content =~ s{\}}{\\\\\}}g;

# remove all \n and \z
$Content =~ s{\n+\z}{}g;

Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "dk4znuny-visualstudiocode",
"displayName": "Znuny",
"description": "Znuny (DK4Znuny-VisualStudioCode) is an extension that helps you to make Znuny development less painful.",
"version": "1.0.1",
"version": "1.0.2",
"publisher": "dennykorsukewitz",
"icon": "doc/images/icon.png",
"license": "SEE LICENSE IN LICENSE",
Expand All @@ -20,7 +20,7 @@
"url": "https://github.com/sponsors/dennykorsukewitz"
},
"keywords": [
"OTRS", "Znuny", "Snippets"
"OTRS", "Znuny", "Snippets", "Perl"
],
"categories": [
"Snippets"
Expand All @@ -30,7 +30,9 @@
},
"contributes": {
"snippets": [

{
"path": "./snippets/_Test_/znuny.Test.Snippets.code-snippets"
},

{
"language": "xml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"body": [
"${1:\\$DBObject->Do(",
" SQL => \\"INSERT INTO table (name1, name2) VALUES (?, ?)\\",",
" Bind => [ \\\$Var1, \\\$Var2 ],",
" Bind => [ \\\\\\$Var1, \\\\\\$Var2 ],",
");}",
"${2:\\$DBObject->Do( SQL => \\"DELETE FROM table\\" );}",
"${3:\\$DBObject->Do( SQL => \\"INSERT INTO table (name) VALUES ('dog')\\" );}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"${1:\\$DBObject->Prepare(",
" SQL => \\"SELECT id, name, content FROM table WHERE name_a = ? AND name_b = ?\\",",
" Encode => [ 1, 1, 0 ],",
" Bind => [ \\\$Var1, \\\$Var2 ],",
" Bind => [ \\\\\\$Var1, \\\\\\$Var2 ],",
");}",
"${2:\\$DBObject->Prepare(",
" SQL => \\"SELECT id, name, content FROM table\\",",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,22 @@
"my \\$Result = \\$EmailObject->SendExecute(",
" From => \\$RealFrom,",
" To => \\$To, # can be a string with comma separated mail addresses",
" Header => \\\$Param{Header\\},",
" Body => \\\$Param{Body\\},",
" Header => \\\\\\$Param{Header\\},",
" Body => \\\\\\$Param{Body\\},",
" CommunicationLogObject => \\$CommunicationLogObject,",
");}",
"${2:my \\$Result = \\$EmailObject->SendExecute(",
" From => \\$RealFrom,",
" To => \@ToArray,",
" Header => \\\$Param{Header\\},",
" Body => \\\$Param{Body\\},",
" To => \\$To, # can be a string with comma separated mail addresses",
" Header => \\\\\\$Param{Header\\},",
" Body => \\\\\\$Param{Body\\},",
" CommunicationLogObject => \\$CommunicationLogObject,",
");}",
"${3:my \\$Result = \\$EmailObject->SendExecute(",
" From => \\$RealFrom,",
" To => \\@ToArray,",
" Header => \\\\\\$Param{Header\\},",
" Body => \\\\\\$Param{Body\\},",
" CommunicationLogObject => \\$CommunicationLogObject,",
");}",
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"znuny.EncodeObject.ConfigureOutputFileHandle": {
"body": [
"${1:\\$EncodeObject->ConfigureOutputFileHandle( FileHandle => \*STDOUT );}",
"${1:\\$EncodeObject->ConfigureOutputFileHandle( FileHandle => \\*STDOUT );}",
],
"prefix": "znuny.EncodeObject.ConfigureOutputFileHandle",
"description": "6.0, 6.4, 6.5",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"znuny.EncodeObject.EncodeInput": {
"body": [
"${1:\\$EncodeObject->EncodeInput( \\\$String );}",
"${2:\\$EncodeObject->EncodeInput( \@Array );}",
"${1:\\$EncodeObject->EncodeInput( \\\\\\$String );}",
"${2:\\$EncodeObject->EncodeInput( \\@Array );}",
],
"prefix": "znuny.EncodeObject.EncodeInput",
"description": "6.0, 6.4, 6.5",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"znuny.EncodeObject.EncodeOutput": {
"body": [
"${1:\\$EncodeObject->EncodeOutput( \\\$String );}",
"${2:\\$EncodeObject->EncodeOutput( \@Array );}",
"${1:\\$EncodeObject->EncodeOutput( \\\\\\$String );}",
"${2:\\$EncodeObject->EncodeOutput( \\@Array );}",
],
"prefix": "znuny.EncodeObject.EncodeOutput",
"description": "6.0, 6.4, 6.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"znuny.HTMLUtilsObject.EmbeddedImagesExtract": {
"body": [
"${1:\\$HTMLUtilsObject->EmbeddedImagesExtract(",
" DocumentRef => \\\$Body,",
" AttachmentsRef => \@Attachments,",
" DocumentRef => \\\\\\$Body,",
" AttachmentsRef => \\@Attachments,",
");}",
],
"prefix": "znuny.HTMLUtilsObject.EmbeddedImagesExtract",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
" TargetAdd => 1, # add target=\\"_blank\\" to all existing \\"<a href\\"",
");}",
"${2:my \\$HTMLWithLinksRef = \\$HTMLUtilsObject->LinkQuote(",
" String => \\\$HTMLStringRef,",
" String => \\\\\\$HTMLStringRef,",
");}",
],
"prefix": "znuny.HTMLUtilsObject.LinkQuote",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
" ReplacementStr => 'string', # optional, string to show instead of applet, object, embed, svg and img tags",
");}",
"${2:my %Safe = \\$HTMLUtilsObject->Safety(",
" String => \\\$HTMLStringRef,",
" String => \\\\\\$HTMLStringRef,",
" NoApplet => 1,",
" NoObject => 1,",
" NoEmbed => 1,",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"sub Request {",
" my \\$JSONString = '{\\"Results\\":{\\},\\"ErrorMessage\\":\\"\\",\\"Success\\":1\\}';",
" return (",
" Content => \\\$JSONString,",
" Content => \\\\\\$JSONString,",
" Status => '200 OK',",
" );",
"\\}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"body": [
"${1:my \\$Success = \\$LastViewsObject->Update(",
" SessionID => \\$Self->{SessionID\\},",
" Request => \%Request,",
" Request => \\%Request,",
");}",
],
"prefix": "znuny.LastViewsObject.Update",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
" LinkFeature => 0, # do some URL detections",
");}",
"${2:my \\$HTMLStringRef = \\$LayoutObject->Ascii2Html(",
" Text => \\\$String,",
" Text => \\\\\\$String,",
");}",
],
"prefix": "znuny.LayoutObject.Ascii2Html",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
" \\},",
" InvolvedAgents => {",
" Name => 'Involved in this ticket',",
" Values => \%HashWithData,",
" Values => \\%HashWithData,",
" \\},",
" \\},",
" ExpandFilters => 1, # (optional) default 0 (0|1) expand filters list by default",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
" Total => scalar @{ \\$CustomerUserIDsRef \\}, # total number of customer user ids",
" View => \\$Self->{View\\}, # optional, the default value is 'AddressBook'",
" Filter => 'All',",
" Filters => \%NavBarFilter,",
" Filters => \\%NavBarFilter,",
" LinkFilter => \\$LinkFilter,",
" TitleName => 'Overview: CustomerUsers',",
" TitleValue => \\$Self->{Filter\\},",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
" String => \\$HTMLString,",
");}",
"${2:my \\$HTMLWithLinksRef = \\$LayoutObject->HTMLLinkQuote(",
" String => \\\$HTMLString,",
" String => \\\\\\$HTMLString,",
");}",
],
"prefix": "znuny.LayoutObject.HTMLLinkQuote",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
" Text => \\$HTMLWithOutLinks,",
");}",
"${2:my \\$HTMLWithLinksRef = \\$LayoutObject->LinkQuote(",
" Text => \\\$HTMLWithOutLinksRef,",
" Text => \\\\\\$HTMLWithOutLinksRef,",
");}",
],
"prefix": "znuny.LayoutObject.LinkQuote",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"body": [
"${1:my \\$HTML = \\$LayoutObject->Output(",
" Template => '<b>[% Data.SomeKey | html %]</b>',",
" Data => \%Param,",
" Data => \\%Param,",
");}",
"${2:my \\$HTML = \\$LayoutObject->Output(",
" TemplateFile => 'AdminLog.tt',",
" Data => \%Param,",
" Data => \\%Param,",
" AJAX => 1,",
");}",
"${3:my \\$HTML = \\$LayoutObject->Output(",
" TemplateFile => 'AdminLog.tt',",
" Data => \%Param,",
" Data => \\%Param,",
");}",
],
"prefix": "znuny.LayoutObject.Output",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
" ContentType => 'text/html; charset=\\"iso-8859-1\\"',",
" \\},",
" URL => 'AgentTicketAttachment;Subaction=HTMLView;TicketID=123;ArticleID=123;FileID=',",
" Attachments => \%AttachmentListOfInlineAttachments,",
" Attachments => \\%AttachmentListOfInlineAttachments,",
"",
" LoadInlineContent => 0, # Serve the document including all inline content. WARNING: This might be dangerous.",
"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
");}",
"${5:my @FilesInDirectory = \\$MainObject->DirectoryRead(",
" Directory => '/tmp',",
" Filter => \@MyFilters,",
" Filter => \\@MyFilters,",
");}",
],
"prefix": "znuny.MainObject.DirectoryRead",
Expand Down
Loading

0 comments on commit e03efbd

Please sign in to comment.