Fossil SCM

Replaced style.css?page=xxx with style.css/page, like the [style-css-revamp] branch does.

stephan 2020-05-18 03:41 fileedit-ajaxify
Commit bc40707425060bdad3bf2c4dea9a9ae5dcc9a562ab9f982e33845107c4a1a6d8
1 file changed +18 -12
+18 -12
--- src/style.c
+++ src/style.c
@@ -370,29 +370,27 @@
370370
const char *zVarPrefix,
371371
const char *zConfigName,
372372
const char *zPageName
373373
){
374374
char *zVarName = mprintf("%s_url", zVarPrefix);
375
- char *zExtra = 0;
376
- char *zUrl = 0;
375
+ char *zUrl = 0; /* stylesheet URL */
376
+ int hasBuiltin = 0; /* true for built-in page-specific CSS */
377
+
377378
if(0==strcmp("css",zConfigName)){
378
- /* Account for page-specific CSS, appending a page=NAME url flag
379
- ** only if we have a corresponding built-in page-specific CSS
379
+ /* Account for page-specific CSS, appending a /{{g.zPath}} to the
380
+ ** url only if we have a corresponding built-in page-specific CSS
380381
** file. Do not append it to all pages because we would
381382
** effectively cache-bust all pages which do not have
382383
** page-specific CSS. */
383384
char * zBuiltin = mprintf("style.%s.css", g.zPath);
384
- if(builtin_file(zBuiltin,0)!=0){
385
- zExtra = mprintf("&page=%s", g.zPath);
386
- }
385
+ hasBuiltin = builtin_file(zBuiltin,0)!=0;
387386
fossil_free(zBuiltin);
388387
}
389
- zUrl = mprintf("%R/%s?id=%x%s", zPageName,
390
- skin_id(zConfigName),
391
- zExtra ? zExtra : "");
388
+ zUrl = mprintf("%R/%s%s%s?id=%x", zPageName,
389
+ hasBuiltin ? "/" : "", hasBuiltin ? g.zPath : "",
390
+ skin_id(zConfigName));
392391
Th_Store(zVarName, zUrl);
393
- fossil_free(zExtra);
394392
fossil_free(zUrl);
395393
fossil_free(zVarName);
396394
}
397395
398396
/*
@@ -1082,11 +1080,19 @@
10821080
*/
10831081
void page_style_css(void){
10841082
Blob css = empty_blob;
10851083
int i;
10861084
int isInit = 0;
1087
- const char * zPage = P("page");
1085
+ const char * zPage = P("name")
1086
+ /* FIXME: our reliance on P("name") will merge-conflict with the
1087
+ [style-css-revamp] branch, at which time we need to adopt its
1088
+ version of this function. The problem with doing that *now* is
1089
+ that it requires new functionality in cgi.c and url.c which was
1090
+ added for that purposes, which we don't dare merge into here
1091
+ until that branch is vetted and merged. That branch's whole
1092
+ approach to the ordering of CSS is different than this one
1093
+ (which is based on the current trunk). */;
10881094
10891095
cgi_set_content_type("text/css");
10901096
if(zPage!=0 && zPage[0]!=0
10911097
&& strlen(zPage)<30/*marginal safety measure vs malicious input*/){
10921098
/* Check for page-specific CSS. The placement of this CSS is kinda
10931099
--- src/style.c
+++ src/style.c
@@ -370,29 +370,27 @@
370 const char *zVarPrefix,
371 const char *zConfigName,
372 const char *zPageName
373 ){
374 char *zVarName = mprintf("%s_url", zVarPrefix);
375 char *zExtra = 0;
376 char *zUrl = 0;
 
377 if(0==strcmp("css",zConfigName)){
378 /* Account for page-specific CSS, appending a page=NAME url flag
379 ** only if we have a corresponding built-in page-specific CSS
380 ** file. Do not append it to all pages because we would
381 ** effectively cache-bust all pages which do not have
382 ** page-specific CSS. */
383 char * zBuiltin = mprintf("style.%s.css", g.zPath);
384 if(builtin_file(zBuiltin,0)!=0){
385 zExtra = mprintf("&page=%s", g.zPath);
386 }
387 fossil_free(zBuiltin);
388 }
389 zUrl = mprintf("%R/%s?id=%x%s", zPageName,
390 skin_id(zConfigName),
391 zExtra ? zExtra : "");
392 Th_Store(zVarName, zUrl);
393 fossil_free(zExtra);
394 fossil_free(zUrl);
395 fossil_free(zVarName);
396 }
397
398 /*
@@ -1082,11 +1080,19 @@
1082 */
1083 void page_style_css(void){
1084 Blob css = empty_blob;
1085 int i;
1086 int isInit = 0;
1087 const char * zPage = P("page");
 
 
 
 
 
 
 
 
1088
1089 cgi_set_content_type("text/css");
1090 if(zPage!=0 && zPage[0]!=0
1091 && strlen(zPage)<30/*marginal safety measure vs malicious input*/){
1092 /* Check for page-specific CSS. The placement of this CSS is kinda
1093
--- src/style.c
+++ src/style.c
@@ -370,29 +370,27 @@
370 const char *zVarPrefix,
371 const char *zConfigName,
372 const char *zPageName
373 ){
374 char *zVarName = mprintf("%s_url", zVarPrefix);
375 char *zUrl = 0; /* stylesheet URL */
376 int hasBuiltin = 0; /* true for built-in page-specific CSS */
377
378 if(0==strcmp("css",zConfigName)){
379 /* Account for page-specific CSS, appending a /{{g.zPath}} to the
380 ** url only if we have a corresponding built-in page-specific CSS
381 ** file. Do not append it to all pages because we would
382 ** effectively cache-bust all pages which do not have
383 ** page-specific CSS. */
384 char * zBuiltin = mprintf("style.%s.css", g.zPath);
385 hasBuiltin = builtin_file(zBuiltin,0)!=0;
 
 
386 fossil_free(zBuiltin);
387 }
388 zUrl = mprintf("%R/%s%s%s?id=%x", zPageName,
389 hasBuiltin ? "/" : "", hasBuiltin ? g.zPath : "",
390 skin_id(zConfigName));
391 Th_Store(zVarName, zUrl);
 
392 fossil_free(zUrl);
393 fossil_free(zVarName);
394 }
395
396 /*
@@ -1082,11 +1080,19 @@
1080 */
1081 void page_style_css(void){
1082 Blob css = empty_blob;
1083 int i;
1084 int isInit = 0;
1085 const char * zPage = P("name")
1086 /* FIXME: our reliance on P("name") will merge-conflict with the
1087 [style-css-revamp] branch, at which time we need to adopt its
1088 version of this function. The problem with doing that *now* is
1089 that it requires new functionality in cgi.c and url.c which was
1090 added for that purposes, which we don't dare merge into here
1091 until that branch is vetted and merged. That branch's whole
1092 approach to the ordering of CSS is different than this one
1093 (which is based on the current trunk). */;
1094
1095 cgi_set_content_type("text/css");
1096 if(zPage!=0 && zPage[0]!=0
1097 && strlen(zPage)<30/*marginal safety measure vs malicious input*/){
1098 /* Check for page-specific CSS. The placement of this CSS is kinda
1099

Keyboard Shortcuts

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