Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Initial 'help' support for WEBPAGE entries. Not yet finished, but seems to work in CLI mode. |
|---|---|
| Timelines: | family | ancestors | descendants | both | help-www |
| Files: | files | file ages | folders |
| SHA1: |
e788795bbfd0db1ca601670e3fae8496 |
| User & Date: | stephan 2013-02-20 22:10:29.796 |
Context
|
2013-02-20
| ||
| 22:30 | Modified /help page to show help text for /pages. Only pages with help text get hyperlinks. check-in: affccaa822 user: stephan tags: help-www | |
| 22:10 | Initial 'help' support for WEBPAGE entries. Not yet finished, but seems to work in CLI mode. check-in: e788795bbf user: stephan tags: help-www | |
| 18:54 | Added timeline.rss changes to changelog. check-in: d84ec60ddd user: stephan tags: trunk | |
Changes
Changes to src/main.c.
| ︙ | ︙ | |||
931 932 933 934 935 936 937 |
/*
** COMMAND: test-list-webpage
**
** List all web pages
*/
void cmd_test_webpage_list(void){
int i, nCmd;
| | | > | | > > | 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 |
/*
** COMMAND: test-list-webpage
**
** List all web pages
*/
void cmd_test_webpage_list(void){
int i, nCmd;
const char *aCmd[count(aCommand)];
for(i=nCmd=0; i<count(aCommand); i++){
if(0x08 & aCommand[i].cmdFlags){
aCmd[nCmd++] = aWebpage[i].zName;
}
}
assert(nCmd && "page list is empty?");
multi_column_list(aCmd, nCmd);
}
/*
** COMMAND: version
**
** Usage: %fossil version
|
| ︙ | ︙ | |||
964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 |
** Display information on how to use COMMAND. To display a list of
** available commands one of:
**
** %fossil help Show common commands
** %fossil help --all Show both common and auxiliary commands
** %fossil help --test Show test commands only
** %fossil help --aux Show auxiliary commands only
*/
void help_cmd(void){
int rc, idx;
const char *z;
if( g.argc<3 ){
z = g.argv[0];
fossil_print(
"Usage: %s help COMMAND\n"
"Common COMMANDs: (use \"%s help --all\" for a complete list)\n",
z, z);
command_list(0, CMDFLAG_1ST_TIER);
version_cmd();
return;
}
if( find_option("all",0,0) ){
command_list(0, CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER);
return;
}
| > > > > > | | | | | 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 |
** Display information on how to use COMMAND. To display a list of
** available commands one of:
**
** %fossil help Show common commands
** %fossil help --all Show both common and auxiliary commands
** %fossil help --test Show test commands only
** %fossil help --aux Show auxiliary commands only
** %fossil help --www Show list of WWW pages
*/
void help_cmd(void){
int rc, idx;
const char *z;
if( g.argc<3 ){
z = g.argv[0];
fossil_print(
"Usage: %s help COMMAND\n"
"Common COMMANDs: (use \"%s help --all\" for a complete list)\n",
z, z);
command_list(0, CMDFLAG_1ST_TIER);
version_cmd();
return;
}
if( find_option("all",0,0) ){
command_list(0, CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER);
return;
}
else if( find_option("www",0,0) ){
command_list(0, CMDFLAG_WEBPAGE);
return;
}
else if( find_option("aux",0,0) ){
command_list(0, CMDFLAG_2ND_TIER);
return;
}
else if( find_option("test",0,0) ){
command_list(0, CMDFLAG_TEST);
return;
}
rc = name_search(g.argv[2], aCommand, count(aCommand), &idx);
if( rc==1 ){
fossil_print("unknown command: %s\nAvailable commands:\n", g.argv[2]);
command_list(0, 0xff & ~CMDFLAG_WEBPAGE);
fossil_exit(1);
}else if( rc==2 ){
fossil_print("ambiguous command prefix: %s\nMatching commands:\n",
g.argv[2]);
command_list(g.argv[2], 0xff);
fossil_exit(1);
}
z = aCmdHelp[idx].zText;
if( z==0 ){
fossil_fatal("no help available for the %s command",
aCommand[idx].zName);
}
while( *z ){
if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){
fossil_print("%s", g.argv[0]);
|
| ︙ | ︙ | |||
1039 1040 1041 1042 1043 1044 1045 |
@ <h1>The "%s(zCmd)" command:</h1>
rc = name_search(zCmd, aCommand, count(aCommand), &idx);
if( rc==1 ){
@ unknown command: %s(zCmd)
}else if( rc==2 ){
@ ambiguous command prefix: %s(zCmd)
}else{
| | | 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 |
@ <h1>The "%s(zCmd)" command:</h1>
rc = name_search(zCmd, aCommand, count(aCommand), &idx);
if( rc==1 ){
@ unknown command: %s(zCmd)
}else if( rc==2 ){
@ ambiguous command prefix: %s(zCmd)
}else{
z = (char*)aCmdHelp[idx].zText;
if( z==0 ){
@ no help available for the %s(aCommand[idx].zName) command
}else{
z=s=d=mprintf("%s",z);
while( *s ){
if( *s=='%' && strncmp(s, "%fossil", 7)==0 ){
s++;
|
| ︙ | ︙ | |||
1102 1103 1104 1105 1106 1107 1108 |
void test_all_help_page(void){
int i;
style_header("Testpage: All Help Text");
for(i=0; i<count(aCommand); i++){
if( memcmp(aCommand[i].zName, "test", 4)==0 ) continue;
@ <h2>%s(aCommand[i].zName):</h2>
@ <blockquote><pre>
| | | 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 |
void test_all_help_page(void){
int i;
style_header("Testpage: All Help Text");
for(i=0; i<count(aCommand); i++){
if( memcmp(aCommand[i].zName, "test", 4)==0 ) continue;
@ <h2>%s(aCommand[i].zName):</h2>
@ <blockquote><pre>
@ %h(aCmdHelp[i].zText)
@ </pre></blockquote>
}
style_footer();
}
/*
** Set the g.zBaseURL value to the full URL for the toplevel of
|
| ︙ | ︙ |
Changes to src/mkindex.c.
| ︙ | ︙ | |||
172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
char *z;
if( nUsed<=nFixed ) return;
if( strncmp(zLine, "**", 2)==0
&& isspace(zLine[2])
&& strlen(zLine)<sizeof(zHelp)-nHelp-1
&& nUsed>nFixed
&& memcmp(zLine,"** COMMAND:",11)!=0
){
if( zLine[2]=='\n' ){
zHelp[nHelp++] = '\n';
}else{
if( strncmp(&zLine[3], "Usage: ", 6)==0 ) nHelp = 0;
strcpy(&zHelp[nHelp], &zLine[3]);
nHelp += strlen(&zHelp[nHelp]);
| > | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
char *z;
if( nUsed<=nFixed ) return;
if( strncmp(zLine, "**", 2)==0
&& isspace(zLine[2])
&& strlen(zLine)<sizeof(zHelp)-nHelp-1
&& nUsed>nFixed
&& memcmp(zLine,"** COMMAND:",11)!=0
&& memcmp(zLine,"** WEBPAGE:",11)!=0
){
if( zLine[2]=='\n' ){
zHelp[nHelp++] = '\n';
}else{
if( strncmp(&zLine[3], "Usage: ", 6)==0 ) nHelp = 0;
strcpy(&zHelp[nHelp], &zLine[3]);
nHelp += strlen(&zHelp[nHelp]);
|
| ︙ | ︙ | |||
240 241 242 243 244 245 246 |
}
/*
** Build the binary search table.
*/
void build_table(void){
int i;
| < > < | | > | | | | | | > | > | > | | | > | | | | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
}
/*
** Build the binary search table.
*/
void build_table(void){
int i;
qsort(aEntry, nFixed, sizeof(aEntry[0]), e_compare);
for(i=0; i<nFixed; i++){
if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
printf("extern void %s(void);\n", aEntry[i].zFunc);
if( aEntry[i].zIf ) printf("#endif\n");
}
printf(
"typedef struct NameMap NameMap;\n"
"struct NameMap {\n"
" const char *zName;\n"
" void (*xFunc)(void);\n"
" char cmdFlags;\n"
"};\n"
"#define CMDFLAG_1ST_TIER 0x01\n"
"#define CMDFLAG_2ND_TIER 0x02\n"
"#define CMDFLAG_TEST 0x04\n"
"#define CMDFLAG_WEBPAGE 0x08\n"
"static const NameMap aWebpage[] = {\n"
);
for(i=0; i<nFixed && aEntry[i].eType==0; i++){
const char *z = aEntry[i].zPath;
int n = strlen(z);
if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
printf(" { \"%s\",%*s %s,%*s 1 },\n",
z,
25-n, "",
aEntry[i].zFunc,
(int)(35-strlen(aEntry[i].zFunc)), ""
);
if( aEntry[i].zIf ) printf("#endif\n");
}
printf("};\n");
printf(
"static const NameMap aCommand[] = {\n"
);
for(i=0; i<nFixed /*&& aEntry[i].eType==1*/; i++){
const char *z = aEntry[i].zPath;
int n = strlen(z);
int cmdFlags = (1==aEntry[i].eType) ? 0x01 : 0x08;
if(0x01==cmdFlags){
if( z[n-1]=='*' ){
n--;
cmdFlags = 0x02;
}else if( memcmp(z, "test-", 5)==0 ){
cmdFlags = 0x04;
}
}
if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
printf(" { \"%s%.*s\",%*s %s,%*s %d },\n",
(0x08 & cmdFlags) ? "/" : "",
n, z,
25-n, "",
aEntry[i].zFunc,
(int)(35-strlen(aEntry[i].zFunc)), "",
cmdFlags
);
if( aEntry[i].zIf ) printf("#endif\n");
}
printf("};\n");
for(i=0; i<nFixed; i++){
char *z = aEntry[i].zHelp;
if( z && z[0] ){
if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
printf("static const char zHelp_%s[] = \n", aEntry[i].zFunc);
printf(" \"");
while( *z ){
if( *z=='\n' ){
printf("\\n\"\n \"");
}else if( *z=='"' ){
printf("\\\"");
}else{
putchar(*z);
}
z++;
}
printf("\";\n");
if( aEntry[i].zIf ) printf("#endif\n");
aEntry[i].zHelp[0] = 0;
}
}
puts("struct CmdHelp {"
"int eType; "
"char const * zText;"
"};");
puts("static struct CmdHelp aCmdHelp[] = {");
for(i=0; i<nFixed; i++){
if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
if( aEntry[i].zHelp==0 ){
printf("{%d, 0},\n", aEntry[i].eType);
}else{
printf("{%d, zHelp_%s},\n", aEntry[i].eType, aEntry[i].zFunc);
}
if( aEntry[i].zIf ) printf("#endif\n");
}
printf("};\n");
}
/*
|
| ︙ | ︙ |
Changes to src/rss.c.
| ︙ | ︙ | |||
20 21 22 23 24 25 26 | #include "config.h" #include <time.h> #include "rss.h" #include <assert.h> /* ** WEBPAGE: timeline.rss | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #include "config.h" #include <time.h> #include "rss.h" #include <assert.h> /* ** WEBPAGE: timeline.rss ** URL: /timeline.rss?y=TYPE&n=LIMIT&tkt=UUID&tag=TAG&wiki=NAME&name=FILENAME ** ** Produce an RSS feed of the timeline. ** ** TYPE may be: all, ci (show checkins only), t (show tickets only), ** w (show wiki only). LIMIT is the number of items to show. ** ** tkt=UUID filters for only those events for the specified ticket. tag=TAG |
| ︙ | ︙ |