!if $base=1
 factor_html=1
 !exit
!endif

factor_html=
myn=!eval $base
factor=!translate ; to $\
$ in $factor
factor=!trim $factor
fn=!linecnt $factor
t=1
!if $myn != NaN
 !for k from 1 to $fn
  ii=!line $k of $factor
  base=!item 1 of $ii
  power=!item 2 of $ii
  !if $t>1
    factor_html=$factor_html <font color=green>&times;</font>
  !endif
  factor_html=$factor_html $base
  !ifval $power != 1
    factor_html=$factor_html<sup>$power</sup>
  !endif
  t=!eval $t+1
 !next k
!else
 !ifval $content != 1
  !if / isin $content
   factor_html=($content)
  !else
   factor_html=$content
  !endif
 !endif
 !for k from 1 to $fn
  ii=!line $k of $factor
  base=!item 1 of $ii
  base=!htmlmath $base
  power=!item 2 of $ii
  factor_html=$factor_html ($base)
  !ifval $power != 1
    factor_html=$factor_html<sup>$power</sup>
  !endif
  t=!eval $t+1
 !next k
!endif 

