Fossil SCM

Add the "re=" query parameter to the /dir webpage. Improvments to skin documentation and to the change log.

drh 2021-03-02 20:50 trunk
Commit f08466dded8faf8a3907700a291d36637f0772d58c57d30087acb2401431fa02
+2 -1
--- skins/README.md
+++ skins/README.md
@@ -30,11 +30,12 @@
3030
4. Edit the BuiltinSkin[] array near the top of the src/skins.c source
3131
file so that it describes and references the "newskin" skin.
3232
3333
5. Type "make" to rebuild.
3434
35
-See the [custom skin documentation](../www/customskin.md) for more information.
35
+See the [custom skin documentation](/doc/$CURRENT/www/customskin.md) for
36
+more information.
3637
3738
Development Hints
3839
-----------------
3940
4041
One way to develop a new skin is to copy the baseline files (css.txt,
4142
--- skins/README.md
+++ skins/README.md
@@ -30,11 +30,12 @@
30 4. Edit the BuiltinSkin[] array near the top of the src/skins.c source
31 file so that it describes and references the "newskin" skin.
32
33 5. Type "make" to rebuild.
34
35 See the [custom skin documentation](../www/customskin.md) for more information.
 
36
37 Development Hints
38 -----------------
39
40 One way to develop a new skin is to copy the baseline files (css.txt,
41
--- skins/README.md
+++ skins/README.md
@@ -30,11 +30,12 @@
30 4. Edit the BuiltinSkin[] array near the top of the src/skins.c source
31 file so that it describes and references the "newskin" skin.
32
33 5. Type "make" to rebuild.
34
35 See the [custom skin documentation](/doc/$CURRENT/www/customskin.md) for
36 more information.
37
38 Development Hints
39 -----------------
40
41 One way to develop a new skin is to copy the baseline files (css.txt,
42
+25 -4
--- src/browse.c
+++ src/browse.c
@@ -127,12 +127,13 @@
127127
** query parameter is present. If ci= is missing, the union of files
128128
** across all check-ins is shown.
129129
**
130130
** Query parameters:
131131
**
132
+** ci=LABEL Show only files in this check-in. Optional.
132133
** name=PATH Directory to display. Optional. Top-level if missing
133
-** ci=LABEL Show only files in this check-in. Optional.
134
+** re=REGEXP Show only files matching REGEXP
134135
** type=TYPE TYPE=flat: use this display
135136
** TYPE=tree: use the /tree display instead
136137
** noreadme Do not attempt to display the README file.
137138
*/
138139
void page_dir(void){
@@ -150,10 +151,12 @@
150151
int linkTip = 1;
151152
HQuery sURI;
152153
int isSymbolicCI = 0; /* ci= is symbolic name, not a hash prefix */
153154
int isBranchCI = 0; /* True if ci= refers to a branch name */
154155
char *zHeader = 0;
156
+ const char *zRegexp; /* The re= query parameter */
157
+ char *zMatch; /* Extra title text describing the match */
155158
156159
if( zCI && strlen(zCI)==0 ){ zCI = 0; }
157160
if( strcmp(PD("type","flat"),"tree")==0 ){ page_tree(); return; }
158161
login_check_credentials();
159162
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
@@ -192,10 +195,17 @@
192195
if( zCI ){
193196
zHeader = mprintf("Files in %s/ of %s", zD, zCI);
194197
}else{
195198
zHeader = mprintf("All File in %s/", zD);
196199
}
200
+ }
201
+ zRegexp = P("re");
202
+ if( zRegexp ){
203
+ zHeader = mprintf("%z matching \"%s\"", zHeader, zRegexp);
204
+ zMatch = mprintf(" matching \"%h\"", zRegexp);
205
+ }else{
206
+ zMatch = "";
197207
}
198208
style_header("%s", zHeader);
199209
fossil_free(zHeader);
200210
style_adunit_config(ADUNIT_RIGHT_OK);
201211
sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
@@ -217,16 +227,19 @@
217227
@ <h2>Files in the top-level directory \
218228
zPrefix = "";
219229
}
220230
if( zCI ){
221231
if( fossil_strcmp(zCI,"tip")==0 ){
222
- @ from the %z(href("%R/info?name=%T",zCI))latest check-in</a></h2>
232
+ @ from the %z(href("%R/info?name=%T",zCI))latest check-in</a>\
233
+ @ %s(zMatch)</h2>
223234
}else if( isBranchCI ){
224235
@ from the %z(href("%R/info?name=%T",zCI))latest check-in</a> \
225
- @ of branch %z(href("%R/timeline?r=%T",zCI))%h(zCI)</a></h2>
236
+ @ of branch %z(href("%R/timeline?r=%T",zCI))%h(zCI)</a>\
237
+ @ %s(zMatch)</h2>
226238
}else {
227
- @ of check-in %z(href("%R/info?name=%T",zCI))%h(zCI)</a></h2>
239
+ @ of check-in %z(href("%R/info?name=%T",zCI))%h(zCI)</a>\
240
+ @ %s(zMatch)</h2>
228241
}
229242
zSubdirLink = mprintf("%R/dir?ci=%T&name=%T", zCI, zPrefix);
230243
if( nD==0 ){
231244
style_submenu_element("File Ages", "%R/fileage?name=%T", zCI);
232245
}
@@ -302,10 +315,18 @@
302315
db_multi_exec(
303316
"INSERT OR IGNORE INTO localfiles"
304317
" SELECT pathelement(name,0), NULL FROM filename"
305318
);
306319
}
320
+
321
+ /* If the re=REGEXP query parameter is present, filter out names that
322
+ ** do not match the pattern */
323
+ if( zRegexp ){
324
+ db_multi_exec(
325
+ "DELETE FROM localfiles WHERE x NOT REGEXP %Q", zRegexp
326
+ );
327
+ }
307328
308329
/* Generate a multi-column table listing the contents of zD[]
309330
** directory.
310331
*/
311332
mxLen = db_int(12, "SELECT max(length(x)) FROM localfiles /*scan*/");
312333
--- src/browse.c
+++ src/browse.c
@@ -127,12 +127,13 @@
127 ** query parameter is present. If ci= is missing, the union of files
128 ** across all check-ins is shown.
129 **
130 ** Query parameters:
131 **
 
132 ** name=PATH Directory to display. Optional. Top-level if missing
133 ** ci=LABEL Show only files in this check-in. Optional.
134 ** type=TYPE TYPE=flat: use this display
135 ** TYPE=tree: use the /tree display instead
136 ** noreadme Do not attempt to display the README file.
137 */
138 void page_dir(void){
@@ -150,10 +151,12 @@
150 int linkTip = 1;
151 HQuery sURI;
152 int isSymbolicCI = 0; /* ci= is symbolic name, not a hash prefix */
153 int isBranchCI = 0; /* True if ci= refers to a branch name */
154 char *zHeader = 0;
 
 
155
156 if( zCI && strlen(zCI)==0 ){ zCI = 0; }
157 if( strcmp(PD("type","flat"),"tree")==0 ){ page_tree(); return; }
158 login_check_credentials();
159 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
@@ -192,10 +195,17 @@
192 if( zCI ){
193 zHeader = mprintf("Files in %s/ of %s", zD, zCI);
194 }else{
195 zHeader = mprintf("All File in %s/", zD);
196 }
 
 
 
 
 
 
 
197 }
198 style_header("%s", zHeader);
199 fossil_free(zHeader);
200 style_adunit_config(ADUNIT_RIGHT_OK);
201 sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
@@ -217,16 +227,19 @@
217 @ <h2>Files in the top-level directory \
218 zPrefix = "";
219 }
220 if( zCI ){
221 if( fossil_strcmp(zCI,"tip")==0 ){
222 @ from the %z(href("%R/info?name=%T",zCI))latest check-in</a></h2>
 
223 }else if( isBranchCI ){
224 @ from the %z(href("%R/info?name=%T",zCI))latest check-in</a> \
225 @ of branch %z(href("%R/timeline?r=%T",zCI))%h(zCI)</a></h2>
 
226 }else {
227 @ of check-in %z(href("%R/info?name=%T",zCI))%h(zCI)</a></h2>
 
228 }
229 zSubdirLink = mprintf("%R/dir?ci=%T&name=%T", zCI, zPrefix);
230 if( nD==0 ){
231 style_submenu_element("File Ages", "%R/fileage?name=%T", zCI);
232 }
@@ -302,10 +315,18 @@
302 db_multi_exec(
303 "INSERT OR IGNORE INTO localfiles"
304 " SELECT pathelement(name,0), NULL FROM filename"
305 );
306 }
 
 
 
 
 
 
 
 
307
308 /* Generate a multi-column table listing the contents of zD[]
309 ** directory.
310 */
311 mxLen = db_int(12, "SELECT max(length(x)) FROM localfiles /*scan*/");
312
--- src/browse.c
+++ src/browse.c
@@ -127,12 +127,13 @@
127 ** query parameter is present. If ci= is missing, the union of files
128 ** across all check-ins is shown.
129 **
130 ** Query parameters:
131 **
132 ** ci=LABEL Show only files in this check-in. Optional.
133 ** name=PATH Directory to display. Optional. Top-level if missing
134 ** re=REGEXP Show only files matching REGEXP
135 ** type=TYPE TYPE=flat: use this display
136 ** TYPE=tree: use the /tree display instead
137 ** noreadme Do not attempt to display the README file.
138 */
139 void page_dir(void){
@@ -150,10 +151,12 @@
151 int linkTip = 1;
152 HQuery sURI;
153 int isSymbolicCI = 0; /* ci= is symbolic name, not a hash prefix */
154 int isBranchCI = 0; /* True if ci= refers to a branch name */
155 char *zHeader = 0;
156 const char *zRegexp; /* The re= query parameter */
157 char *zMatch; /* Extra title text describing the match */
158
159 if( zCI && strlen(zCI)==0 ){ zCI = 0; }
160 if( strcmp(PD("type","flat"),"tree")==0 ){ page_tree(); return; }
161 login_check_credentials();
162 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
@@ -192,10 +195,17 @@
195 if( zCI ){
196 zHeader = mprintf("Files in %s/ of %s", zD, zCI);
197 }else{
198 zHeader = mprintf("All File in %s/", zD);
199 }
200 }
201 zRegexp = P("re");
202 if( zRegexp ){
203 zHeader = mprintf("%z matching \"%s\"", zHeader, zRegexp);
204 zMatch = mprintf(" matching \"%h\"", zRegexp);
205 }else{
206 zMatch = "";
207 }
208 style_header("%s", zHeader);
209 fossil_free(zHeader);
210 style_adunit_config(ADUNIT_RIGHT_OK);
211 sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
@@ -217,16 +227,19 @@
227 @ <h2>Files in the top-level directory \
228 zPrefix = "";
229 }
230 if( zCI ){
231 if( fossil_strcmp(zCI,"tip")==0 ){
232 @ from the %z(href("%R/info?name=%T",zCI))latest check-in</a>\
233 @ %s(zMatch)</h2>
234 }else if( isBranchCI ){
235 @ from the %z(href("%R/info?name=%T",zCI))latest check-in</a> \
236 @ of branch %z(href("%R/timeline?r=%T",zCI))%h(zCI)</a>\
237 @ %s(zMatch)</h2>
238 }else {
239 @ of check-in %z(href("%R/info?name=%T",zCI))%h(zCI)</a>\
240 @ %s(zMatch)</h2>
241 }
242 zSubdirLink = mprintf("%R/dir?ci=%T&name=%T", zCI, zPrefix);
243 if( nD==0 ){
244 style_submenu_element("File Ages", "%R/fileage?name=%T", zCI);
245 }
@@ -302,10 +315,18 @@
315 db_multi_exec(
316 "INSERT OR IGNORE INTO localfiles"
317 " SELECT pathelement(name,0), NULL FROM filename"
318 );
319 }
320
321 /* If the re=REGEXP query parameter is present, filter out names that
322 ** do not match the pattern */
323 if( zRegexp ){
324 db_multi_exec(
325 "DELETE FROM localfiles WHERE x NOT REGEXP %Q", zRegexp
326 );
327 }
328
329 /* Generate a multi-column table listing the contents of zD[]
330 ** directory.
331 */
332 mxLen = db_int(12, "SELECT max(length(x)) FROM localfiles /*scan*/");
333
--- www/changes.wiki
+++ www/changes.wiki
@@ -47,11 +47,13 @@
4747
commands.
4848
* The javascript used to implement the hamburger menu on the
4949
default built-in skin has been made generic so that it is usable
5050
by a variety of skins, and promoted to an ordinary built-in
5151
javascript file.
52
- * New TH1 commands: "builtin_request_js", "capexpr",
52
+ * New TH1 commands:
53
+ "[/doc/trunk/www/th1.md#bireqjs|builtin_request_js]",
54
+ "[/doc/trunk/www/th1.md#capexpr|capexpr]",
5355
"foreach", "lappend", and "string match"
5456
5557
<a name='v2_14'></a>
5658
<h2>Changes for Version 2.14 (2021-01-20)</h2>
5759
5860
--- www/changes.wiki
+++ www/changes.wiki
@@ -47,11 +47,13 @@
47 commands.
48 * The javascript used to implement the hamburger menu on the
49 default built-in skin has been made generic so that it is usable
50 by a variety of skins, and promoted to an ordinary built-in
51 javascript file.
52 * New TH1 commands: "builtin_request_js", "capexpr",
 
 
53 "foreach", "lappend", and "string match"
54
55 <a name='v2_14'></a>
56 <h2>Changes for Version 2.14 (2021-01-20)</h2>
57
58
--- www/changes.wiki
+++ www/changes.wiki
@@ -47,11 +47,13 @@
47 commands.
48 * The javascript used to implement the hamburger menu on the
49 default built-in skin has been made generic so that it is usable
50 by a variety of skins, and promoted to an ordinary built-in
51 javascript file.
52 * New TH1 commands:
53 "[/doc/trunk/www/th1.md#bireqjs|builtin_request_js]",
54 "[/doc/trunk/www/th1.md#capexpr|capexpr]",
55 "foreach", "lappend", and "string match"
56
57 <a name='v2_14'></a>
58 <h2>Changes for Version 2.14 (2021-01-20)</h2>
59
60
--- www/customskin.md
+++ www/customskin.md
@@ -5,11 +5,11 @@
55
the look and feel (the "skin") of Fossil to better suite your own individual tastes.
66
This document provides background information to aid you in that task.
77
88
## <a name="builtin"></a>Built-in Skins
99
10
-Fossil comes with multiple built-in skins. If the default skin does not
10
+Fossil comes with [multiple built-in skins](/skins). If the default skin does not
1111
suite your tastes, perhaps one of the other built-in skins will work better.
1212
If nothing else, the built-in skins can serve as examples or templates that
1313
you can use to develop your own custom skin.
1414
1515
The sources to these built-ins can
1616
--- www/customskin.md
+++ www/customskin.md
@@ -5,11 +5,11 @@
5 the look and feel (the "skin") of Fossil to better suite your own individual tastes.
6 This document provides background information to aid you in that task.
7
8 ## <a name="builtin"></a>Built-in Skins
9
10 Fossil comes with multiple built-in skins. If the default skin does not
11 suite your tastes, perhaps one of the other built-in skins will work better.
12 If nothing else, the built-in skins can serve as examples or templates that
13 you can use to develop your own custom skin.
14
15 The sources to these built-ins can
16
--- www/customskin.md
+++ www/customskin.md
@@ -5,11 +5,11 @@
5 the look and feel (the "skin") of Fossil to better suite your own individual tastes.
6 This document provides background information to aid you in that task.
7
8 ## <a name="builtin"></a>Built-in Skins
9
10 Fossil comes with [multiple built-in skins](/skins). If the default skin does not
11 suite your tastes, perhaps one of the other built-in skins will work better.
12 If nothing else, the built-in skins can serve as examples or templates that
13 you can use to develop your own custom skin.
14
15 The sources to these built-ins can
16
+14
--- www/th1.md
+++ www/th1.md
@@ -128,10 +128,11 @@
128128
* foreach VARIABLE-LIST VALUE-LIST BODY-SCRIPT
129129
* if EXPR SCRIPT (elseif EXPR SCRIPT)* ?else SCRIPT?
130130
* info commands
131131
* info exists VARNAME
132132
* info vars
133
+ * lappend VARIABLE TERM ...
133134
* lindex LIST INDEX
134135
* list ARG ...
135136
* llength LIST
136137
* lsearch LIST STRING
137138
* proc NAME ARG-LIST BODY-SCRIPT
@@ -141,10 +142,11 @@
141142
* string compare STR1 STR2
142143
* string first NEEDLE HAYSTACK ?START-INDEX?
143144
* string index STRING INDEX
144145
* string is CLASS STRING
145146
* string last NEEDLE HAYSTACK ?START-INDEX?
147
+ * string match PATTERN STRING
146148
* string length STRING
147149
* string range STRING FIRST LAST
148150
* string repeat STRING COUNT
149151
* unset VARNAME
150152
* uplevel ?LEVEL? SCRIPT
@@ -168,10 +170,11 @@
168170
features of Fossil. The following is a summary of the extended commands:
169171
170172
* [anoncap](#anoncap)
171173
* [anycap](#anycap)
172174
* [artifact](#artifact)
175
+ * [builtin_request_js](#bireqjs)
173176
* [capexpr](#capexpr)
174177
* [captureTh1](#captureTh1)
175178
* [cgiHeaderLine](#cgiHeaderLine)
176179
* [checkout](#checkout)
177180
* [combobox](#combobox)
@@ -260,10 +263,21 @@
260263
261264
Attempts to locate the specified artifact and return its contents. An
262265
error is generated if the repository is not open or the artifact cannot
263266
be found.
264267
268
+
269
+<a id="bireqjs"></a>TH1 builtin_request_js Command
270
+--------------------------------------------------
271
+
272
+ * builtin_request_js NAME
273
+
274
+NAME must be the name of one of the
275
+[built-in javascript source files](/dir?ci=trunk&type=flat&name=src&re=js$).
276
+This command causes that javascript file to be appended to the delivered
277
+document.
278
+
265279
266280
267281
<a id="capexpr"></a>TH1 capexpr Command
268282
-----------------------------------------------------
269283
270284
--- www/th1.md
+++ www/th1.md
@@ -128,10 +128,11 @@
128 * foreach VARIABLE-LIST VALUE-LIST BODY-SCRIPT
129 * if EXPR SCRIPT (elseif EXPR SCRIPT)* ?else SCRIPT?
130 * info commands
131 * info exists VARNAME
132 * info vars
 
133 * lindex LIST INDEX
134 * list ARG ...
135 * llength LIST
136 * lsearch LIST STRING
137 * proc NAME ARG-LIST BODY-SCRIPT
@@ -141,10 +142,11 @@
141 * string compare STR1 STR2
142 * string first NEEDLE HAYSTACK ?START-INDEX?
143 * string index STRING INDEX
144 * string is CLASS STRING
145 * string last NEEDLE HAYSTACK ?START-INDEX?
 
146 * string length STRING
147 * string range STRING FIRST LAST
148 * string repeat STRING COUNT
149 * unset VARNAME
150 * uplevel ?LEVEL? SCRIPT
@@ -168,10 +170,11 @@
168 features of Fossil. The following is a summary of the extended commands:
169
170 * [anoncap](#anoncap)
171 * [anycap](#anycap)
172 * [artifact](#artifact)
 
173 * [capexpr](#capexpr)
174 * [captureTh1](#captureTh1)
175 * [cgiHeaderLine](#cgiHeaderLine)
176 * [checkout](#checkout)
177 * [combobox](#combobox)
@@ -260,10 +263,21 @@
260
261 Attempts to locate the specified artifact and return its contents. An
262 error is generated if the repository is not open or the artifact cannot
263 be found.
264
 
 
 
 
 
 
 
 
 
 
 
265
266
267 <a id="capexpr"></a>TH1 capexpr Command
268 -----------------------------------------------------
269
270
--- www/th1.md
+++ www/th1.md
@@ -128,10 +128,11 @@
128 * foreach VARIABLE-LIST VALUE-LIST BODY-SCRIPT
129 * if EXPR SCRIPT (elseif EXPR SCRIPT)* ?else SCRIPT?
130 * info commands
131 * info exists VARNAME
132 * info vars
133 * lappend VARIABLE TERM ...
134 * lindex LIST INDEX
135 * list ARG ...
136 * llength LIST
137 * lsearch LIST STRING
138 * proc NAME ARG-LIST BODY-SCRIPT
@@ -141,10 +142,11 @@
142 * string compare STR1 STR2
143 * string first NEEDLE HAYSTACK ?START-INDEX?
144 * string index STRING INDEX
145 * string is CLASS STRING
146 * string last NEEDLE HAYSTACK ?START-INDEX?
147 * string match PATTERN STRING
148 * string length STRING
149 * string range STRING FIRST LAST
150 * string repeat STRING COUNT
151 * unset VARNAME
152 * uplevel ?LEVEL? SCRIPT
@@ -168,10 +170,11 @@
170 features of Fossil. The following is a summary of the extended commands:
171
172 * [anoncap](#anoncap)
173 * [anycap](#anycap)
174 * [artifact](#artifact)
175 * [builtin_request_js](#bireqjs)
176 * [capexpr](#capexpr)
177 * [captureTh1](#captureTh1)
178 * [cgiHeaderLine](#cgiHeaderLine)
179 * [checkout](#checkout)
180 * [combobox](#combobox)
@@ -260,10 +263,21 @@
263
264 Attempts to locate the specified artifact and return its contents. An
265 error is generated if the repository is not open or the artifact cannot
266 be found.
267
268
269 <a id="bireqjs"></a>TH1 builtin_request_js Command
270 --------------------------------------------------
271
272 * builtin_request_js NAME
273
274 NAME must be the name of one of the
275 [built-in javascript source files](/dir?ci=trunk&type=flat&name=src&re=js$).
276 This command causes that javascript file to be appended to the delivered
277 document.
278
279
280
281 <a id="capexpr"></a>TH1 capexpr Command
282 -----------------------------------------------------
283
284

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button