# Transforms vector-presented polynomial into html style.

poly=!trim $poly
n=!itemnum $poly
poly_html=
!for i from $n to 1 step -1
  k=!item $i of $poly
  !if $k != 0
    !ifval $i<$n and $k>=0 
      poly_html=$poly_html+
    !endif
    !ifval $k=0
      poly_html=$poly_html(
    !endif
    p=!eval $n-$i
    !if $k = -1 and $p != 0
      poly_html=$poly_html-
    !else
      !if $k != 1 or $p=0
        poly_html=$poly_html$k
      !endif
    !endif
    !ifval $k=0
      poly_html=$poly_html)
    !endif
    !ifval $p>0
      poly_html=$(poly_html)x
      !ifval $p>1
        poly_html=$poly_html<sup>$p</sup>
      !endif
    !endif
  !endif
!next i

poly_html=!replace + by $ + $ in $poly_html
poly_html=!replace - by $ - $ in $poly_html


