comments.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. overview: |
  2. Comment tags represent content that should never appear in the resulting
  3. output.
  4. The tag's content may contain any substring (including newlines) EXCEPT the
  5. closing delimiter.
  6. Comment tags SHOULD be treated as standalone when appropriate.
  7. tests:
  8. - name: Inline
  9. desc: Comment blocks should be removed from the template.
  10. data: { }
  11. template: '12345{{! Comment Block! }}67890'
  12. expected: '1234567890'
  13. - name: Multiline
  14. desc: Multiline comments should be permitted.
  15. data: { }
  16. template: |
  17. 12345{{!
  18. This is a
  19. multi-line comment...
  20. }}67890
  21. expected: |
  22. 1234567890
  23. - name: Standalone
  24. desc: All standalone comment lines should be removed.
  25. data: { }
  26. template: |
  27. Begin.
  28. {{! Comment Block! }}
  29. End.
  30. expected: |
  31. Begin.
  32. End.
  33. - name: Indented Standalone
  34. desc: All standalone comment lines should be removed.
  35. data: { }
  36. template: |
  37. Begin.
  38. {{! Indented Comment Block! }}
  39. End.
  40. expected: |
  41. Begin.
  42. End.
  43. - name: Standalone Line Endings
  44. desc: '"\r\n" should be considered a newline for standalone tags.'
  45. data: { }
  46. template: "|\r\n{{! Standalone Comment }}\r\n|"
  47. expected: "|\r\n|"
  48. - name: Standalone Without Previous Line
  49. desc: Standalone tags should not require a newline to precede them.
  50. data: { }
  51. template: " {{! I'm Still Standalone }}\n!"
  52. expected: "!"
  53. - name: Standalone Without Newline
  54. desc: Standalone tags should not require a newline to follow them.
  55. data: { }
  56. template: "!\n {{! I'm Still Standalone }}"
  57. expected: "!\n"
  58. - name: Multiline Standalone
  59. desc: All standalone comment lines should be removed.
  60. data: { }
  61. template: |
  62. Begin.
  63. {{!
  64. Something's going on here...
  65. }}
  66. End.
  67. expected: |
  68. Begin.
  69. End.
  70. - name: Indented Multiline Standalone
  71. desc: All standalone comment lines should be removed.
  72. data: { }
  73. template: |
  74. Begin.
  75. {{!
  76. Something's going on here...
  77. }}
  78. End.
  79. expected: |
  80. Begin.
  81. End.
  82. - name: Indented Inline
  83. desc: Inline comments should not strip whitespace
  84. data: { }
  85. template: " 12 {{! 34 }}\n"
  86. expected: " 12 \n"
  87. - name: Surrounding Whitespace
  88. desc: Comment removal should preserve surrounding whitespace.
  89. data: { }
  90. template: '12345 {{! Comment Block! }} 67890'
  91. expected: '12345 67890'