Text::Markdown::Discount
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

155 lines
1.8 KiB

  1. . tests/functions.sh
  2. title "lists"
  3. rc=0
  4. MARKDOWN_FLAGS=
  5. try 'two separated items' \
  6. ' * A
  7. * B' \
  8. '<ul>
  9. <li><p>A</p></li>
  10. <li><p>B</p></li>
  11. </ul>'
  12. try 'two adjacent items' \
  13. ' * A
  14. * B' \
  15. '<ul>
  16. <li>A</li>
  17. <li>B</li>
  18. </ul>'
  19. try 'two adjacent items, then space' \
  20. ' * A
  21. * B
  22. space, the final frontier' \
  23. '<ul>
  24. <li>A</li>
  25. <li>B</li>
  26. </ul>
  27. <p>space, the final frontier</p>'
  28. try 'nested lists (1)' \
  29. ' * 1. Sub (list)
  30. 2. Two (items)
  31. 3. Here' \
  32. '<ul>
  33. <li><ol>
  34. <li>Sub (list)</li>
  35. <li>Two (items)</li>
  36. <li>Here</li>
  37. </ol>
  38. </li>
  39. </ul>'
  40. try 'nested lists (2)' \
  41. ' * A (list)
  42. 1. Sub (list)
  43. 2. Two (items)
  44. 3. Here
  45. Here
  46. * B (list)' \
  47. '<ul>
  48. <li><p>A (list)</p>
  49. <ol>
  50. <li> Sub (list)</li>
  51. <li> Two (items)</li>
  52. <li> Here</li>
  53. </ol>
  54. <p> Here</p></li>
  55. <li>B (list)</li>
  56. </ul>'
  57. try 'list inside blockquote' \
  58. '>A (list)
  59. >
  60. >1. Sub (list)
  61. >2. Two (items)
  62. >3. Here' \
  63. '<blockquote><p>A (list)</p>
  64. <ol>
  65. <li>Sub (list)</li>
  66. <li>Two (items)</li>
  67. <li>Here</li>
  68. </ol>
  69. </blockquote>'
  70. try 'blockquote inside list' \
  71. ' * A (list)
  72. > quote
  73. > me
  74. dont quote me' \
  75. '<ul>
  76. <li><p>A (list)</p>
  77. <blockquote><p>quote
  78. me</p></blockquote>
  79. <p>dont quote me</p></li>
  80. </ul>'
  81. try 'empty list' \
  82. '
  83. -
  84. -
  85. ' \
  86. '<ul>
  87. <li></li>
  88. <li></li>
  89. </ul>'
  90. try 'blockquote inside a list' \
  91. ' * This is a list item.
  92. > This is a quote insde a list item. ' \
  93. '<ul>
  94. <li><p> This is a list item.</p>
  95. <blockquote><p>This is a quote insde a list item.</p></blockquote></li>
  96. </ul>'
  97. try 'dl followed by non-dl' \
  98. '=a=
  99. test
  100. 2. here' \
  101. '<dl>
  102. <dt>a</dt>
  103. <dd>test</dd>
  104. </dl>
  105. <ol>
  106. <li>here</li>
  107. </ol>'
  108. try 'non-dl followed by dl' \
  109. '1. hello
  110. =sailor=
  111. hi!' \
  112. '<ol>
  113. <li>hello</li>
  114. </ol>
  115. <dl>
  116. <dt>sailor</dt>
  117. <dd>hi!</dd>
  118. </dl>'
  119. summary $0
  120. exit $rc