Subversion Repositories wimsdev

Rev

Rev 13998 | Rev 15658 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3332 bpr 1
!if $wims_read_parm!=slib_header
2
 !goto proc
3
!endif
4158 bpr 4
 
4349 bpr 5
slib_author=Bernadette, Perrin-Riou
4171 bpr 6
 
12959 bpr 7
slib_example=[def1,2,3,4,5;def2,5,6,7;def3,2,3,4;def4,2,3,4],1,TH=[;1]\
13998 bpr 8
[1,2;allo;mer],wimsborder\
9
[1,2;allo,make your own css],4 wimsborder\
8710 bpr 10
[1;30000],center\
13998 bpr 11
[\(x^4\),\(x^3);\(\frac{x}{y}\),3],center wimsborder\
12
[\(x^4\),\(x^3) < a;\(\frac{x}{y}\),3],wimscenter wimsborder\
9223 bpr 13
[\(x^4\),\(x^3);\(\frac{x}{y}\),3],wimsnoborder wimscenter 1\
8710 bpr 14
[1,2,3;4,5,6;5,2,3]\
15
[def1,2,3,4;def2,5,6,7;def3,2,3,4],1,TH=[;1,3]\
16
[def1,2,3;def2,5,6;def3,2,3],1,TH=[1;]\
17
[def1,2,3;def2,5,6;def3,2,3;def4,2,3;def5,2,3],1,TH=[2,4;3]\
13998 bpr 18
[def1,2,3;def2,5,6;def3,2,3;def4,2,3;def5,2,3],1 wimsborder,TH=[2,4;3] CAPTION="texte en caption"\
13301 bpr 19
[a,b,c,x,*,z,*;*,*,*,y,z,u,t;1,2,3,4,5,*,*;1,2,3,4,5,6,7;],1 wimsborder, ROWSPAN=[1,1,2;1,2,2;1,3,3] COLSPAN=[1,4,2;1,6,2;3,4,3]\
20
[def1,1,2,3,4;*,4,5,6,4;def3,2,3,4;*,2,3,4,5;*,2,3,4,5],wimsborder,ROWSPAN=[1,1,2;3,1,3]\
12959 bpr 21
[def1,1,2,3;*,5,6,7;def3,2,3,4;def4,2,3,4],wimsborder,ROWSPAN=[1,1,2]\
22
[def1,*,1,2;*,*,5,6;def3,2,3,4;def4,2,3,4],wimsborder,ROWSPAN=[1,1,2] COLSPAN=[1,1,2]\
23
 
8710 bpr 24
slib_require=pari
3332 bpr 25
!exit
26
 
27
:proc
12959 bpr 28
!set slib_joker=*
8710 bpr 29
!reset slib_align slib_class slib_option slib_id
30
!distribute items $wims_read_parm into slib_matrix,slib_id,slib_option
3332 bpr 31
slib_matrix=!declosing $slib_matrix
8710 bpr 32
!if center iswordof $slib_id
33
  slib_align=$ style="text-align:center"
9223 bpr 34
  slib_id=!replace internal center by in $slib_id
4171 bpr 35
!endif
10921 bpr 36
!for slib_cl in wimscenter, wimsborder, wimsnoborder, wimstable
12959 bpr 37
  !if $slib_cl iswordof $slib_id
38
    slib_class=!append word $slib_cl to $slib_class
39
    slib_id=!replace internal $slib_cl by in $slib_id
40
  !endif
9223 bpr 41
!next
42
 
43
slib_id=!nospace $slib_id
44
slib_class=class="$slib_class wims_matrix$slib_id"
10907 bpr 45
slib_caption=!getopt CAPTION in $slib_option
12959 bpr 46
slib_rowspan=!getopt ROWSPAN in $slib_option
47
slib_rowspan=!exec pari [$slib_rowspan]
48
slib_rowspan1=!column 1 of $slib_rowspan
49
slib_colspan=!getopt COLSPAN in $slib_option
50
slib_colspan=!exec pari [$slib_colspan]
51
slib_colspan2=!column 2 of $slib_colspan
8710 bpr 52
slib_th=!getopt TH in $slib_option
53
slib_th=!declosing $slib_th
54
slib_tr=$(slib_th[1;])
55
slib_td=$(slib_th[2;])
15635 obado 56
slib_out=<div class="table-scroll"><table $slib_class>
10907 bpr 57
!if $slib_caption!=$empty
58
  slib_out=$slib_out<caption>$slib_caption</caption>
59
!endif
10921 bpr 60
slib_matrix=!lines2rows $slib_matrix
3332 bpr 61
slib_cnt=
62
slib_colcnt=0
10921 bpr 63
slib_rowcnt=!rowcnt $slib_matrix
64
 
3332 bpr 65
!for slib_a =1 to $slib_rowcnt
66
  slib_cnt_p=!itemcnt $(slib_matrix[$slib_a;])
67
  slib_cnt=!append item $slib_cnt_p to $slib_cnt
68
  slib_colcnt=$[max($slib_colcnt,$slib_cnt_p)]
69
!next
8710 bpr 70
slib_tt=td
3332 bpr 71
!for slib_a =1 to $slib_rowcnt
72
  slib_out_p=
8710 bpr 73
  !if $slib_a isitemof $slib_tr
74
    slib_tt=th
75
  !endif
12959 bpr 76
  !if $slib_a isin $slib_rowspan1
77
      slib_rs=!select $slib_rowspan where column 1 = $slib_a
78
  !endif
3332 bpr 79
  !for slib_b=1 to $slib_colcnt
12959 bpr 80
    !if $slib_rs!=$empty and $slib_b isitemof $(slib_rs[;2])
81
      slib_tmp2=!select $slib_rowspan where column 1 = $slib_a and column 2 = $slib_b
82
      slib_tmp2=$ rowspan="$(slib_rs[1;3])"
83
    !endif
84
    slib_cs=!select $slib_colspan where column 2 = $slib_b and column 1 = $slib_a
85
    !if $slib_cs!=$empty
86
      slib_tmp3=$ colspan="$(slib_cs[1;3])"
87
    !endif
11075 bpr 88
    slib_tmp=$(slib_matrix[$slib_a;$slib_b])
12959 bpr 89
    !if $slib_tmp=$slib_joker
90
      !goto nextcell
91
    !endif
8710 bpr 92
    !if $slib_b isitemof $slib_td or $slib_tt=th
93
      slib_tt1=th
94
    !else
95
      slib_tt1=td
96
    !endif
12959 bpr 97
    slib_out_p=!append word <$slib_tt1$slib_align$slib_tmp2$slib_tmp3>$slib_tmp</$slib_tt1> to $slib_out_p
98
    :nextcell
99
    !reset slib_tt1 slib_tmp slib_tmp2 slib_tmp3 slib_cs
3332 bpr 100
  !next
101
  slib_out=$slib_out\
102
  <tr>$slib_out_p</tr>
8710 bpr 103
  slib_tt=td
12959 bpr 104
  !reset slib_rs slib_cs
105
  :nextcol
3332 bpr 106
!next
107
slib_out=$slib_out\
15635 obado 108
</table></div>