Fossil

Check-in [71b221657b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add TH1 command "<code>submenu</code>". For the time being it has just one subcommand "<code>link</code>" that adds a hyperlink to the submenu of a page.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 71b221657bfa7bdf05f00e863e991423db483ad0e111ef971c15cabf2658dba9
User & Date: george 2022-11-24 22:13:55.468
Context
2022-11-26
17:31
Fix <code>artifact_page()</code> function so that the content of a text file is surrounded by CODE elements even if a file's extension is just a single letter. ... (check-in: e7a7b5c1b0 user: george tags: trunk)
2022-11-24
22:13
Add TH1 command "<code>submenu</code>". For the time being it has just one subcommand "<code>link</code>" that adds a hyperlink to the submenu of a page. ... (check-in: 71b221657b user: george tags: trunk)
15:21
In the new forum reply header, reduce size from H1 to H2 and italicize the thread title. ... (check-in: 7b92fc614d user: stephan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/style.c.
993
994
995
996
997
998
999

1000
1001
1002
1003
1004
1005
1006
1007
    if( nSubmenu>0 ){
      qsort(aSubmenu, nSubmenu, sizeof(aSubmenu[0]), submenuCompare);
      for(i=0; i<nSubmenu; i++){
        struct Submenu *p = &aSubmenu[i];
        style_derive_classname(p->zLabel, zClass, sizeof zClass);
        /* switching away from the %h formatting below might be dangerous
        ** because some places use %s to compose zLabel and zLink;

        ** e.g. /rptview page.  "sml" stands for submenu link.
        */
        if( p->zLink==0 ){
          @ <span class="label sml-%s(zClass)">%h(p->zLabel)</span>
        }else{
          @ <a class="label sml-%s(zClass)" href="%h(p->zLink)">%h(p->zLabel)</a>
        }
      }







>
|







993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
    if( nSubmenu>0 ){
      qsort(aSubmenu, nSubmenu, sizeof(aSubmenu[0]), submenuCompare);
      for(i=0; i<nSubmenu; i++){
        struct Submenu *p = &aSubmenu[i];
        style_derive_classname(p->zLabel, zClass, sizeof zClass);
        /* switching away from the %h formatting below might be dangerous
        ** because some places use %s to compose zLabel and zLink;
        ** e.g. /rptview page and the submenuCmd() function.
        ** "sml" stands for submenu link.
        */
        if( p->zLink==0 ){
          @ <span class="label sml-%s(zClass)">%h(p->zLabel)</span>
        }else{
          @ <a class="label sml-%s(zClass)" href="%h(p->zLink)">%h(p->zLabel)</a>
        }
      }
Changes to src/th_main.c.
1585
1586
1587
1588
1589
1590
1591
































1592
1593
1594
1595
1596
1597
1598
    Th_SetResult(interp, 0, 0);
    return TH_OK;
  }else{
    Th_SetResult(interp, "repository unavailable", -1);
    return TH_ERROR;
  }
}

































/*
** TH1 command: builtin_request_js NAME
**
** Request that the built-in javascript file called NAME be added to the
** end of the generated page.
**







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
    Th_SetResult(interp, 0, 0);
    return TH_OK;
  }else{
    Th_SetResult(interp, "repository unavailable", -1);
    return TH_ERROR;
  }
}

/*
** TH1 command: submenu link LABEL URL
**
** Add a hyperlink to the submenu.
*/
static int submenuCmd(
  Th_Interp *interp,
  void *p,
  int argc,
  const char **argv,
  int *argl
){
  if( argc!=4 || memcmp(argv[1],"link",5)!=0 ){
    return Th_WrongNumArgs(interp, "submenu link LABEL URL");
  }
  if( argl[2]==0 ){
    Th_SetResult(interp, "link's LABEL is empty", -1);
    return TH_ERROR;
  }
  if( argl[3]==0 ){
    Th_SetResult(interp, "link's URL is empty", -1);
    return TH_ERROR;
  }
  /*
  ** Label and URL are unescaped because it is expected that
  ** style_finish_page() provides propper escaping via %h format.
  */
  style_submenu_element( fossil_strdup(argv[2]), "%s", argv[3] );
  Th_SetResult(interp, 0, 0);
  return TH_OK;
}

/*
** TH1 command: builtin_request_js NAME
**
** Request that the built-in javascript file called NAME be added to the
** end of the generated page.
**
2328
2329
2330
2331
2332
2333
2334

2335
2336
2337
2338
2339
2340
2341
    {"repository",    repositoryCmd,        0},
    {"searchable",    searchableCmd,        0},
    {"setParameter",  setParameterCmd,      0},
    {"setting",       settingCmd,           0},
    {"styleFooter",   styleFooterCmd,       0},
    {"styleHeader",   styleHeaderCmd,       0},
    {"styleScript",   styleScriptCmd,       0},

    {"tclReady",      tclReadyCmd,          0},
    {"trace",         traceCmd,             0},
    {"stime",         stimeCmd,             0},
    {"unversioned",   unversionedCmd,       0},
    {"utime",         utimeCmd,             0},
    {"verifyCsrf",    verifyCsrfCmd,        0},
    {"verifyLogin",   verifyLoginCmd,       0},







>







2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
    {"repository",    repositoryCmd,        0},
    {"searchable",    searchableCmd,        0},
    {"setParameter",  setParameterCmd,      0},
    {"setting",       settingCmd,           0},
    {"styleFooter",   styleFooterCmd,       0},
    {"styleHeader",   styleHeaderCmd,       0},
    {"styleScript",   styleScriptCmd,       0},
    {"submenu",       submenuCmd,           0},
    {"tclReady",      tclReadyCmd,          0},
    {"trace",         traceCmd,             0},
    {"stime",         stimeCmd,             0},
    {"unversioned",   unversionedCmd,       0},
    {"utime",         utimeCmd,             0},
    {"verifyCsrf",    verifyCsrfCmd,        0},
    {"verifyLogin",   verifyLoginCmd,       0},
Changes to www/th1.md.
211
212
213
214
215
216
217

218
219
220
221
222
223
224
  *  [searchable](#searchable)
  *  [setParameter](#setParameter)
  *  [setting](#setting)
  *  [stime](#stime)
  *  [styleHeader](#styleHeader)
  *  [styleFooter](#styleFooter)
  *  [styleScript](#styleScript)

  *  [tclEval](#tclEval)
  *  [tclExpr](#tclExpr)
  *  [tclInvoke](#tclInvoke)
  *  [tclIsSafe](#tclIsSafe)
  *  [tclMakeSafe](#tclMakeSafe)
  *  [tclReady](#tclReady)
  *  [trace](#trace)







>







211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
  *  [searchable](#searchable)
  *  [setParameter](#setParameter)
  *  [setting](#setting)
  *  [stime](#stime)
  *  [styleHeader](#styleHeader)
  *  [styleFooter](#styleFooter)
  *  [styleScript](#styleScript)
  *  [submenu](#submenu)
  *  [tclEval](#tclEval)
  *  [tclExpr](#tclExpr)
  *  [tclInvoke](#tclInvoke)
  *  [tclIsSafe](#tclIsSafe)
  *  [tclMakeSafe](#tclMakeSafe)
  *  [tclReady](#tclReady)
  *  [trace](#trace)
732
733
734
735
736
737
738







739
740
741
742
743
744
745
<a id="styleScript"></a>TH1 styleScript Command
-------------------------------------------------

  *  styleScript

Render the configured JavaScript for the selected skin.








<a id="tclEval"></a>TH1 tclEval Command
-----------------------------------------

**This command requires the Tcl integration feature.**

  *  tclEval arg ?arg ...?








>
>
>
>
>
>
>







733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
<a id="styleScript"></a>TH1 styleScript Command
-------------------------------------------------

  *  styleScript

Render the configured JavaScript for the selected skin.

<a id="submenu"></a>TH1 submenu Command
-----------------------------------------

  *  submenu link LABEL URL

Add hyperlink to the submenu of the current page.

<a id="tclEval"></a>TH1 tclEval Command
-----------------------------------------

**This command requires the Tcl integration feature.**

  *  tclEval arg ?arg ...?