Fossil SCM

Dynamic number of columns on the /help page, based on screen width

drh 2018-08-21 01:33 trunk
Commit 1d495e89e24896deafa222b3c9429c439bb9dd6c222fedb56f94dfcd54b74553
1 file changed +41 -105
+41 -105
--- src/dispatch.c
+++ src/dispatch.c
@@ -349,136 +349,72 @@
349349
help_to_html(pCmd->zHelp, cgi_output_blob());
350350
@ </blockquote>
351351
}
352352
}
353353
}else{
354
- int i, j, n;
354
+ int i;
355355
356356
style_header("Help");
357357
358358
@ <a name='commands'></a>
359359
@ <h1>Available commands:</h1>
360
- @ <table border="0"><tr>
361
- for(i=j=0; i<MX_COMMAND; i++){
362
- const char *z = aCommand[i].zName;
363
- if( '/'==*z || strncmp(z,"test",4)==0 ) continue;
364
- if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)!=0 ) continue;
365
- j++;
366
- }
367
- n = (j+5)/6;
368
- for(i=j=0; i<MX_COMMAND; i++){
360
+ @ <div class="columns" style="column-width: 12ex;">
361
+ @ <ul>
362
+ for(i=0; i<MX_COMMAND; i++){
369363
const char *z = aCommand[i].zName;
370364
const char *zBoldOn = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"<b>" :"";
371365
const char *zBoldOff = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"</b>":"";
372366
if( '/'==*z || strncmp(z,"test",4)==0 ) continue;
373367
if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)!=0 ) continue;
374
- if( j==0 ){
375
- @ <td valign="top"><ul>
376
- }
377368
@ <li><a href="%R/help?cmd=%s(z)">%s(zBoldOn)%s(z)%s(zBoldOff)</a></li>
378
- j++;
379
- if( j>=n ){
380
- @ </ul></td>
381
- j = 0;
382
- }
383
- }
384
- if( j>0 ){
385
- @ </ul></td>
386
- }
387
- @ </tr></table>
369
+ }
370
+ @ </ui></div>
388371
389372
@ <a name='webpages'></a>
390373
@ <h1>Available web UI pages:</h1>
391
- @ <table border="0"><tr>
392
- for(i=j=0; i<MX_COMMAND; i++){
374
+ @ <div class="columns" style="column-width: 18ex;">
375
+ @ <ul>
376
+ for(i=0; i<MX_COMMAND; i++){
393377
const char *z = aCommand[i].zName;
394378
if( '/'!=*z ) continue;
395
- j++;
396
- }
397
- n = (j+4)/5;
398
- for(i=j=0; i<MX_COMMAND; i++){
399
- const char *z = aCommand[i].zName;
400
- if( '/'!=*z ) continue;
401
- if( j==0 ){
402
- @ <td valign="top"><ul>
403
- }
404379
if( aCommand[i].zHelp[0] ){
405380
@ <li><a href="%R/help?cmd=%s(z)">%s(z+1)</a></li>
406381
}else{
407382
@ <li>%s(z+1)</li>
408383
}
409
- j++;
410
- if( j>=n ){
411
- @ </ul></td>
412
- j = 0;
413
- }
414
- }
415
- if( j>0 ){
416
- @ </ul></td>
417
- }
418
- @ </tr></table>
419
-
420
- @ <a name='unsupported'></a>
421
- @ <h1>Unsupported commands:</h1>
422
- @ <table border="0"><tr>
423
- for(i=j=0; i<MX_COMMAND; i++){
424
- const char *z = aCommand[i].zName;
425
- if( strncmp(z,"test",4)!=0 ) continue;
426
- j++;
427
- }
428
- n = (j+3)/4;
429
- for(i=j=0; i<MX_COMMAND; i++){
430
- const char *z = aCommand[i].zName;
431
- if( strncmp(z,"test",4)!=0 ) continue;
432
- if( j==0 ){
433
- @ <td valign="top"><ul>
434
- }
435
- if( aCommand[i].zHelp[0] ){
436
- @ <li><a href="%R/help?cmd=%s(z)">%s(z)</a></li>
437
- }else{
438
- @ <li>%s(z)</li>
439
- }
440
- j++;
441
- if( j>=n ){
442
- @ </ul></td>
443
- j = 0;
444
- }
445
- }
446
- if( j>0 ){
447
- @ </ul></td>
448
- }
449
- @ </tr></table>
450
-
451
- @ <a name='settings'></a>
452
- @ <h1>Settings:</h1>
453
- @ <table border="0"><tr>
454
- for(i=j=0; i<MX_COMMAND; i++){
455
- if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)==0 ) continue;
456
- j++;
457
- }
458
- n = (j+4)/5;
459
- for(i=j=0; i<MX_COMMAND; i++){
460
- const char *z = aCommand[i].zName;
461
- if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)==0 ) continue;
462
- if( j==0 ){
463
- @ <td valign="top"><ul>
464
- }
465
- if( aCommand[i].zHelp[0] ){
466
- @ <li><a href="%R/help?cmd=%s(z)">%s(z)</a></li>
467
- }else{
468
- @ <li>%s(z)</li>
469
- }
470
- j++;
471
- if( j>=n ){
472
- @ </ul></td>
473
- j = 0;
474
- }
475
- }
476
- if( j>0 ){
477
- @ </ul></td>
478
- }
479
- @ </tr></table>
384
+ }
385
+ @ </ul></div>
386
+
387
+ @ <a name='unsupported'></a>
388
+ @ <h1>Unsupported commands:</h1>
389
+ @ <div class="columns" style="column-width: 20ex;">
390
+ @ <ul>
391
+ for(i=0; i<MX_COMMAND; i++){
392
+ const char *z = aCommand[i].zName;
393
+ if( strncmp(z,"test",4)!=0 ) continue;
394
+ if( aCommand[i].zHelp[0] ){
395
+ @ <li><a href="%R/help?cmd=%s(z)">%s(z)</a></li>
396
+ }else{
397
+ @ <li>%s(z)</li>
398
+ }
399
+ }
400
+ @ </ul></div>
401
+
402
+ @ <a name='settings'></a>
403
+ @ <h1>Settings:</h1>
404
+ @ <div class="columns" style="column-width: 20ex;">
405
+ @ <ul>
406
+ for(i=0; i<MX_COMMAND; i++){
407
+ const char *z = aCommand[i].zName;
408
+ if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)==0 ) continue;
409
+ if( aCommand[i].zHelp[0] ){
410
+ @ <li><a href="%R/help?cmd=%s(z)">%s(z)</a></li>
411
+ }else{
412
+ @ <li>%s(z)</li>
413
+ }
414
+ }
415
+ @ </ul></div>
480416
481417
}
482418
style_footer();
483419
}
484420
485421
--- src/dispatch.c
+++ src/dispatch.c
@@ -349,136 +349,72 @@
349 help_to_html(pCmd->zHelp, cgi_output_blob());
350 @ </blockquote>
351 }
352 }
353 }else{
354 int i, j, n;
355
356 style_header("Help");
357
358 @ <a name='commands'></a>
359 @ <h1>Available commands:</h1>
360 @ <table border="0"><tr>
361 for(i=j=0; i<MX_COMMAND; i++){
362 const char *z = aCommand[i].zName;
363 if( '/'==*z || strncmp(z,"test",4)==0 ) continue;
364 if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)!=0 ) continue;
365 j++;
366 }
367 n = (j+5)/6;
368 for(i=j=0; i<MX_COMMAND; i++){
369 const char *z = aCommand[i].zName;
370 const char *zBoldOn = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"<b>" :"";
371 const char *zBoldOff = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"</b>":"";
372 if( '/'==*z || strncmp(z,"test",4)==0 ) continue;
373 if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)!=0 ) continue;
374 if( j==0 ){
375 @ <td valign="top"><ul>
376 }
377 @ <li><a href="%R/help?cmd=%s(z)">%s(zBoldOn)%s(z)%s(zBoldOff)</a></li>
378 j++;
379 if( j>=n ){
380 @ </ul></td>
381 j = 0;
382 }
383 }
384 if( j>0 ){
385 @ </ul></td>
386 }
387 @ </tr></table>
388
389 @ <a name='webpages'></a>
390 @ <h1>Available web UI pages:</h1>
391 @ <table border="0"><tr>
392 for(i=j=0; i<MX_COMMAND; i++){
 
393 const char *z = aCommand[i].zName;
394 if( '/'!=*z ) continue;
395 j++;
396 }
397 n = (j+4)/5;
398 for(i=j=0; i<MX_COMMAND; i++){
399 const char *z = aCommand[i].zName;
400 if( '/'!=*z ) continue;
401 if( j==0 ){
402 @ <td valign="top"><ul>
403 }
404 if( aCommand[i].zHelp[0] ){
405 @ <li><a href="%R/help?cmd=%s(z)">%s(z+1)</a></li>
406 }else{
407 @ <li>%s(z+1)</li>
408 }
409 j++;
410 if( j>=n ){
411 @ </ul></td>
412 j = 0;
413 }
414 }
415 if( j>0 ){
416 @ </ul></td>
417 }
418 @ </tr></table>
419
420 @ <a name='unsupported'></a>
421 @ <h1>Unsupported commands:</h1>
422 @ <table border="0"><tr>
423 for(i=j=0; i<MX_COMMAND; i++){
424 const char *z = aCommand[i].zName;
425 if( strncmp(z,"test",4)!=0 ) continue;
426 j++;
427 }
428 n = (j+3)/4;
429 for(i=j=0; i<MX_COMMAND; i++){
430 const char *z = aCommand[i].zName;
431 if( strncmp(z,"test",4)!=0 ) continue;
432 if( j==0 ){
433 @ <td valign="top"><ul>
434 }
435 if( aCommand[i].zHelp[0] ){
436 @ <li><a href="%R/help?cmd=%s(z)">%s(z)</a></li>
437 }else{
438 @ <li>%s(z)</li>
439 }
440 j++;
441 if( j>=n ){
442 @ </ul></td>
443 j = 0;
444 }
445 }
446 if( j>0 ){
447 @ </ul></td>
448 }
449 @ </tr></table>
450
451 @ <a name='settings'></a>
452 @ <h1>Settings:</h1>
453 @ <table border="0"><tr>
454 for(i=j=0; i<MX_COMMAND; i++){
455 if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)==0 ) continue;
456 j++;
457 }
458 n = (j+4)/5;
459 for(i=j=0; i<MX_COMMAND; i++){
460 const char *z = aCommand[i].zName;
461 if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)==0 ) continue;
462 if( j==0 ){
463 @ <td valign="top"><ul>
464 }
465 if( aCommand[i].zHelp[0] ){
466 @ <li><a href="%R/help?cmd=%s(z)">%s(z)</a></li>
467 }else{
468 @ <li>%s(z)</li>
469 }
470 j++;
471 if( j>=n ){
472 @ </ul></td>
473 j = 0;
474 }
475 }
476 if( j>0 ){
477 @ </ul></td>
478 }
479 @ </tr></table>
480
481 }
482 style_footer();
483 }
484
485
--- src/dispatch.c
+++ src/dispatch.c
@@ -349,136 +349,72 @@
349 help_to_html(pCmd->zHelp, cgi_output_blob());
350 @ </blockquote>
351 }
352 }
353 }else{
354 int i;
355
356 style_header("Help");
357
358 @ <a name='commands'></a>
359 @ <h1>Available commands:</h1>
360 @ <div class="columns" style="column-width: 12ex;">
361 @ <ul>
362 for(i=0; i<MX_COMMAND; i++){
 
 
 
 
 
 
363 const char *z = aCommand[i].zName;
364 const char *zBoldOn = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"<b>" :"";
365 const char *zBoldOff = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"</b>":"";
366 if( '/'==*z || strncmp(z,"test",4)==0 ) continue;
367 if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)!=0 ) continue;
 
 
 
