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