Mercurial > emacs
comparison etc/srecode/test.srt @ 105407:84fc40980c51
* srecode: New directory for SRecode template files.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 03 Oct 2009 19:28:56 +0000 |
parents | |
children | 1d1d5d9bd884 |
comparison
equal
deleted
inserted
replaced
105406:5b8c8cd21526 | 105407:84fc40980c51 |
---|---|
1 ;; test.srt --- SRecode templates for testing | |
2 | |
3 ;; Copyright (C) 2008, 2009 Free Software Foundation, Inc. | |
4 | |
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com> | |
6 | |
7 ;; This file is part of GNU Emacs. | |
8 | |
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. | |
13 | |
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. | |
18 | |
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/>. | |
21 | |
22 set mode "srecode-template-mode" | |
23 set escape_start "$" | |
24 set escape_end "$" | |
25 set application "tests" | |
26 | |
27 set UTESTVAR1 ".SRT VAR 1" | |
28 ;; | |
29 ;; These are for testing features of template files. | |
30 ;; | |
31 context test | |
32 | |
33 template test :user | |
34 ---- | |
35 $! This is a comment in the template. $ | |
36 ;; $AUTHOR$ | |
37 ;; $AUTHOR:upcase$ | |
38 ---- | |
39 | |
40 template subs :blank | |
41 ---- | |
42 ;; Before Loop | |
43 $#LOOP$ | |
44 ;; - loop stuff | |
45 $/LOOP$ | |
46 ;; After Loop | |
47 ---- | |
48 | |
49 ;; Before insertion | |
50 ;; After insertion | |
51 | |
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 ---- | |
69 | |
70 | |
71 template wrapsomething :region | |
72 ---- | |
73 ;; Put this line in front: | |
74 $REGIONTEXT$ | |
75 ;; Put this line at the end: | |
76 ---- | |
77 | |
78 template gapsomething :blank | |
79 ---- | |
80 ### ALL ALONE ON A LINE ### | |
81 ---- | |
82 | |
83 template inlinetext | |
84 "Insert text that has no nelines" | |
85 ---- | |
86 *In the middle* | |
87 ---- | |
88 | |
89 template includable :blank | |
90 ---- | |
91 ;; An includable $COMMENT$ we could use. | |
92 ;; $^$ | |
93 ;; Text after a point inserter. | |
94 ---- | |
95 | |
96 template wrapinclude-basic | |
97 ---- | |
98 $>WI1:includable$ | |
99 ---- | |
100 | |
101 template wrapinclude-around | |
102 ---- | |
103 $<WI1:includable$Intermediate Comments$/WI1$ | |
104 ---- | |
105 | |
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 ---- | |
114 | |
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 ---- | |
122 | |
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 ---- | |
139 | |
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 ---- | |
147 | |
148 ;; end |