368 @ <li><a href="%R/help?cmd=%s(z)">%s(zBoldOn)%s(z)%s(zBoldOff)</a></li>
369 }
370 @ </ui></div>
 
 
 
 
 
 
 
 
371
372 @ <a name='webpages'></a>
373 @ <h1>Available web UI pages:</h1>
374 @ <div class="columns" style="column-width: 18ex;">
375 @ <ul>
376 for(i=0; i<MX_COMMAND; i++){
377 const char *z = aCommand[i].zName;
378 if( '/'!=*z ) continue;
 
 
 
 
 
 
 
 
 
379 if( aCommand[i].zHelp[0] ){
380 @ <li><a href="%R/help?cmd=%s(z)">%s(z+1)</a></li>
381 }else{
382 @ <li>%s(z+1)</li>
383 }
384 }
385 @ </ul></div>
386
387 @ <a name='unsupported'></a>
388 @ <h1>Unsupported commands:</h1>
389 @ <div class="columns" style="column-width: 20ex;">
390 @ <ul>
391 for(i=0; i<MX_COMMAND; i++){
392 const char *z = aCommand[i].zName;
393 if( strncmp(z,"test",4)!=0 ) continue;
394 if( aCommand[i].zHelp[0] ){
395 @ <li><a href="%R/help?cmd=%s(z)">%s(z)</a></li>
396 }else{
397 @ <li>%s(z)</li>
398 }
399 }
400 @ </ul></div>
401
402 @ <a name='settings'></a>
403 @ <h1>Settings:</h1>
404 @ <div class="columns" style="column-width: 20ex;">
405 @ <ul>
406 for(i=0; i<MX_COMMAND; i++){
407 const char *z = aCommand[i].zName;
408 if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)==0 ) continue;
409 if( aCommand[i].zHelp[0] ){
410 @ <li><a href="%R/help?cmd=%s(z)">%s(z)</a></li>
411 }else{
412 @ <li>%s(z)</li>
413 }
414 }
415 @ </ul></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
416
417 }
418 style_footer();
419 }
420
421

Keyboard Shortcuts

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