Fossil

Diff
Login

Differences From Artifact [705c6b6df8]:

To Artifact [26c061cb25]:


344
345
346
347
348
349
350
351
352
353

354
355
356
357
358
359
360
361
** unless a value starts with a lowercase letter.
** Malformed values are silently ignored.
*/
void style_submenu_parametric(
  const char *zPrefix,   /* common prefix of the query parameters names */
  const int  nMaxDigit   /* maximal digit on the end of param names     */
){
  const char *zQS;             /* QUERY_STRING */
  const char *suffix = "smpl"; /* common suffix for all parameters      */
  const short sfxlen =  4;     /* length of the above suffix            */

  char  zN[32];                /* short names => no dynamic allocations */
  short i,l;

  /* zPrefix must be tidy and short; also filter out ENV/CGI variables  */
  assert( zPrefix != 0 && fossil_islower(zPrefix[0]) );
  l = strnlen( zPrefix, sizeof(zN) );
  assert( l+sfxlen+2 <= sizeof(zN) );
  assert( fossil_no_strange_characters(zPrefix) );







<
|
|
>
|







344
345
346
347
348
349
350

351
352
353
354
355
356
357
358
359
360
361
** unless a value starts with a lowercase letter.
** Malformed values are silently ignored.
*/
void style_submenu_parametric(
  const char *zPrefix,   /* common prefix of the query parameters names */
  const int  nMaxDigit   /* maximal digit on the end of param names     */
){

  static const char *suffix = "smpl"; /* common suffix for param names */
  static const short sfxlen =  4;     /* length of the above suffix    */
  const char *zQS;     /* QUERY_STRING */
  char  zN[32];        /* buffer for parameter names to probe */
  short i,l;

  /* zPrefix must be tidy and short; also filter out ENV/CGI variables  */
  assert( zPrefix != 0 && fossil_islower(zPrefix[0]) );
  l = strnlen( zPrefix, sizeof(zN) );
  assert( l+sfxlen+2 <= sizeof(zN) );
  assert( fossil_no_strange_characters(zPrefix) );
376
377
378
379
380
381
382
383
384
385




386






387
388
389
390
391
392
393
    for( z = zV; z[0] && z[0] != '/' ;){
      if( fossil_isalnum(z[0]) || z[0]=='_' || z[0]=='-' ) z++;
      else break;
    }
    if( z[0] != 0 && z[0] != '/' )
      continue;
    assert( nSubmenu < count(aSubmenu) );
    if(fossil_islower(zV[0])){
      aSubmenu[nSubmenu].zLabel = mprintf( "%s",zV); /* memory leak?  */
    }else{




      aSubmenu[nSubmenu].zLabel = mprintf("✧%s",zV); /* maybe: ◦✧⸰⸎ ✨ */






    }
    if( zQS[0] ){
      aSubmenu[nSubmenu].zLink  = mprintf("%R/%s?%s",zV,zQS);
    }else{
      aSubmenu[nSubmenu].zLink  = mprintf("%R/%s",zV);
    }
    nSubmenu++;







|


>
>
>
>
|
>
>
>
>
>
>







376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
    for( z = zV; z[0] && z[0] != '/' ;){
      if( fossil_isalnum(z[0]) || z[0]=='_' || z[0]=='-' ) z++;
      else break;
    }
    if( z[0] != 0 && z[0] != '/' )
      continue;
    assert( nSubmenu < count(aSubmenu) );
    if(fossil_islower(zV[0]) && z[0]=='/'){
      aSubmenu[nSubmenu].zLabel = mprintf( "%s",zV); /* memory leak?  */
    }else{
      /* prepend a label with an unobtrusive symbol that "sorts-last";
      ** this clearly distincts it from the built-in elements */
      static const char *mark = "✧";
      char *z = mprintf("%s%s",mark,zV);
      aSubmenu[nSubmenu].zLabel = z;
      /* also prettify the first segment */
      z += strlen(mark);
      z[0] = fossil_toupper(z[0]);
      for(; z[0]!=0 && z[0]!='/'; z++ ){
        if( z[0]=='_' ) z[0] = ' ';
      }
    }
    if( zQS[0] ){
      aSubmenu[nSubmenu].zLink  = mprintf("%R/%s?%s",zV,zQS);
    }else{
      aSubmenu[nSubmenu].zLink  = mprintf("%R/%s",zV);
    }
    nSubmenu++;