. tests/functions.sh
title "tables"
rc=0
MARKDOWN_FLAGS=
try 'single-column table' \
'|hello
|-----
|sailor' \
'
'
try 'two-column table' \
'
a | b
-----|------
hello|sailor' \
''
try 'three-column table' \
'a|b|c
-|-|-
hello||sailor'\
''
try 'two-column table with empty cells' \
'
a | b
-----|------
hello|
|sailor' \
''
try 'two-column table with alignment' \
'
a | b
----:|:-----
hello|sailor' \
''
try 'table with extra data column' \
'
a | b
-----|------
hello|sailor|boy' \
''
try -fnotables 'tables with -fnotables' \
'a|b
-|-
hello|sailor' \
'a|b
-|-
hello|sailor
'
try 'deceptive non-table text' \
'a | b | c
text' \
'a | b | c
text
'
try 'table headers only' \
'a|b|c
-|-|-' \
'a|b|c
-|-|-
'
try 'escaped title line' \
'A\|B
--|-
C |D' \
''
try 'escaped dashes line' \
'A |B
-\|-
C |D' \
'A |B
-|-
C |D
'
try 'escaped content line' \
'A |B
--|-
C\|D' \
''
try 'content line w/o dashes' \
'A |B
--|-
CD' \
'A |B
–|-
CD
'
try 'table followed by text' \
'
A|B
-|-
C|D
foo?' \
'
foo?
'
try "table with flanking |'s" \
'
|A|B|
|-|-|
|D|C|' \
''
try "table with leading |'s and alignment" \
'|AA|BB|CC
|:-|::|-:
|aa|bb|cc' \
''
summary $0
exit $rc