1*504c13e8SAndreas Gohr<?php 2*504c13e8SAndreas Gohr 3*504c13e8SAndreas Gohrnamespace dokuwiki\test\Parsing\ParserMode; 4*504c13e8SAndreas Gohr 5*504c13e8SAndreas Gohruse dokuwiki\Parsing\ParserMode\Eol; 6*504c13e8SAndreas Gohruse dokuwiki\Parsing\ParserMode\Footnote; 7*504c13e8SAndreas Gohruse dokuwiki\Parsing\ParserMode\Strong; 8*504c13e8SAndreas Gohruse dokuwiki\Parsing\ParserMode\Linebreak; 9*504c13e8SAndreas Gohruse dokuwiki\Parsing\ParserMode\Table; 10*504c13e8SAndreas Gohruse dokuwiki\Parsing\ParserMode\Unformatted; 11*504c13e8SAndreas Gohr 12*504c13e8SAndreas Gohrclass TableTest extends ParserTestBase 13*504c13e8SAndreas Gohr{ 14*504c13e8SAndreas Gohr 15*504c13e8SAndreas Gohr function testTable() { 16*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 17*504c13e8SAndreas Gohr $this->P->parse(' 18*504c13e8SAndreas Gohrabc 19*504c13e8SAndreas Gohr| Row 0 Col 1 | Row 0 Col 2 | Row 0 Col 3 | 20*504c13e8SAndreas Gohr| Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3 | 21*504c13e8SAndreas Gohrdef'); 22*504c13e8SAndreas Gohr $calls = [ 23*504c13e8SAndreas Gohr ['document_start',[]], 24*504c13e8SAndreas Gohr ['p_open',[]], 25*504c13e8SAndreas Gohr ['cdata',["\n\nabc"]], 26*504c13e8SAndreas Gohr ['p_close',[]], 27*504c13e8SAndreas Gohr ['table_open',[3, 2, 6]], 28*504c13e8SAndreas Gohr ['tablerow_open',[]], 29*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 30*504c13e8SAndreas Gohr ['cdata',[' Row 0 Col 1 ']], 31*504c13e8SAndreas Gohr ['tablecell_close',[]], 32*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 33*504c13e8SAndreas Gohr ['cdata',[' Row 0 Col 2 ']], 34*504c13e8SAndreas Gohr ['tablecell_close',[]], 35*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 36*504c13e8SAndreas Gohr ['cdata',[' Row 0 Col 3 ']], 37*504c13e8SAndreas Gohr ['tablecell_close',[]], 38*504c13e8SAndreas Gohr ['tablerow_close',[]], 39*504c13e8SAndreas Gohr ['tablerow_open',[]], 40*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 41*504c13e8SAndreas Gohr ['cdata',[' Row 1 Col 1 ']], 42*504c13e8SAndreas Gohr ['tablecell_close',[]], 43*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 44*504c13e8SAndreas Gohr ['cdata',[' Row 1 Col 2 ']], 45*504c13e8SAndreas Gohr ['tablecell_close',[]], 46*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 47*504c13e8SAndreas Gohr ['cdata',[' Row 1 Col 3 ']], 48*504c13e8SAndreas Gohr ['tablecell_close',[]], 49*504c13e8SAndreas Gohr ['tablerow_close',[]], 50*504c13e8SAndreas Gohr ['table_close',[121]], 51*504c13e8SAndreas Gohr ['p_open',[]], 52*504c13e8SAndreas Gohr ['cdata',['def']], 53*504c13e8SAndreas Gohr ['p_close',[]], 54*504c13e8SAndreas Gohr ['document_end',[]], 55*504c13e8SAndreas Gohr ]; 56*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 57*504c13e8SAndreas Gohr } 58*504c13e8SAndreas Gohr 59*504c13e8SAndreas Gohr function testTableWinEOL() { 60*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 61*504c13e8SAndreas Gohr $this->P->parse("\r\nabc\r\n| Row 0 Col 1 | Row 0 Col 2 | Row 0 Col 3 |\r\n| Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3 |\r\ndef"); 62*504c13e8SAndreas Gohr $calls = [ 63*504c13e8SAndreas Gohr ['document_start',[]], 64*504c13e8SAndreas Gohr ['p_open',[]], 65*504c13e8SAndreas Gohr ['cdata',["\n\nabc"]], 66*504c13e8SAndreas Gohr ['p_close',[]], 67*504c13e8SAndreas Gohr ['table_open',[3, 2, 6]], 68*504c13e8SAndreas Gohr ['tablerow_open',[]], 69*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 70*504c13e8SAndreas Gohr ['cdata',[' Row 0 Col 1 ']], 71*504c13e8SAndreas Gohr ['tablecell_close',[]], 72*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 73*504c13e8SAndreas Gohr ['cdata',[' Row 0 Col 2 ']], 74*504c13e8SAndreas Gohr ['tablecell_close',[]], 75*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 76*504c13e8SAndreas Gohr ['cdata',[' Row 0 Col 3 ']], 77*504c13e8SAndreas Gohr ['tablecell_close',[]], 78*504c13e8SAndreas Gohr ['tablerow_close',[]], 79*504c13e8SAndreas Gohr ['tablerow_open',[]], 80*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 81*504c13e8SAndreas Gohr ['cdata',[' Row 1 Col 1 ']], 82*504c13e8SAndreas Gohr ['tablecell_close',[]], 83*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 84*504c13e8SAndreas Gohr ['cdata',[' Row 1 Col 2 ']], 85*504c13e8SAndreas Gohr ['tablecell_close',[]], 86*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 87*504c13e8SAndreas Gohr ['cdata',[' Row 1 Col 3 ']], 88*504c13e8SAndreas Gohr ['tablecell_close',[]], 89*504c13e8SAndreas Gohr ['tablerow_close',[]], 90*504c13e8SAndreas Gohr ['table_close',[121]], 91*504c13e8SAndreas Gohr ['p_open',[]], 92*504c13e8SAndreas Gohr ['cdata',['def']], 93*504c13e8SAndreas Gohr ['p_close',[]], 94*504c13e8SAndreas Gohr ['document_end',[]], 95*504c13e8SAndreas Gohr ]; 96*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 97*504c13e8SAndreas Gohr } 98*504c13e8SAndreas Gohr 99*504c13e8SAndreas Gohr function testEmptyTable() { 100*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 101*504c13e8SAndreas Gohr $this->P->parse(' 102*504c13e8SAndreas Gohrabc 103*504c13e8SAndreas Gohr| 104*504c13e8SAndreas Gohrdef'); 105*504c13e8SAndreas Gohr 106*504c13e8SAndreas Gohr $calls = [ 107*504c13e8SAndreas Gohr ['document_start',[]], 108*504c13e8SAndreas Gohr ['p_open',[]], 109*504c13e8SAndreas Gohr ['cdata',["\n\nabc"]], 110*504c13e8SAndreas Gohr ['p_close',[]], 111*504c13e8SAndreas Gohr ['table_open',[0, 1, 6]], 112*504c13e8SAndreas Gohr ['tablerow_open',[]], 113*504c13e8SAndreas Gohr ['tablerow_close',[]], 114*504c13e8SAndreas Gohr ['table_close',[7]], 115*504c13e8SAndreas Gohr ['p_open',[]], 116*504c13e8SAndreas Gohr ['cdata',['def']], 117*504c13e8SAndreas Gohr ['p_close',[]], 118*504c13e8SAndreas Gohr ['document_end',[]], 119*504c13e8SAndreas Gohr ]; 120*504c13e8SAndreas Gohr 121*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 122*504c13e8SAndreas Gohr } 123*504c13e8SAndreas Gohr 124*504c13e8SAndreas Gohr function testTableHeaders() { 125*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 126*504c13e8SAndreas Gohr $this->P->parse(' 127*504c13e8SAndreas Gohrabc 128*504c13e8SAndreas Gohr^ X | Y ^ Z | 129*504c13e8SAndreas Gohrdef'); 130*504c13e8SAndreas Gohr 131*504c13e8SAndreas Gohr $calls = [ 132*504c13e8SAndreas Gohr ['document_start',[]], 133*504c13e8SAndreas Gohr ['p_open',[]], 134*504c13e8SAndreas Gohr ['cdata',["\n\nabc"]], 135*504c13e8SAndreas Gohr ['p_close',[]], 136*504c13e8SAndreas Gohr ['table_open',[3, 1, 6]], 137*504c13e8SAndreas Gohr ['tablerow_open',[]], 138*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 139*504c13e8SAndreas Gohr ['cdata',[' X ']], 140*504c13e8SAndreas Gohr ['tableheader_close',[]], 141*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 142*504c13e8SAndreas Gohr ['cdata',[' Y ']], 143*504c13e8SAndreas Gohr ['tablecell_close',[]], 144*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 145*504c13e8SAndreas Gohr ['cdata',[' Z ']], 146*504c13e8SAndreas Gohr ['tableheader_close',[]], 147*504c13e8SAndreas Gohr ['tablerow_close',[]], 148*504c13e8SAndreas Gohr ['table_close',[19]], 149*504c13e8SAndreas Gohr ['p_open',[]], 150*504c13e8SAndreas Gohr ['cdata',['def']], 151*504c13e8SAndreas Gohr ['p_close',[]], 152*504c13e8SAndreas Gohr ['document_end',[]], 153*504c13e8SAndreas Gohr ]; 154*504c13e8SAndreas Gohr 155*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 156*504c13e8SAndreas Gohr 157*504c13e8SAndreas Gohr } 158*504c13e8SAndreas Gohr 159*504c13e8SAndreas Gohr function testTableHead() { 160*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 161*504c13e8SAndreas Gohr $this->P->parse(' 162*504c13e8SAndreas Gohrabc 163*504c13e8SAndreas Gohr^ X ^ Y ^ Z ^ 164*504c13e8SAndreas Gohr| x | y | z | 165*504c13e8SAndreas Gohrdef'); 166*504c13e8SAndreas Gohr 167*504c13e8SAndreas Gohr $calls = [ 168*504c13e8SAndreas Gohr ['document_start',[]], 169*504c13e8SAndreas Gohr ['p_open',[]], 170*504c13e8SAndreas Gohr ['cdata',["\n\nabc"]], 171*504c13e8SAndreas Gohr ['p_close',[]], 172*504c13e8SAndreas Gohr ['table_open',[3, 2, 6]], 173*504c13e8SAndreas Gohr ['tablethead_open',[]], 174*504c13e8SAndreas Gohr ['tablerow_open',[]], 175*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 176*504c13e8SAndreas Gohr ['cdata',[' X ']], 177*504c13e8SAndreas Gohr ['tableheader_close',[]], 178*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 179*504c13e8SAndreas Gohr ['cdata',[' Y ']], 180*504c13e8SAndreas Gohr ['tableheader_close',[]], 181*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 182*504c13e8SAndreas Gohr ['cdata',[' Z ']], 183*504c13e8SAndreas Gohr ['tableheader_close',[]], 184*504c13e8SAndreas Gohr ['tablerow_close',[]], 185*504c13e8SAndreas Gohr ['tablethead_close',[]], 186*504c13e8SAndreas Gohr ['tablerow_open',[]], 187*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 188*504c13e8SAndreas Gohr ['cdata',[' x ']], 189*504c13e8SAndreas Gohr ['tablecell_close',[]], 190*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 191*504c13e8SAndreas Gohr ['cdata',[' y ']], 192*504c13e8SAndreas Gohr ['tablecell_close',[]], 193*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 194*504c13e8SAndreas Gohr ['cdata',[' z ']], 195*504c13e8SAndreas Gohr ['tablecell_close',[]], 196*504c13e8SAndreas Gohr ['tablerow_close',[]], 197*504c13e8SAndreas Gohr ['table_close',[33]], 198*504c13e8SAndreas Gohr ['p_open',[]], 199*504c13e8SAndreas Gohr ['cdata',['def']], 200*504c13e8SAndreas Gohr ['p_close',[]], 201*504c13e8SAndreas Gohr ['document_end',[]], 202*504c13e8SAndreas Gohr ]; 203*504c13e8SAndreas Gohr 204*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 205*504c13e8SAndreas Gohr 206*504c13e8SAndreas Gohr } 207*504c13e8SAndreas Gohr 208*504c13e8SAndreas Gohr function testTableHeadOneRowTable() { 209*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 210*504c13e8SAndreas Gohr $this->P->parse(' 211*504c13e8SAndreas Gohrabc 212*504c13e8SAndreas Gohr^ X ^ Y ^ Z ^ 213*504c13e8SAndreas Gohrdef'); 214*504c13e8SAndreas Gohr 215*504c13e8SAndreas Gohr $calls = [ 216*504c13e8SAndreas Gohr ['document_start',[]], 217*504c13e8SAndreas Gohr ['p_open',[]], 218*504c13e8SAndreas Gohr ['cdata',["\n\nabc"]], 219*504c13e8SAndreas Gohr ['p_close',[]], 220*504c13e8SAndreas Gohr ['table_open',[3, 1, 6]], 221*504c13e8SAndreas Gohr ['tablerow_open',[]], 222*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 223*504c13e8SAndreas Gohr ['cdata',[' X ']], 224*504c13e8SAndreas Gohr ['tableheader_close',[]], 225*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 226*504c13e8SAndreas Gohr ['cdata',[' Y ']], 227*504c13e8SAndreas Gohr ['tableheader_close',[]], 228*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 229*504c13e8SAndreas Gohr ['cdata',[' Z ']], 230*504c13e8SAndreas Gohr ['tableheader_close',[]], 231*504c13e8SAndreas Gohr ['tablerow_close',[]], 232*504c13e8SAndreas Gohr ['table_close',[19]], 233*504c13e8SAndreas Gohr ['p_open',[]], 234*504c13e8SAndreas Gohr ['cdata',['def']], 235*504c13e8SAndreas Gohr ['p_close',[]], 236*504c13e8SAndreas Gohr ['document_end',[]], 237*504c13e8SAndreas Gohr ]; 238*504c13e8SAndreas Gohr 239*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 240*504c13e8SAndreas Gohr 241*504c13e8SAndreas Gohr } 242*504c13e8SAndreas Gohr 243*504c13e8SAndreas Gohr function testTableHeadMultiline() { 244*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 245*504c13e8SAndreas Gohr $this->P->parse(' 246*504c13e8SAndreas Gohrabc 247*504c13e8SAndreas Gohr^ X1 ^ Y1 ^ Z1 ^ 248*504c13e8SAndreas Gohr^ X2 ^ Y2 ^ Z2 ^ 249*504c13e8SAndreas Gohr| A | B | C | 250*504c13e8SAndreas Gohrdef'); 251*504c13e8SAndreas Gohr 252*504c13e8SAndreas Gohr $calls = [ 253*504c13e8SAndreas Gohr ['document_start',[]], 254*504c13e8SAndreas Gohr ['p_open',[]], 255*504c13e8SAndreas Gohr ['cdata',["\n\nabc"]], 256*504c13e8SAndreas Gohr ['p_close',[]], 257*504c13e8SAndreas Gohr ['table_open',[3, 3, 6]], 258*504c13e8SAndreas Gohr ['tablethead_open',[]], 259*504c13e8SAndreas Gohr ['tablerow_open',[]], 260*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 261*504c13e8SAndreas Gohr ['cdata',[' X1 ']], 262*504c13e8SAndreas Gohr ['tableheader_close',[]], 263*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 264*504c13e8SAndreas Gohr ['cdata',[' Y1 ']], 265*504c13e8SAndreas Gohr ['tableheader_close',[]], 266*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 267*504c13e8SAndreas Gohr ['cdata',[' Z1 ']], 268*504c13e8SAndreas Gohr ['tableheader_close',[]], 269*504c13e8SAndreas Gohr ['tablerow_close',[]], 270*504c13e8SAndreas Gohr ['tablerow_open',[]], 271*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 272*504c13e8SAndreas Gohr ['cdata',[' X2 ']], 273*504c13e8SAndreas Gohr ['tableheader_close',[]], 274*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 275*504c13e8SAndreas Gohr ['cdata',[' Y2 ']], 276*504c13e8SAndreas Gohr ['tableheader_close',[]], 277*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 278*504c13e8SAndreas Gohr ['cdata',[' Z2 ']], 279*504c13e8SAndreas Gohr ['tableheader_close',[]], 280*504c13e8SAndreas Gohr ['tablerow_close',[]], 281*504c13e8SAndreas Gohr ['tablethead_close',[]], 282*504c13e8SAndreas Gohr ['tablerow_open',[]], 283*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 284*504c13e8SAndreas Gohr ['cdata',[' A ']], 285*504c13e8SAndreas Gohr ['tablecell_close',[]], 286*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 287*504c13e8SAndreas Gohr ['cdata',[' B ']], 288*504c13e8SAndreas Gohr ['tablecell_close',[]], 289*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 290*504c13e8SAndreas Gohr ['cdata',[' C ']], 291*504c13e8SAndreas Gohr ['tablecell_close',[]], 292*504c13e8SAndreas Gohr ['tablerow_close',[]], 293*504c13e8SAndreas Gohr ['table_close',[53]], 294*504c13e8SAndreas Gohr ['p_open',[]], 295*504c13e8SAndreas Gohr ['cdata',['def']], 296*504c13e8SAndreas Gohr ['p_close',[]], 297*504c13e8SAndreas Gohr ['document_end',[]], 298*504c13e8SAndreas Gohr ]; 299*504c13e8SAndreas Gohr 300*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 301*504c13e8SAndreas Gohr 302*504c13e8SAndreas Gohr } 303*504c13e8SAndreas Gohr 304*504c13e8SAndreas Gohr function testCellAlignment() { 305*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 306*504c13e8SAndreas Gohr $this->P->parse(' 307*504c13e8SAndreas Gohrabc 308*504c13e8SAndreas Gohr| X | Y ^ Z | 309*504c13e8SAndreas Gohrdef'); 310*504c13e8SAndreas Gohr 311*504c13e8SAndreas Gohr $calls = [ 312*504c13e8SAndreas Gohr ['document_start',[]], 313*504c13e8SAndreas Gohr ['p_open',[]], 314*504c13e8SAndreas Gohr ['cdata',["\n\nabc"]], 315*504c13e8SAndreas Gohr ['p_close',[]], 316*504c13e8SAndreas Gohr ['table_open',[3, 1, 6]], 317*504c13e8SAndreas Gohr ['tablerow_open',[]], 318*504c13e8SAndreas Gohr ['tablecell_open',[1,'right',1]], 319*504c13e8SAndreas Gohr ['cdata',[' X ']], 320*504c13e8SAndreas Gohr ['tablecell_close',[]], 321*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 322*504c13e8SAndreas Gohr ['cdata',[' Y ']], 323*504c13e8SAndreas Gohr ['tablecell_close',[]], 324*504c13e8SAndreas Gohr ['tableheader_open',[1,'center',1]], 325*504c13e8SAndreas Gohr ['cdata',[' Z ']], 326*504c13e8SAndreas Gohr ['tableheader_close',[]], 327*504c13e8SAndreas Gohr ['tablerow_close',[]], 328*504c13e8SAndreas Gohr ['table_close',[23]], 329*504c13e8SAndreas Gohr ['p_open',[]], 330*504c13e8SAndreas Gohr ['cdata',['def']], 331*504c13e8SAndreas Gohr ['p_close',[]], 332*504c13e8SAndreas Gohr ['document_end',[]], 333*504c13e8SAndreas Gohr ]; 334*504c13e8SAndreas Gohr 335*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 336*504c13e8SAndreas Gohr } 337*504c13e8SAndreas Gohr 338*504c13e8SAndreas Gohr function testCellSpan() { 339*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 340*504c13e8SAndreas Gohr $this->P->parse(' 341*504c13e8SAndreas Gohrabc 342*504c13e8SAndreas Gohr| d || e | 343*504c13e8SAndreas Gohr| f ^ ^| 344*504c13e8SAndreas Gohr|||| 345*504c13e8SAndreas Gohrdef'); 346*504c13e8SAndreas Gohr 347*504c13e8SAndreas Gohr $calls = [ 348*504c13e8SAndreas Gohr ['document_start',[]], 349*504c13e8SAndreas Gohr ['p_open',[]], 350*504c13e8SAndreas Gohr ['cdata',["\n\nabc"]], 351*504c13e8SAndreas Gohr ['p_close',[]], 352*504c13e8SAndreas Gohr ['table_open',[3, 3, 6]], 353*504c13e8SAndreas Gohr ['tablerow_open',[]], 354*504c13e8SAndreas Gohr ['tablecell_open',[2,'right',1]], 355*504c13e8SAndreas Gohr ['cdata',[' d ']], 356*504c13e8SAndreas Gohr ['tablecell_close',[]], 357*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 358*504c13e8SAndreas Gohr ['cdata',[' e ']], 359*504c13e8SAndreas Gohr ['tablecell_close',[]], 360*504c13e8SAndreas Gohr ['tablerow_close',[]], 361*504c13e8SAndreas Gohr ['tablerow_open',[]], 362*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 363*504c13e8SAndreas Gohr ['cdata',[' f ']], 364*504c13e8SAndreas Gohr ['tablecell_close',[]], 365*504c13e8SAndreas Gohr ['tableheader_open',[2,null,1]], 366*504c13e8SAndreas Gohr ['cdata',[' ']], 367*504c13e8SAndreas Gohr ['tableheader_close',[]], 368*504c13e8SAndreas Gohr ['tablerow_close',[]], 369*504c13e8SAndreas Gohr ['tablerow_open',[]], 370*504c13e8SAndreas Gohr ['tablerow_close',[]], 371*504c13e8SAndreas Gohr ['table_close',[31]], 372*504c13e8SAndreas Gohr ['p_open',[]], 373*504c13e8SAndreas Gohr ['cdata',['def']], 374*504c13e8SAndreas Gohr ['p_close',[]], 375*504c13e8SAndreas Gohr ['document_end',[]], 376*504c13e8SAndreas Gohr ]; 377*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 378*504c13e8SAndreas Gohr } 379*504c13e8SAndreas Gohr 380*504c13e8SAndreas Gohr function testCellRowSpan() { 381*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 382*504c13e8SAndreas Gohr $this->P->parse(' 383*504c13e8SAndreas Gohrabc 384*504c13e8SAndreas Gohr| a | c:::|| 385*504c13e8SAndreas Gohr|:::^ d | e| 386*504c13e8SAndreas Gohr|b ^ ::: |:::f| 387*504c13e8SAndreas Gohrdef'); 388*504c13e8SAndreas Gohr 389*504c13e8SAndreas Gohr $calls = [ 390*504c13e8SAndreas Gohr ['document_start',[]], 391*504c13e8SAndreas Gohr ['p_open',[]], 392*504c13e8SAndreas Gohr ['cdata',["\n\nabc"]], 393*504c13e8SAndreas Gohr ['p_close',[]], 394*504c13e8SAndreas Gohr ['table_open',[3, 3, 6]], 395*504c13e8SAndreas Gohr ['tablerow_open',[]], 396*504c13e8SAndreas Gohr ['tablecell_open',[1,null,2]], 397*504c13e8SAndreas Gohr ['cdata',[' a ']], 398*504c13e8SAndreas Gohr ['tablecell_close',[]], 399*504c13e8SAndreas Gohr ['tablecell_open',[2,'right',1]], 400*504c13e8SAndreas Gohr ['cdata',[' c:::']], 401*504c13e8SAndreas Gohr ['tablecell_close',[]], 402*504c13e8SAndreas Gohr ['tablerow_close',[]], 403*504c13e8SAndreas Gohr ['tablerow_open',[]], 404*504c13e8SAndreas Gohr ['tableheader_open',[1,'left',2]], 405*504c13e8SAndreas Gohr ['cdata',[' d ']], 406*504c13e8SAndreas Gohr ['tableheader_close',[]], 407*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 408*504c13e8SAndreas Gohr ['cdata',[' e']], 409*504c13e8SAndreas Gohr ['tablecell_close',[]], 410*504c13e8SAndreas Gohr ['tablerow_close',[]], 411*504c13e8SAndreas Gohr ['tablerow_open',[]], 412*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 413*504c13e8SAndreas Gohr ['cdata',['b ']], 414*504c13e8SAndreas Gohr ['tablecell_close',[]], 415*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 416*504c13e8SAndreas Gohr ['cdata',[':::f']], 417*504c13e8SAndreas Gohr ['tablecell_close',[]], 418*504c13e8SAndreas Gohr ['tablerow_close',[]], 419*504c13e8SAndreas Gohr ['table_close',[51]], 420*504c13e8SAndreas Gohr ['p_open',[]], 421*504c13e8SAndreas Gohr ['cdata',['def']], 422*504c13e8SAndreas Gohr ['p_close',[]], 423*504c13e8SAndreas Gohr ['document_end',[]], 424*504c13e8SAndreas Gohr ]; 425*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 426*504c13e8SAndreas Gohr } 427*504c13e8SAndreas Gohr 428*504c13e8SAndreas Gohr function testCellRowSpanFirstRow() { 429*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 430*504c13e8SAndreas Gohr $this->P->parse(' 431*504c13e8SAndreas Gohrabc 432*504c13e8SAndreas Gohr|::: ^ d:::^:::| ::: | 433*504c13e8SAndreas Gohr| b ^ e | | ::: | 434*504c13e8SAndreas Gohr|c ^ ::: | |:::| 435*504c13e8SAndreas Gohrdef'); 436*504c13e8SAndreas Gohr 437*504c13e8SAndreas Gohr $calls = [ 438*504c13e8SAndreas Gohr ['document_start',[]], 439*504c13e8SAndreas Gohr ['p_open',[]], 440*504c13e8SAndreas Gohr ['cdata',["\n\nabc"]], 441*504c13e8SAndreas Gohr ['p_close',[]], 442*504c13e8SAndreas Gohr ['table_open',[4, 3, 6]], 443*504c13e8SAndreas Gohr ['tablerow_open',[]], 444*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 445*504c13e8SAndreas Gohr ['cdata',['']], 446*504c13e8SAndreas Gohr ['tablecell_close',[]], 447*504c13e8SAndreas Gohr ['tableheader_open',[1,'right',1]], 448*504c13e8SAndreas Gohr ['cdata',[' d:::']], 449*504c13e8SAndreas Gohr ['tableheader_close',[]], 450*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 451*504c13e8SAndreas Gohr ['cdata',['']], 452*504c13e8SAndreas Gohr ['tableheader_close',[]], 453*504c13e8SAndreas Gohr ['tablecell_open',[1,null,3]], 454*504c13e8SAndreas Gohr ['cdata',['']], 455*504c13e8SAndreas Gohr ['tablecell_close',[]], 456*504c13e8SAndreas Gohr ['tablerow_close',[]], 457*504c13e8SAndreas Gohr ['tablerow_open',[]], 458*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 459*504c13e8SAndreas Gohr ['cdata',[' b ']], 460*504c13e8SAndreas Gohr ['tablecell_close',[]], 461*504c13e8SAndreas Gohr ['tableheader_open',[1,'left',2]], 462*504c13e8SAndreas Gohr ['cdata',[' e ']], 463*504c13e8SAndreas Gohr ['tableheader_close',[]], 464*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 465*504c13e8SAndreas Gohr ['cdata',[' ']], 466*504c13e8SAndreas Gohr ['tablecell_close',[]], 467*504c13e8SAndreas Gohr ['tablerow_close',[]], 468*504c13e8SAndreas Gohr ['tablerow_open',[]], 469*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 470*504c13e8SAndreas Gohr ['cdata',['c ']], 471*504c13e8SAndreas Gohr ['tablecell_close',[]], 472*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 473*504c13e8SAndreas Gohr ['cdata',[' ']], 474*504c13e8SAndreas Gohr ['tablecell_close',[]], 475*504c13e8SAndreas Gohr ['tablerow_close',[]], 476*504c13e8SAndreas Gohr 477*504c13e8SAndreas Gohr ['table_close',[69]], 478*504c13e8SAndreas Gohr ['p_open',[]], 479*504c13e8SAndreas Gohr ['cdata',['def']], 480*504c13e8SAndreas Gohr ['p_close',[]], 481*504c13e8SAndreas Gohr ['document_end',[]], 482*504c13e8SAndreas Gohr ]; 483*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 484*504c13e8SAndreas Gohr } 485*504c13e8SAndreas Gohr 486*504c13e8SAndreas Gohr function testRowSpanTableHead() { 487*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 488*504c13e8SAndreas Gohr $this->P->parse(' 489*504c13e8SAndreas Gohrabc 490*504c13e8SAndreas Gohr^ X1 ^ Y1 ^ Z1 ^ 491*504c13e8SAndreas Gohr^ X2 ^ ::: ^ Z2 ^ 492*504c13e8SAndreas Gohr| A3 | B3 | C3 | 493*504c13e8SAndreas Gohrdef'); 494*504c13e8SAndreas Gohr 495*504c13e8SAndreas Gohr $calls = [ 496*504c13e8SAndreas Gohr ['document_start',[]], 497*504c13e8SAndreas Gohr ['p_open',[]], 498*504c13e8SAndreas Gohr ['cdata',["\n\nabc"]], 499*504c13e8SAndreas Gohr ['p_close',[]], 500*504c13e8SAndreas Gohr ['table_open',[3, 3, 6]], 501*504c13e8SAndreas Gohr ['tablethead_open',[]], 502*504c13e8SAndreas Gohr ['tablerow_open',[]], 503*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 504*504c13e8SAndreas Gohr ['cdata',[' X1 ']], 505*504c13e8SAndreas Gohr ['tableheader_close',[]], 506*504c13e8SAndreas Gohr ['tableheader_open',[1,null,2]], 507*504c13e8SAndreas Gohr ['cdata',[' Y1 ']], 508*504c13e8SAndreas Gohr ['tableheader_close',[]], 509*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 510*504c13e8SAndreas Gohr ['cdata',[' Z1 ']], 511*504c13e8SAndreas Gohr ['tableheader_close',[]], 512*504c13e8SAndreas Gohr ['tablerow_close',[]], 513*504c13e8SAndreas Gohr ['tablerow_open',[]], 514*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 515*504c13e8SAndreas Gohr ['cdata',[' X2 ']], 516*504c13e8SAndreas Gohr ['tableheader_close',[]], 517*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 518*504c13e8SAndreas Gohr ['cdata',[' Z2 ']], 519*504c13e8SAndreas Gohr ['tableheader_close',[]], 520*504c13e8SAndreas Gohr ['tablerow_close',[]], 521*504c13e8SAndreas Gohr ['tablethead_close',[]], 522*504c13e8SAndreas Gohr ['tablerow_open',[]], 523*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 524*504c13e8SAndreas Gohr ['cdata',[' A3 ']], 525*504c13e8SAndreas Gohr ['tablecell_close',[]], 526*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 527*504c13e8SAndreas Gohr ['cdata',[' B3 ']], 528*504c13e8SAndreas Gohr ['tablecell_close',[]], 529*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 530*504c13e8SAndreas Gohr ['cdata',[' C3 ']], 531*504c13e8SAndreas Gohr ['tablecell_close',[]], 532*504c13e8SAndreas Gohr ['tablerow_close',[]], 533*504c13e8SAndreas Gohr ['table_close',[57]], 534*504c13e8SAndreas Gohr ['p_open',[]], 535*504c13e8SAndreas Gohr ['cdata',['def']], 536*504c13e8SAndreas Gohr ['p_close',[]], 537*504c13e8SAndreas Gohr ['document_end',[]], 538*504c13e8SAndreas Gohr ]; 539*504c13e8SAndreas Gohr 540*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 541*504c13e8SAndreas Gohr 542*504c13e8SAndreas Gohr } 543*504c13e8SAndreas Gohr 544*504c13e8SAndreas Gohr function testRowSpanAcrossTableHeadBoundary() { 545*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 546*504c13e8SAndreas Gohr $this->P->parse(' 547*504c13e8SAndreas Gohrabc 548*504c13e8SAndreas Gohr^ X1 ^ Y1 ^ Z1 ^ 549*504c13e8SAndreas Gohr^ X2 ^ ::: ^ Z2 ^ 550*504c13e8SAndreas Gohr| A3 | ::: | C3 | 551*504c13e8SAndreas Gohr| A4 | ::: | C4 | 552*504c13e8SAndreas Gohrdef'); 553*504c13e8SAndreas Gohr 554*504c13e8SAndreas Gohr $calls = [ 555*504c13e8SAndreas Gohr ['document_start',[]], 556*504c13e8SAndreas Gohr ['p_open',[]], 557*504c13e8SAndreas Gohr ['cdata',["\n\nabc"]], 558*504c13e8SAndreas Gohr ['p_close',[]], 559*504c13e8SAndreas Gohr ['table_open',[3, 4, 6]], 560*504c13e8SAndreas Gohr ['tablethead_open',[]], 561*504c13e8SAndreas Gohr ['tablerow_open',[]], 562*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 563*504c13e8SAndreas Gohr ['cdata',[' X1 ']], 564*504c13e8SAndreas Gohr ['tableheader_close',[]], 565*504c13e8SAndreas Gohr ['tableheader_open',[1,null,2]], 566*504c13e8SAndreas Gohr ['cdata',[' Y1 ']], 567*504c13e8SAndreas Gohr ['tableheader_close',[]], 568*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 569*504c13e8SAndreas Gohr ['cdata',[' Z1 ']], 570*504c13e8SAndreas Gohr ['tableheader_close',[]], 571*504c13e8SAndreas Gohr ['tablerow_close',[]], 572*504c13e8SAndreas Gohr ['tablerow_open',[]], 573*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 574*504c13e8SAndreas Gohr ['cdata',[' X2 ']], 575*504c13e8SAndreas Gohr ['tableheader_close',[]], 576*504c13e8SAndreas Gohr ['tableheader_open',[1,null,1]], 577*504c13e8SAndreas Gohr ['cdata',[' Z2 ']], 578*504c13e8SAndreas Gohr ['tableheader_close',[]], 579*504c13e8SAndreas Gohr ['tablerow_close',[]], 580*504c13e8SAndreas Gohr ['tablethead_close',[]], 581*504c13e8SAndreas Gohr ['tablerow_open',[]], 582*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 583*504c13e8SAndreas Gohr ['cdata',[' A3 ']], 584*504c13e8SAndreas Gohr ['tablecell_close',[]], 585*504c13e8SAndreas Gohr ['tablecell_open',[1,null,2]], 586*504c13e8SAndreas Gohr ['cdata',['']], 587*504c13e8SAndreas Gohr ['tablecell_close',[]], 588*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 589*504c13e8SAndreas Gohr ['cdata',[' C3 ']], 590*504c13e8SAndreas Gohr ['tablecell_close',[]], 591*504c13e8SAndreas Gohr ['tablerow_close',[]], 592*504c13e8SAndreas Gohr ['tablerow_open',[]], 593*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 594*504c13e8SAndreas Gohr ['cdata',[' A4 ']], 595*504c13e8SAndreas Gohr ['tablecell_close',[]], 596*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 597*504c13e8SAndreas Gohr ['cdata',[' C4 ']], 598*504c13e8SAndreas Gohr ['tablecell_close',[]], 599*504c13e8SAndreas Gohr ['tablerow_close',[]], 600*504c13e8SAndreas Gohr ['table_close',[76]], 601*504c13e8SAndreas Gohr ['p_open',[]], 602*504c13e8SAndreas Gohr ['cdata',['def']], 603*504c13e8SAndreas Gohr ['p_close',[]], 604*504c13e8SAndreas Gohr ['document_end',[]], 605*504c13e8SAndreas Gohr ]; 606*504c13e8SAndreas Gohr 607*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 608*504c13e8SAndreas Gohr 609*504c13e8SAndreas Gohr } 610*504c13e8SAndreas Gohr 611*504c13e8SAndreas Gohr function testCellAlignmentFormatting() { 612*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 613*504c13e8SAndreas Gohr $this->P->addMode('strong',new Strong()); 614*504c13e8SAndreas Gohr $this->P->parse(' 615*504c13e8SAndreas Gohrabc 616*504c13e8SAndreas Gohr| **X** | Y ^ Z | 617*504c13e8SAndreas Gohrdef'); 618*504c13e8SAndreas Gohr 619*504c13e8SAndreas Gohr $calls = [ 620*504c13e8SAndreas Gohr ['document_start',[]], 621*504c13e8SAndreas Gohr ['p_open',[]], 622*504c13e8SAndreas Gohr ['cdata',["\n\nabc"]], 623*504c13e8SAndreas Gohr ['p_close',[]], 624*504c13e8SAndreas Gohr ['table_open',[3, 1, 6]], 625*504c13e8SAndreas Gohr ['tablerow_open',[]], 626*504c13e8SAndreas Gohr ['tablecell_open',[1,'right',1]], 627*504c13e8SAndreas Gohr ['cdata',[' ']], 628*504c13e8SAndreas Gohr ['strong_open',[]], 629*504c13e8SAndreas Gohr ['cdata',['X']], 630*504c13e8SAndreas Gohr ['strong_close',[]], 631*504c13e8SAndreas Gohr ['cdata',[' ']], 632*504c13e8SAndreas Gohr ['tablecell_close',[]], 633*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 634*504c13e8SAndreas Gohr ['cdata',[' Y ']], 635*504c13e8SAndreas Gohr ['tablecell_close',[]], 636*504c13e8SAndreas Gohr ['tableheader_open',[1,'center',1]], 637*504c13e8SAndreas Gohr ['cdata',[' Z ']], 638*504c13e8SAndreas Gohr ['tableheader_close',[]], 639*504c13e8SAndreas Gohr ['tablerow_close',[]], 640*504c13e8SAndreas Gohr ['table_close',[27]], 641*504c13e8SAndreas Gohr ['p_open',[]], 642*504c13e8SAndreas Gohr ['cdata',['def']], 643*504c13e8SAndreas Gohr ['p_close',[]], 644*504c13e8SAndreas Gohr ['document_end',[]], 645*504c13e8SAndreas Gohr ]; 646*504c13e8SAndreas Gohr 647*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 648*504c13e8SAndreas Gohr 649*504c13e8SAndreas Gohr } 650*504c13e8SAndreas Gohr 651*504c13e8SAndreas Gohr function testTableEol() { 652*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 653*504c13e8SAndreas Gohr $this->P->addMode('eol',new Eol()); 654*504c13e8SAndreas Gohr $this->P->parse(' 655*504c13e8SAndreas Gohrabc 656*504c13e8SAndreas Gohr| Row 0 Col 1 | Row 0 Col 2 | Row 0 Col 3 | 657*504c13e8SAndreas Gohr| Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3 | 658*504c13e8SAndreas Gohrdef'); 659*504c13e8SAndreas Gohr $calls = [ 660*504c13e8SAndreas Gohr ['document_start',[]], 661*504c13e8SAndreas Gohr ['p_open',[]], 662*504c13e8SAndreas Gohr ['cdata',["abc"]], 663*504c13e8SAndreas Gohr ['p_close',[]], 664*504c13e8SAndreas Gohr ['table_open',[3, 2, 6]], 665*504c13e8SAndreas Gohr ['tablerow_open',[]], 666*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 667*504c13e8SAndreas Gohr ['cdata',[' Row 0 Col 1 ']], 668*504c13e8SAndreas Gohr ['tablecell_close',[]], 669*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 670*504c13e8SAndreas Gohr ['cdata',[' Row 0 Col 2 ']], 671*504c13e8SAndreas Gohr ['tablecell_close',[]], 672*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 673*504c13e8SAndreas Gohr ['cdata',[' Row 0 Col 3 ']], 674*504c13e8SAndreas Gohr ['tablecell_close',[]], 675*504c13e8SAndreas Gohr ['tablerow_close',[]], 676*504c13e8SAndreas Gohr ['tablerow_open',[]], 677*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 678*504c13e8SAndreas Gohr ['cdata',[' Row 1 Col 1 ']], 679*504c13e8SAndreas Gohr ['tablecell_close',[]], 680*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 681*504c13e8SAndreas Gohr ['cdata',[' Row 1 Col 2 ']], 682*504c13e8SAndreas Gohr ['tablecell_close',[]], 683*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 684*504c13e8SAndreas Gohr ['cdata',[' Row 1 Col 3 ']], 685*504c13e8SAndreas Gohr ['tablecell_close',[]], 686*504c13e8SAndreas Gohr ['tablerow_close',[]], 687*504c13e8SAndreas Gohr ['table_close',[121]], 688*504c13e8SAndreas Gohr ['p_open',[]], 689*504c13e8SAndreas Gohr ['cdata',['def']], 690*504c13e8SAndreas Gohr ['p_close',[]], 691*504c13e8SAndreas Gohr ['document_end',[]], 692*504c13e8SAndreas Gohr ]; 693*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 694*504c13e8SAndreas Gohr } 695*504c13e8SAndreas Gohr 696*504c13e8SAndreas Gohr // This is really a failing test - formatting able to spread across cols 697*504c13e8SAndreas Gohr // Problem is fixing it would mean a major rewrite of table handling 698*504c13e8SAndreas Gohr function testTableStrong() { 699*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 700*504c13e8SAndreas Gohr $this->P->addMode('strong',new Strong()); 701*504c13e8SAndreas Gohr $this->P->parse(' 702*504c13e8SAndreas Gohrabc 703*504c13e8SAndreas Gohr| **Row 0 Col 1** | **Row 0 Col 2 | Row 0 Col 3** | 704*504c13e8SAndreas Gohr| Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3 | 705*504c13e8SAndreas Gohrdef'); 706*504c13e8SAndreas Gohr $calls = [ 707*504c13e8SAndreas Gohr ['document_start',[]], 708*504c13e8SAndreas Gohr ['p_open',[]], 709*504c13e8SAndreas Gohr ['cdata',["\n\nabc"]], 710*504c13e8SAndreas Gohr ['p_close',[]], 711*504c13e8SAndreas Gohr ['table_open',[3, 2, 6]], 712*504c13e8SAndreas Gohr ['tablerow_open',[]], 713*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 714*504c13e8SAndreas Gohr ['cdata',[' ']], 715*504c13e8SAndreas Gohr ['strong_open',[]], 716*504c13e8SAndreas Gohr ['cdata',['Row 0 Col 1']], 717*504c13e8SAndreas Gohr ['strong_close',[]], 718*504c13e8SAndreas Gohr ['cdata',[' ']], 719*504c13e8SAndreas Gohr ['tablecell_close',[]], 720*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 721*504c13e8SAndreas Gohr ['cdata',[' ']], 722*504c13e8SAndreas Gohr ['strong_open',[]], 723*504c13e8SAndreas Gohr ['cdata',['Row 0 Col 2 | Row 0 Col 3']], 724*504c13e8SAndreas Gohr ['strong_close',[]], 725*504c13e8SAndreas Gohr ['cdata',[' ']], 726*504c13e8SAndreas Gohr ['tablecell_close',[]], 727*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 728*504c13e8SAndreas Gohr ['cdata',['']], 729*504c13e8SAndreas Gohr ['tablecell_close',[]], 730*504c13e8SAndreas Gohr ['tablerow_close',[]], 731*504c13e8SAndreas Gohr ['tablerow_open',[]], 732*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 733*504c13e8SAndreas Gohr ['cdata',[' Row 1 Col 1 ']], 734*504c13e8SAndreas Gohr ['tablecell_close',[]], 735*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 736*504c13e8SAndreas Gohr ['cdata',[' Row 1 Col 2 ']], 737*504c13e8SAndreas Gohr ['tablecell_close',[]], 738*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 739*504c13e8SAndreas Gohr ['cdata',[' Row 1 Col 3 ']], 740*504c13e8SAndreas Gohr ['tablecell_close',[]], 741*504c13e8SAndreas Gohr ['tablerow_close',[]], 742*504c13e8SAndreas Gohr ['table_close',[129]], 743*504c13e8SAndreas Gohr ['p_open',[]], 744*504c13e8SAndreas Gohr ['cdata',['def']], 745*504c13e8SAndreas Gohr ['p_close',[]], 746*504c13e8SAndreas Gohr ['document_end',[]], 747*504c13e8SAndreas Gohr ]; 748*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 749*504c13e8SAndreas Gohr } 750*504c13e8SAndreas Gohr 751*504c13e8SAndreas Gohr // This is really a failing test - unformatted able to spread across cols 752*504c13e8SAndreas Gohr // Problem is fixing it would mean a major rewrite of table handling 753*504c13e8SAndreas Gohr function testTableUnformatted() { 754*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 755*504c13e8SAndreas Gohr $this->P->addMode('unformatted',new Unformatted()); 756*504c13e8SAndreas Gohr $this->P->parse(' 757*504c13e8SAndreas Gohrabc 758*504c13e8SAndreas Gohr| <nowiki>Row 0 Col 1</nowiki> | <nowiki>Row 0 Col 2 | Row 0 Col 3</nowiki> | 759*504c13e8SAndreas Gohr| Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3 | 760*504c13e8SAndreas Gohrdef'); 761*504c13e8SAndreas Gohr $calls = [ 762*504c13e8SAndreas Gohr ['document_start',[]], 763*504c13e8SAndreas Gohr ['p_open',[]], 764*504c13e8SAndreas Gohr ['cdata',["\n\nabc"]], 765*504c13e8SAndreas Gohr ['p_close',[]], 766*504c13e8SAndreas Gohr ['table_open',[3, 2, 6]], 767*504c13e8SAndreas Gohr ['tablerow_open',[]], 768*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 769*504c13e8SAndreas Gohr ['cdata',[' ']], 770*504c13e8SAndreas Gohr ['unformatted',['Row 0 Col 1']], 771*504c13e8SAndreas Gohr ['cdata',[' ']], 772*504c13e8SAndreas Gohr ['tablecell_close',[]], 773*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 774*504c13e8SAndreas Gohr ['cdata',[' ']], 775*504c13e8SAndreas Gohr ['unformatted',['Row 0 Col 2 | Row 0 Col 3']], 776*504c13e8SAndreas Gohr ['cdata',[' ']], 777*504c13e8SAndreas Gohr ['tablecell_close',[]], 778*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 779*504c13e8SAndreas Gohr ['cdata',['']], 780*504c13e8SAndreas Gohr ['tablecell_close',[]], 781*504c13e8SAndreas Gohr ['tablerow_close',[]], 782*504c13e8SAndreas Gohr ['tablerow_open',[]], 783*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 784*504c13e8SAndreas Gohr ['cdata',[' Row 1 Col 1 ']], 785*504c13e8SAndreas Gohr ['tablecell_close',[]], 786*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 787*504c13e8SAndreas Gohr ['cdata',[' Row 1 Col 2 ']], 788*504c13e8SAndreas Gohr ['tablecell_close',[]], 789*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 790*504c13e8SAndreas Gohr ['cdata',[' Row 1 Col 3 ']], 791*504c13e8SAndreas Gohr ['tablecell_close',[]], 792*504c13e8SAndreas Gohr ['tablerow_close',[]], 793*504c13e8SAndreas Gohr ['table_close',[155]], 794*504c13e8SAndreas Gohr ['p_open',[]], 795*504c13e8SAndreas Gohr ['cdata',['def']], 796*504c13e8SAndreas Gohr ['p_close',[]], 797*504c13e8SAndreas Gohr ['document_end',[]], 798*504c13e8SAndreas Gohr ]; 799*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 800*504c13e8SAndreas Gohr } 801*504c13e8SAndreas Gohr 802*504c13e8SAndreas Gohr function testTableLinebreak() { 803*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 804*504c13e8SAndreas Gohr $this->P->addMode('linebreak',new Linebreak()); 805*504c13e8SAndreas Gohr $this->P->parse(' 806*504c13e8SAndreas Gohrabc 807*504c13e8SAndreas Gohr| Row 0\\\\ Col 1 | Row 0 Col 2 | Row 0 Col 3 | 808*504c13e8SAndreas Gohr| Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3 | 809*504c13e8SAndreas Gohrdef'); 810*504c13e8SAndreas Gohr $calls = [ 811*504c13e8SAndreas Gohr ['document_start',[]], 812*504c13e8SAndreas Gohr ['p_open',[]], 813*504c13e8SAndreas Gohr ['cdata',["\n\nabc"]], 814*504c13e8SAndreas Gohr ['p_close',[]], 815*504c13e8SAndreas Gohr ['table_open',[3, 2, 6]], 816*504c13e8SAndreas Gohr ['tablerow_open',[]], 817*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 818*504c13e8SAndreas Gohr ['cdata',[' Row 0']], 819*504c13e8SAndreas Gohr ['linebreak',[]], 820*504c13e8SAndreas Gohr ['cdata',['Col 1 ']], 821*504c13e8SAndreas Gohr ['tablecell_close',[]], 822*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 823*504c13e8SAndreas Gohr ['cdata',[' Row 0 Col 2 ']], 824*504c13e8SAndreas Gohr ['tablecell_close',[]], 825*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 826*504c13e8SAndreas Gohr ['cdata',[' Row 0 Col 3 ']], 827*504c13e8SAndreas Gohr ['tablecell_close',[]], 828*504c13e8SAndreas Gohr ['tablerow_close',[]], 829*504c13e8SAndreas Gohr ['tablerow_open',[]], 830*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 831*504c13e8SAndreas Gohr ['cdata',[' Row 1 Col 1 ']], 832*504c13e8SAndreas Gohr ['tablecell_close',[]], 833*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 834*504c13e8SAndreas Gohr ['cdata',[' Row 1 Col 2 ']], 835*504c13e8SAndreas Gohr ['tablecell_close',[]], 836*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 837*504c13e8SAndreas Gohr ['cdata',[' Row 1 Col 3 ']], 838*504c13e8SAndreas Gohr ['tablecell_close',[]], 839*504c13e8SAndreas Gohr ['tablerow_close',[]], 840*504c13e8SAndreas Gohr ['table_close',[123]], 841*504c13e8SAndreas Gohr ['p_open',[]], 842*504c13e8SAndreas Gohr ['cdata',['def']], 843*504c13e8SAndreas Gohr ['p_close',[]], 844*504c13e8SAndreas Gohr ['document_end',[]], 845*504c13e8SAndreas Gohr ]; 846*504c13e8SAndreas Gohr 847*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 848*504c13e8SAndreas Gohr } 849*504c13e8SAndreas Gohr 850*504c13e8SAndreas Gohr // This is really a failing test - footnote able to spread across cols 851*504c13e8SAndreas Gohr // Problem is fixing it would mean a major rewrite of table handling 852*504c13e8SAndreas Gohr function testTableFootnote() { 853*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 854*504c13e8SAndreas Gohr $this->P->addMode('footnote',new Footnote()); 855*504c13e8SAndreas Gohr $this->P->parse(' 856*504c13e8SAndreas Gohrabc 857*504c13e8SAndreas Gohr| ((Row 0 Col 1)) | ((Row 0 Col 2 | Row 0 Col 3)) | 858*504c13e8SAndreas Gohr| Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3 | 859*504c13e8SAndreas Gohrdef'); 860*504c13e8SAndreas Gohr $calls = [ 861*504c13e8SAndreas Gohr ['document_start',[]], 862*504c13e8SAndreas Gohr ['p_open',[]], 863*504c13e8SAndreas Gohr ['cdata',["\n\nabc"]], 864*504c13e8SAndreas Gohr ['p_close',[]], 865*504c13e8SAndreas Gohr ['table_open',[3, 2, 6]], 866*504c13e8SAndreas Gohr ['tablerow_open',[]], 867*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 868*504c13e8SAndreas Gohr ['cdata',[' ']], 869*504c13e8SAndreas Gohr ['nest', [ [ 870*504c13e8SAndreas Gohr ['footnote_open',[]], 871*504c13e8SAndreas Gohr ['cdata',['Row 0 Col 1']], 872*504c13e8SAndreas Gohr ['footnote_close',[]], 873*504c13e8SAndreas Gohr ]]], 874*504c13e8SAndreas Gohr ['cdata',[' ']], 875*504c13e8SAndreas Gohr ['tablecell_close',[]], 876*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 877*504c13e8SAndreas Gohr ['cdata',[' ']], 878*504c13e8SAndreas Gohr ['nest', [ [ 879*504c13e8SAndreas Gohr ['footnote_open',[]], 880*504c13e8SAndreas Gohr ['cdata',['Row 0 Col 2 | Row 0 Col 3']], 881*504c13e8SAndreas Gohr ['footnote_close',[]], 882*504c13e8SAndreas Gohr ]]], 883*504c13e8SAndreas Gohr ['cdata',[' ']], 884*504c13e8SAndreas Gohr ['tablecell_close',[]], 885*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 886*504c13e8SAndreas Gohr ['cdata',['']], 887*504c13e8SAndreas Gohr ['tablecell_close',[]], 888*504c13e8SAndreas Gohr ['tablerow_close',[]], 889*504c13e8SAndreas Gohr ['tablerow_open',[]], 890*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 891*504c13e8SAndreas Gohr ['cdata',[' Row 1 Col 1 ']], 892*504c13e8SAndreas Gohr ['tablecell_close',[]], 893*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 894*504c13e8SAndreas Gohr ['cdata',[' Row 1 Col 2 ']], 895*504c13e8SAndreas Gohr ['tablecell_close',[]], 896*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 897*504c13e8SAndreas Gohr ['cdata',[' Row 1 Col 3 ']], 898*504c13e8SAndreas Gohr ['tablecell_close',[]], 899*504c13e8SAndreas Gohr ['tablerow_close',[]], 900*504c13e8SAndreas Gohr ['table_close',[129]], 901*504c13e8SAndreas Gohr ['p_open',[]], 902*504c13e8SAndreas Gohr ['cdata',['def']], 903*504c13e8SAndreas Gohr ['p_close',[]], 904*504c13e8SAndreas Gohr ['document_end',[]], 905*504c13e8SAndreas Gohr ]; 906*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 907*504c13e8SAndreas Gohr } 908*504c13e8SAndreas Gohr 909*504c13e8SAndreas Gohr function testTable_FS1833() { 910*504c13e8SAndreas Gohr $syntax = " \n| Row 0 Col 1 |\n"; 911*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 912*504c13e8SAndreas Gohr $this->P->parse($syntax); 913*504c13e8SAndreas Gohr $calls = [ 914*504c13e8SAndreas Gohr ['document_start',[]], 915*504c13e8SAndreas Gohr ['table_open',[1, 1, 2]], 916*504c13e8SAndreas Gohr ['tablerow_open',[]], 917*504c13e8SAndreas Gohr ['tablecell_open',[1,'left',1]], 918*504c13e8SAndreas Gohr ['cdata',[' Row 0 Col 1 ']], 919*504c13e8SAndreas Gohr ['tablecell_close',[]], 920*504c13e8SAndreas Gohr ['tablerow_close',[]], 921*504c13e8SAndreas Gohr ['table_close',[strlen($syntax)]], 922*504c13e8SAndreas Gohr ['document_end',[]], 923*504c13e8SAndreas Gohr ]; 924*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 925*504c13e8SAndreas Gohr } 926*504c13e8SAndreas Gohr 927*504c13e8SAndreas Gohr /** 928*504c13e8SAndreas Gohr * missing cells in one row get filled up... 929*504c13e8SAndreas Gohr */ 930*504c13e8SAndreas Gohr function testTable_CellFix() { 931*504c13e8SAndreas Gohr $syntax = "\n| r1c1 | r1c2 | r1c3 |\n| r2c1 |\n"; 932*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 933*504c13e8SAndreas Gohr $this->P->parse($syntax); 934*504c13e8SAndreas Gohr $calls = [ 935*504c13e8SAndreas Gohr ['document_start',[]], 936*504c13e8SAndreas Gohr ['table_open',[3, 2, 2]], 937*504c13e8SAndreas Gohr 938*504c13e8SAndreas Gohr ['tablerow_open',[]], 939*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 940*504c13e8SAndreas Gohr ['cdata',[' r1c1 ']], 941*504c13e8SAndreas Gohr ['tablecell_close',[]], 942*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 943*504c13e8SAndreas Gohr ['cdata',[' r1c2 ']], 944*504c13e8SAndreas Gohr ['tablecell_close',[]], 945*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 946*504c13e8SAndreas Gohr ['cdata',[' r1c3 ']], 947*504c13e8SAndreas Gohr ['tablecell_close',[]], 948*504c13e8SAndreas Gohr ['tablerow_close',[]], 949*504c13e8SAndreas Gohr 950*504c13e8SAndreas Gohr ['tablerow_open',[]], 951*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 952*504c13e8SAndreas Gohr ['cdata',[' r2c1 ']], 953*504c13e8SAndreas Gohr ['tablecell_close',[]], 954*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 955*504c13e8SAndreas Gohr ['cdata',['']], 956*504c13e8SAndreas Gohr ['tablecell_close',[]], 957*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 958*504c13e8SAndreas Gohr ['cdata',['']], 959*504c13e8SAndreas Gohr ['tablecell_close',[]], 960*504c13e8SAndreas Gohr ['tablerow_close',[]], 961*504c13e8SAndreas Gohr 962*504c13e8SAndreas Gohr ['table_close',[strlen($syntax)]], 963*504c13e8SAndreas Gohr ['document_end',[]], 964*504c13e8SAndreas Gohr ]; 965*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 966*504c13e8SAndreas Gohr } 967*504c13e8SAndreas Gohr 968*504c13e8SAndreas Gohr /** 969*504c13e8SAndreas Gohr * ... even if the longer row comes later 970*504c13e8SAndreas Gohr */ 971*504c13e8SAndreas Gohr function testTable_CellFix2() { 972*504c13e8SAndreas Gohr $syntax = "\n| r1c1 |\n| r2c1 | r2c2 | r2c3 |\n"; 973*504c13e8SAndreas Gohr $this->P->addMode('table',new Table()); 974*504c13e8SAndreas Gohr $this->P->parse($syntax); 975*504c13e8SAndreas Gohr $calls = [ 976*504c13e8SAndreas Gohr ['document_start',[]], 977*504c13e8SAndreas Gohr ['table_open',[3, 2, 2]], 978*504c13e8SAndreas Gohr 979*504c13e8SAndreas Gohr ['tablerow_open',[]], 980*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 981*504c13e8SAndreas Gohr ['cdata',[' r1c1 ']], 982*504c13e8SAndreas Gohr ['tablecell_close',[]], 983*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 984*504c13e8SAndreas Gohr ['cdata',['']], 985*504c13e8SAndreas Gohr ['tablecell_close',[]], 986*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 987*504c13e8SAndreas Gohr ['cdata',['']], 988*504c13e8SAndreas Gohr ['tablecell_close',[]], 989*504c13e8SAndreas Gohr ['tablerow_close',[]], 990*504c13e8SAndreas Gohr 991*504c13e8SAndreas Gohr ['tablerow_open',[]], 992*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 993*504c13e8SAndreas Gohr ['cdata',[' r2c1 ']], 994*504c13e8SAndreas Gohr ['tablecell_close',[]], 995*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 996*504c13e8SAndreas Gohr ['cdata',[' r2c2 ']], 997*504c13e8SAndreas Gohr ['tablecell_close',[]], 998*504c13e8SAndreas Gohr ['tablecell_open',[1,null,1]], 999*504c13e8SAndreas Gohr ['cdata',[' r2c3 ']], 1000*504c13e8SAndreas Gohr ['tablecell_close',[]], 1001*504c13e8SAndreas Gohr ['tablerow_close',[]], 1002*504c13e8SAndreas Gohr 1003*504c13e8SAndreas Gohr ['table_close',[strlen($syntax)]], 1004*504c13e8SAndreas Gohr ['document_end',[]], 1005*504c13e8SAndreas Gohr ]; 1006*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 1007*504c13e8SAndreas Gohr } 1008*504c13e8SAndreas Gohr} 1009