Warning, /education/cantor/thirdparty/discount-2.2.6-patched/tests/pandoc.t is written in an unsupported language. File is not indexed.

0001 . tests/functions.sh
0002 
0003 title "pandoc headers"
0004 
0005 rc=0
0006 MARKDOWN_FLAGS=
0007 
0008 HEADER='% title
0009 % author(s)
0010 % date'
0011 
0012 
0013 try 'valid header' "$HEADER" ''
0014 try -F0x00010000 'valid header with -F0x00010000' "$HEADER" '<p>% title
0015 % author(s)
0016 % date</p>'
0017 
0018 try 'invalid header' \
0019         '% title
0020 % author(s)
0021 a pony!' \
0022         '<p>% title
0023 % author(s)
0024 a pony!</p>'
0025 
0026 try 'offset header' \
0027         '
0028 % title
0029 % author(s)
0030 % date' \
0031         '<p>% title
0032 % author(s)
0033 % date</p>'
0034 
0035 try 'indented header' \
0036         '  % title
0037 % author(s)
0038 % date' \
0039         '<p>  % title
0040 % author(s)
0041 % date</p>'
0042 
0043 
0044 # verify that empty pandoc header elements are handled properly
0045 
0046 check_null() {
0047     try_header "$3"
0048     res=`echo "$2" | ./pandoc_headers $1`
0049     if [ "$res" ]; then
0050         ./echo
0051         test $VERBOSE || ./echo "$3"
0052         echo "$res"
0053     else
0054         test $VERBOSE && ./echo " ok"
0055     fi
0056 }
0057 
0058 # pandoc headers left empty
0059 EMPTY='%
0060 %
0061 %
0062 stuff'
0063 
0064 # pandoc headers with whitespace, but no content
0065 EMPTY1='% 
0066 % 
0067 % 
0068 stuff'
0069 
0070 AUTHOR='%
0071 % bofh
0072 %
0073 stuff'
0074 TITLE='%bofh
0075 %
0076 %
0077 stuff'
0078 DATE='%
0079 %
0080 %now
0081 stuff'
0082 
0083 check_null -atd "$EMPTY" "empty"
0084 check_null -atd "$EMPTY1" "whitespace"
0085 
0086 check_null -td "$AUTHOR" "author field"
0087 check_null -ad "$TITLE" "title field"
0088 check_null -at "$DATE" "date field"
0089 
0090 summary $0
0091 exit $rc