slope lines by tabasa

l=(n=gets(p).split"\n").size\x0d
s=0\x0d
q=n.map{|i|s+=1;[s,i.size-s]}\x0d
q.map{|i,j|j}.max.downto(1-l){|i|\x0d
 t=q.select{|k,l|l>=i}.map{|m,o|m}.max\x0d
 d=" "*(i+l)*2\x0d
 t.times{|e|\x0d
  r=n[e][i+e,1]\x0d
  d+="   "+((r==nil||i+e<0||r=="")?" ": r)\x0d
 }\x0d
 puts d[l*2+3..-1]\x0d
}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page