feat: support more input

This commit is contained in:
Reinaldy Rafli 2021-10-28 11:33:33 +07:00
parent 058137622a
commit 70b2bd0d1f
No known key found for this signature in database
GPG Key ID: CFDB9400255D8CB6
4 changed files with 369 additions and 10 deletions

12
.github/codegen.js vendored
View File

@ -7,11 +7,11 @@ const fs = require('fs/promises');
// the letters array just to be a single value.
const letters =
[
`
__ _
/ _\` |
| (_| |
\\__,_|
` _
(_)
| |
| |
|_|
`,
]
@ -26,5 +26,5 @@ const letters =
}
output += "}\n";
}
await fs.writeFile('./../generated.go', output, { encoding: 'utf-8' });
await fs.writeFile('./generated.go', output, { encoding: 'utf-8' });
})();

View File

@ -35,7 +35,7 @@ The usage is pretty straight forward, on your Go file:
// or
output = asciitxt.WithConfig("Hello world", &asciitxt.Config{
output = asciitxt.WithConfig("Hello world", asciitxt.Config{
Style: asciitxt.StyleStandard,
})
}

View File

@ -7,14 +7,22 @@ import (
)
func TestNew(t *testing.T) {
s := asciitxt.New("THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG 0123456789 _ the quick brown fox jumps over the lazy dog")
s := asciitxt.New("THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG 0123456789 æ` the quick brown fox jumps over the lazy dog")
if s == "" {
t.Error("should not be empty")
}
}
func TestWithConfig(t *testing.T) {
s := asciitxt.WithConfig("THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG 0123456789 _ the quick brown fox jumps over the lazy dog", asciitxt.Config{})
s := asciitxt.WithConfig("THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG 0123456789 æ` the quick brown fox jumps over the lazy dog", asciitxt.Config{})
if s == "" {
t.Error("should not be empty")
}
}
func TestSymbols(t *testing.T) {
s := asciitxt.WithConfig(`!"#$%&'()*+,-./:;<=>?[\]^_{|}~¡¢£¥¨§©±`, asciitxt.Config{Style: asciitxt.StyleStandard})
if s == "" {
t.Error("should not be empty")

View File

@ -572,6 +572,357 @@ func getStandardLetter(letter string) []string {
` `,
` `,
}
case "+":
return []string{
` `,
` _ `,
` _| |_ `,
` |_ _|`,
` |_| `,
` `,
}
case "-":
return []string{
` `,
` `,
` _____ `,
` |_____|`,
` `,
` `,
}
case "_":
return []string{
` `,
` `,
` `,
` `,
` _____ `,
` |_____|`,
}
case "=":
return []string{
` `,
` _____ `,
` |_____|`,
` |_____|`,
` `,
` `,
}
case "!":
return []string{
` _ `,
` | |`,
` | |`,
` |_|`,
` (_)`,
` `,
}
case "@":
return []string{
` ____ `,
` / __ \ `,
" / / _` |",
` | | (_| |`,
` \ \__,_|`,
` \____/ `,
}
case "#":
return []string{
` _ _ `,
` _| || |_ `,
` |_ .. _|`,
` |_ _|`,
` |_||_| `,
` `,
}
case "$":
return []string{
` _ `,
` | | `,
` / __)`,
` \__ \`,
` ( /`,
` |_| `,
}
case "%":
return []string{
` _ __`,
` (_)/ /`,
` / / `,
` / /_ `,
` /_/(_)`,
` `,
}
case "^":
return []string{
` /\ `,
` |/\|`,
` `,
` `,
` `,
` `,
}
case "&":
return []string{
` ___ `,
` ( _ ) `,
` / _ \/\`,
` | (_> <`,
` \___/\/`,
` `,
}
case "*":
return []string{
` `,
` __/\__`,
` \ /`,
` /_ _\`,
` \/ `,
` `,
}
case "(":
return []string{
` __`,
` / /`,
` | | `,
` | | `,
` | | `,
` \_\`,
}
case ")":
return []string{
` __ `,
` \ \ `,
` | |`,
` | |`,
` | |`,
` /_/ `,
}
case ",":
return []string{
` `,
` `,
` `,
` _ `,
` ( )`,
` |/ `,
}
case ".":
return []string{
` `,
` `,
` `,
` _ `,
` (_)`,
` `,
}
case "<":
return []string{
` __`,
` / /`,
` / / `,
` \ \ `,
` \_\`,
` `,
}
case ">":
return []string{
` __ `,
` \ \ `,
` \ \`,
` / /`,
` /_/ `,
` `,
}
case "?":
return []string{
` ___ `,
` |__ \`,
` / /`,
` |_| `,
` (_) `,
` `,
}
case "/":
return []string{
` __`,
` / /`,
` / / `,
` / / `,
` /_/ `,
` `,
}
case ";":
return []string{
` `,
` _ `,
` (_)`,
` _ `,
` ( )`,
` |/ `,
}
case ":":
return []string{
` `,
` _ `,
` (_)`,
` _ `,
` (_)`,
` `,
}
case "'":
return []string{
` _ `,
` ( )`,
` |/ `,
` `,
` `,
` `,
}
case "\"":
return []string{
` _ _ `,
` ( | )`,
` V V `,
` `,
` `,
` `,
}
case "[":
return []string{
` __ `,
` | _|`,
` | | `,
` | | `,
` | | `,
` |__|`,
}
case "]":
return []string{
` __ `,
` |_ |`,
` | |`,
` | |`,
` | |`,
` |__|`,
}
case "{":
return []string{
` __`,
` / /`,
` | | `,
` < < `,
` | | `,
` \_\`,
}
case "}":
return []string{
` __ `,
` \ \ `,
` | | `,
` > >`,
` | | `,
` /_/ `,
}
case "\\":
return []string{
` __ `,
` \ \ `,
` \ \ `,
` \ \ `,
` \_\`,
` `,
}
case "|":
return []string{
` _ `,
` | |`,
` | |`,
` | |`,
` | |`,
` |_|`,
}
case "`":
return []string{
` _ `,
` ( )`,
` \|`,
` `,
` `,
` `,
}
case "~":
return []string{
` /\/|`,
` |/\/ `,
` `,
` `,
` `,
` `,
}
case "¡":
return []string{
` _ `,
` (_)`,
` | |`,
` | |`,
` |_|`,
` `,
}
case "¢":
return []string{
` _ `,
` | | `,
` / __)`,
` | (__ `,
` \ )`,
` |_| `,
}
case "£":
return []string{
` ___ `,
` / ,_\ `,
` _| |_ `,
` | |___ `,
` (_,____|`,
` `,
}
case "¥":
return []string{
` __ __ `,
` \ V / `,
` |__ __|`,
` |__ __|`,
` |_| `,
` `,
}
case "©":
return []string{
` _____ `,
` / ___ \ `,
` / / __| \ `,
` | | (__ |`,
` \ \___| / `,
` \_____/ `,
}
case "±":
return []string{
` _ `,
` _| |_ `,
` |_ _|`,
` _|_|_ `,
` |_____|`,
` `,
}
case "§":
return []string{
` __ `,
` _/ _)`,
` / \ \ `,
` \ \\ \`,
` \ \_/`,
` (__/ `,
}
default:
return []string{
``,