Given an input of an ASCII art picture, output the ASCII art italicized.
To italicize the ASCII art:
Insert zero spaces before the last line, one space before the second-last line, two spaces before the third-last line, etc.
Remove any extra leading whitespace that may have been created. That is, if each line has at least
n
spaces preceding it, removen
spaces from the beginning of each line.Replace all
\
s with|
, all|
s with/
, and all/
s with_
. Keep existing_
s the same.The input is guaranteed to contain only the characters
\|/_
and space.
For example, the input
/\/\/\ /\/\/\ /\/\/\ /\/\/\
/\ /\ /\ /\ /\ /\
/\/\/\ /\/\/\ /\ /\ /\/\
/\ /\ /\ /\ /\
/\ /\ /\/\/\ /\/\/\
must output
_|_|_| _|_|_| _|_|_| _|_|_|
_| _| _| _| _| _|
_|_|_| _|_|_| _| _| _|_|
_| _| _| _| _|
_| _| _|_|_| _|_|_|
which in turn, provided as input, outputs
_/_/_/ _/_/_/ _/_/_/ _/_/_/
_/ _/ _/ _/ _/ _/
_/_/_/ _/_/_/ _/ _/ _/_/
_/ _/ _/ _/ _/
_/ _/ _/_/_/ _/_/_/
which would output
______ ______ ______ ______
__ __ __ __ __ __
______ ______ __ __ ____
__ __ __ __ __
__ __ ______ ______
Input and output may be either a single string (with optional trailing newline) or an array of lines.
Since this is code-golf, the shortest code in bytes will win.
Extra test cases:
|||||
/////
\\\\\
_____
/////
_____
|||||
_____
________
________
(that is, input of empty string results in output of empty string)