Fossil SCM

Add the styleScript TH1 command to enabling including the script element of the skin in-line in the header or footer.

drh 2018-09-10 23:47 skin-script
Commit dc88a533e239863b1f8cb00556c3e045d2c733be085a795ad7c2b26f03c2986a
1 file changed +30 -1
+30 -1
--- src/th_main.c
+++ src/th_main.c
@@ -1300,10 +1300,38 @@
13001300
}else{
13011301
Th_SetResult(interp, "repository unavailable", -1);
13021302
return TH_ERROR;
13031303
}
13041304
}
1305
+
1306
+/*
1307
+** TH1 command: styleScript
1308
+**
1309
+** Render the configured javascript for the selected skin
1310
+*/
1311
+static int styleScriptCmd(
1312
+ Th_Interp *interp,
1313
+ void *p,
1314
+ int argc,
1315
+ const char **argv,
1316
+ int *argl
1317
+){
1318
+ if( argc!=1 ){
1319
+ return Th_WrongNumArgs(interp, "styleScript");
1320
+ }
1321
+ if( Th_IsRepositoryOpen() ){
1322
+ const char *zScript = skin_get("js");
1323
+ if( zScript==0 ) zScript = "";
1324
+ Th_Render(zScript);
1325
+ Th_SetResult(interp, 0, 0);
1326
+ return TH_OK;
1327
+ }else{
1328
+ Th_SetResult(interp, "repository unavailable", -1);
1329
+ return TH_ERROR;
1330
+ }
1331
+}
1332
+
13051333
13061334
/*
13071335
** TH1 command: artifact ID ?FILENAME?
13081336
**
13091337
** Attempts to locate the specified artifact and return its contents. An
@@ -1984,12 +2012,13 @@
19842012
{"render", renderCmd, 0},
19852013
{"repository", repositoryCmd, 0},
19862014
{"searchable", searchableCmd, 0},
19872015
{"setParameter", setParameterCmd, 0},
19882016
{"setting", settingCmd, 0},
1989
- {"styleHeader", styleHeaderCmd, 0},
19902017
{"styleFooter", styleFooterCmd, 0},
2018
+ {"styleHeader", styleHeaderCmd, 0},
2019
+ {"styleScript", styleScriptCmd, 0},
19912020
{"tclReady", tclReadyCmd, 0},
19922021
{"trace", traceCmd, 0},
19932022
{"stime", stimeCmd, 0},
19942023
{"unversioned", unversionedCmd, 0},
19952024
{"utime", utimeCmd, 0},
19962025
--- src/th_main.c
+++ src/th_main.c
@@ -1300,10 +1300,38 @@
1300 }else{
1301 Th_SetResult(interp, "repository unavailable", -1);
1302 return TH_ERROR;
1303 }
1304 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1305
1306 /*
1307 ** TH1 command: artifact ID ?FILENAME?
1308 **
1309 ** Attempts to locate the specified artifact and return its contents. An
@@ -1984,12 +2012,13 @@
1984 {"render", renderCmd, 0},
1985 {"repository", repositoryCmd, 0},
1986 {"searchable", searchableCmd, 0},
1987 {"setParameter", setParameterCmd, 0},
1988 {"setting", settingCmd, 0},
1989 {"styleHeader", styleHeaderCmd, 0},
1990 {"styleFooter", styleFooterCmd, 0},
 
 
1991 {"tclReady", tclReadyCmd, 0},
1992 {"trace", traceCmd, 0},
1993 {"stime", stimeCmd, 0},
1994 {"unversioned", unversionedCmd, 0},
1995 {"utime", utimeCmd, 0},
1996
--- src/th_main.c
+++ src/th_main.c
@@ -1300,10 +1300,38 @@
1300 }else{
1301 Th_SetResult(interp, "repository unavailable", -1);
1302 return TH_ERROR;
1303 }
1304 }
1305
1306 /*
1307 ** TH1 command: styleScript
1308 **
1309 ** Render the configured javascript for the selected skin
1310 */
1311 static int styleScriptCmd(
1312 Th_Interp *interp,
1313 void *p,
1314 int argc,
1315 const char **argv,
1316 int *argl
1317 ){
1318 if( argc!=1 ){
1319 return Th_WrongNumArgs(interp, "styleScript");
1320 }
1321 if( Th_IsRepositoryOpen() ){
1322 const char *zScript = skin_get("js");
1323 if( zScript==0 ) zScript = "";
1324 Th_Render(zScript);
1325 Th_SetResult(interp, 0, 0);
1326 return TH_OK;
1327 }else{
1328 Th_SetResult(interp, "repository unavailable", -1);
1329 return TH_ERROR;
1330 }
1331 }
1332
1333
1334 /*
1335 ** TH1 command: artifact ID ?FILENAME?
1336 **
1337 ** Attempts to locate the specified artifact and return its contents. An
@@ -1984,12 +2012,13 @@
2012 {"render", renderCmd, 0},
2013 {"repository", repositoryCmd, 0},
2014 {"searchable", searchableCmd, 0},
2015 {"setParameter", setParameterCmd, 0},
2016 {"setting", settingCmd, 0},
 
2017 {"styleFooter", styleFooterCmd, 0},
2018 {"styleHeader", styleHeaderCmd, 0},
2019 {"styleScript", styleScriptCmd, 0},
2020 {"tclReady", tclReadyCmd, 0},
2021 {"trace", traceCmd, 0},
2022 {"stime", stimeCmd, 0},
2023 {"unversioned", unversionedCmd, 0},
2024 {"utime", utimeCmd, 0},
2025

Keyboard Shortcuts

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