test.srt 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. ;; test.srt --- SRecode templates for testing
  2. ;; Copyright (C) 2008-2016 Free Software Foundation, Inc.
  3. ;; Author: Eric M. Ludlam <eric@siege-engine.com>
  4. ;; This file is part of GNU Emacs.
  5. ;; GNU Emacs is free software: you can redistribute it and/or modify
  6. ;; it under the terms of the GNU General Public License as published by
  7. ;; the Free Software Foundation, either version 3 of the License, or
  8. ;; (at your option) any later version.
  9. ;; GNU Emacs is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU General Public License for more details.
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  15. set mode "srecode-template-mode"
  16. set escape_start "$"
  17. set escape_end "$"
  18. set application "tests"
  19. set UTESTVAR1 ".SRT VAR 1"
  20. ;;
  21. ;; These are for testing features of template files.
  22. ;;
  23. context test
  24. template test :user
  25. ----
  26. $! This is a comment in the template. $
  27. ;; $AUTHOR$
  28. ;; $AUTHOR:upcase$
  29. ----
  30. template subs :blank
  31. ----
  32. ;; Before Loop
  33. $#LOOP$
  34. ;; - loop stuff
  35. $/LOOP$
  36. ;; After Loop
  37. ----
  38. ;; Before insertion
  39. ;; After insertion
  40. template firstlast
  41. sectiondictionary "A"
  42. set MOOSE "FIRST"
  43. sectiondictionary "A"
  44. set MOOSE "MIDDLE"
  45. sectiondictionary "A"
  46. set MOOSE "LAST"
  47. ----
  48. $#A$
  49. ;; << -- $MOOSE$
  50. $#FIRST$;; I'm First$/FIRST$
  51. $#NOTFIRST$;; I'm Not First$/NOTFIRST$
  52. $#LAST$;; I'm Last$/LAST$
  53. $#NOTLAST$;; I'm Not Last$/NOTLAST$
  54. ;; -- >>
  55. $/A$
  56. ----
  57. template wrapsomething :region
  58. ----
  59. ;; Put this line in front:
  60. $REGIONTEXT$
  61. ;; Put this line at the end:
  62. ----
  63. template gapsomething :blank
  64. ----
  65. ### ALL ALONE ON A LINE ###
  66. ----
  67. template inlinetext
  68. "Insert text that has no newlines"
  69. ----
  70. *In the middle*
  71. ----
  72. template includable :blank
  73. ----
  74. ;; An includable $COMMENT$ we could use.
  75. ;; $^$
  76. ;; Text after a point inserter.
  77. ----
  78. template wrapinclude-basic
  79. ----
  80. $>WI1:includable$
  81. ----
  82. template wrapinclude-around
  83. ----
  84. $<WI1:includable$Intermediate Comments$/WI1$
  85. ----
  86. template complex-subdict
  87. sectiondictionary "A"
  88. set MYVAR1 "cow"
  89. set MYVAR2 "dog"
  90. set CPLX "I have a " macro "MYVAR1" " and a " macro "MYVAR2" "."
  91. ----
  92. ;; $#A$$CPLX$$/A$
  93. ----
  94. template wrap-new-template
  95. sectiondictionary "NEWTMP"
  96. set DOC "A nice doc string goes here."
  97. ----
  98. $<NEWTMP:declaration:function$Random text in the new template
  99. $/NEWTMP$
  100. ----
  101. template column-data
  102. sectiondictionary "A"
  103. set MOOSE "FIRST"
  104. sectiondictionary "A"
  105. set MOOSE "VERY VERY LONG STRING THAT WILL BE CROPPED."
  106. sectiondictionary "A"
  107. set MOOSE "MIDDLE"
  108. sectiondictionary "A"
  109. set MOOSE "S"
  110. sectiondictionary "A"
  111. set MOOSE "LAST"
  112. ----
  113. Table of Values:
  114. Left Justified | Right Justified$#A$
  115. $|MOOSE:20:right$ | $|MOOSE:20:left$$/A$
  116. ----
  117. template custom-arg-handler :utest
  118. sectiondictionary "A"
  119. set MOOSE "why"
  120. ----
  121. OUTSIDE SECTION: $UTESTVAR1$
  122. INSIDE SECTION: $#A$$UTESTVAR1$$/A$
  123. ----
  124. ;; end