Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Proof of concept for my proposal of reworking how style.css emits CSS, as discussed in [https://fossil-scm.org/forum/forumpost/d63ff33063|forumpost/d63ff33063]. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | style-css-revamp |
| Files: | files | file ages | folders |
| SHA3-256: |
ae10ddf330160225d5d1e295730e93a6 |
| User & Date: | stephan 2020-05-17 17:52:38.219 |
Context
|
2020-05-17
| ||
| 18:56 | Cherrypick [100c67fa] for bootstrap skin fix. ... (check-in: 06c7d57d18 user: stephan tags: style-css-revamp) | |
| 17:52 | Proof of concept for my proposal of reworking how style.css emits CSS, as discussed in [https://fossil-scm.org/forum/forumpost/d63ff33063|forumpost/d63ff33063]. ... (check-in: ae10ddf330 user: stephan tags: style-css-revamp) | |
| 16:33 | Update the built-in SQLite to the second 3.32.0 beta, for testing. ... (check-in: 5181332eb5 user: drh tags: trunk) | |
Changes
Changes to src/main.mk.
| ︙ | ︙ | |||
241 242 243 244 245 246 247 248 249 250 251 252 253 254 | $(SRCDIR)/sounds/9.wav \ $(SRCDIR)/sounds/a.wav \ $(SRCDIR)/sounds/b.wav \ $(SRCDIR)/sounds/c.wav \ $(SRCDIR)/sounds/d.wav \ $(SRCDIR)/sounds/e.wav \ $(SRCDIR)/sounds/f.wav \ $(SRCDIR)/tree.js \ $(SRCDIR)/useredit.js \ $(SRCDIR)/wiki.wiki TRANS_SRC = \ $(OBJDIR)/add_.c \ $(OBJDIR)/alerts_.c \ | > | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | $(SRCDIR)/sounds/9.wav \ $(SRCDIR)/sounds/a.wav \ $(SRCDIR)/sounds/b.wav \ $(SRCDIR)/sounds/c.wav \ $(SRCDIR)/sounds/d.wav \ $(SRCDIR)/sounds/e.wav \ $(SRCDIR)/sounds/f.wav \ $(SRCDIR)/style.admin_log.css \ $(SRCDIR)/tree.js \ $(SRCDIR)/useredit.js \ $(SRCDIR)/wiki.wiki TRANS_SRC = \ $(OBJDIR)/add_.c \ $(OBJDIR)/alerts_.c \ |
| ︙ | ︙ |
Changes to src/makemake.tcl.
| ︙ | ︙ | |||
173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# Additional resource files that get built into the executable.
#
set extra_files {
diff.tcl
markdown.md
wiki.wiki
*.js
../skins/*/*.txt
sounds/*.wav
}
# Options used to compile the included SQLite library.
#
set SQLITE_OPTIONS {
| > | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# Additional resource files that get built into the executable.
#
set extra_files {
diff.tcl
markdown.md
wiki.wiki
*.js
style.*.css
../skins/*/*.txt
sounds/*.wav
}
# Options used to compile the included SQLite library.
#
set SQLITE_OPTIONS {
|
| ︙ | ︙ |
Added src/style.admin_log.css.
> > > > > > > | 1 2 3 4 5 6 7 |
/* This file is just to demonstrate/test page-specific CSS. */
a:hover::before {
content: "[";
}
a:hover::after {
content: "]";
}
|
Changes to src/style.c.
| ︙ | ︙ | |||
368 369 370 371 372 373 374 |
*/
static void url_var(
const char *zVarPrefix,
const char *zConfigName,
const char *zPageName
){
char *zVarName = mprintf("%s_url", zVarPrefix);
| > | > > > > > > > > > > > > > > | > | | | 368 369 370 371 372 373 374 375 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 |
*/
static void url_var(
const char *zVarPrefix,
const char *zConfigName,
const char *zPageName
){
char *zVarName = mprintf("%s_url", zVarPrefix);
char *zExtra = 0;
char *zUrl = 0;
if(0==strcmp("css",zConfigName)){
/* Account for page-specific CSS, appending a /{{g.zPath}} to the
** url only if we have a corresponding built-in page-specific CSS
** file. Do not append it to all pages because we would
** effectively cache-bust all pages which do not have
** page-specific CSS. */
char * zBuiltin = mprintf("style.%s.css", g.zPath);
if(builtin_file(zBuiltin,0)!=0){
zExtra = mprintf("/%s", g.zPath);
}
fossil_free(zBuiltin);
}
zUrl = mprintf("%R/%s%s?id=%x", zPageName,
zExtra ? zExtra : "",
skin_id(zConfigName));
Th_Store(zVarName, zUrl);
fossil_free(zExtra);
fossil_free(zUrl);
fossil_free(zVarName);
}
/*
** Create a TH1 variable containing the URL for the specified config image.
** The resulting variable name will be of the form $[zImageName]_image_url.
*/
static void image_url_var(const char *zImageName){
|
| ︙ | ︙ | |||
1061 1062 1063 1064 1065 1066 1067 |
/*
** WEBPAGE: style.css
**
** Return the style sheet.
*/
void page_style_css(void){
| | | < < | > | > > | | < | < > | | | < > > > > > > | > > > > > | > > > | > > > > > > > | 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 |
/*
** WEBPAGE: style.css
**
** Return the style sheet.
*/
void page_style_css(void){
Blob css = empty_blob;
int i;
const char *zPage = P("name");
cgi_set_content_type("text/css");
/* add special missing definitions */
for(i=1; cssDefaultList[i].elementClass; i++){
char *z = blob_str(&css);
if( !containsSelector(z, cssDefaultList[i].elementClass) ){
blob_appendf(&css, "%s {\n%s}\n",
cssDefaultList[i].elementClass,
cssDefaultList[i].value);
}
}
blob_append(&css,
"\n/***********************************************************\n"
"** All CSS above is generated automatically by Fossil to\n"
"** provide default rule implementations which the \"skin\"\n"
"** may cascade.\n"
"***********************************************************/\n",
-1);
blob_append(&css,skin_get("css"),-1);
if(zPage!=0 && zPage[0]!=0){
char * zFile = mprintf("style.%s.css", zPage);
int nFile = 0;
const char *zBuiltin = (const char *)builtin_file(zFile, &nFile);
if(nFile>0){
blob_appendf(&css,
"\n/***********************************************************\n"
"** Start of page-specific CSS for page %s...\n"
"***********************************************************/\n",
zPage);
blob_append(&css, zBuiltin, nFile);
blob_appendf(&css,
"\n/***********************************************************\n"
"** End of page-specific CSS for page %s.\n"
"***********************************************************/\n",
zPage);
}
fossil_free(zFile);
}
blob_append(&css,
"\n/***********************************************************\n"
"** All CSS which follows is supplied by the repository \"skin\".\n"
"***********************************************************/\n",
-1);
blob_append(&css,skin_get("css"),-1);
/* Process through TH1 in order to give an opportunity to substitute
** variables such as $baseurl.
*/
Th_Store("baseurl", g.zBaseURL);
Th_Store("secureurl", fossil_wants_https(1)? g.zHttpsURL: g.zBaseURL);
Th_Store("home", g.zTop);
|
| ︙ | ︙ |
Changes to win/Makefile.mingw.
| ︙ | ︙ | |||
663 664 665 666 667 668 669 670 671 672 673 674 675 676 | $(SRCDIR)/sounds/9.wav \ $(SRCDIR)/sounds/a.wav \ $(SRCDIR)/sounds/b.wav \ $(SRCDIR)/sounds/c.wav \ $(SRCDIR)/sounds/d.wav \ $(SRCDIR)/sounds/e.wav \ $(SRCDIR)/sounds/f.wav \ $(SRCDIR)/tree.js \ $(SRCDIR)/useredit.js \ $(SRCDIR)/wiki.wiki TRANS_SRC = \ $(OBJDIR)/add_.c \ $(OBJDIR)/alerts_.c \ | > | 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 | $(SRCDIR)/sounds/9.wav \ $(SRCDIR)/sounds/a.wav \ $(SRCDIR)/sounds/b.wav \ $(SRCDIR)/sounds/c.wav \ $(SRCDIR)/sounds/d.wav \ $(SRCDIR)/sounds/e.wav \ $(SRCDIR)/sounds/f.wav \ $(SRCDIR)/style.admin_log.css \ $(SRCDIR)/tree.js \ $(SRCDIR)/useredit.js \ $(SRCDIR)/wiki.wiki TRANS_SRC = \ $(OBJDIR)/add_.c \ $(OBJDIR)/alerts_.c \ |
| ︙ | ︙ |
Changes to win/Makefile.msc.
| ︙ | ︙ | |||
570 571 572 573 574 575 576 577 578 579 580 581 582 583 |
$(SRCDIR)\sounds\9.wav \
$(SRCDIR)\sounds\a.wav \
$(SRCDIR)\sounds\b.wav \
$(SRCDIR)\sounds\c.wav \
$(SRCDIR)\sounds\d.wav \
$(SRCDIR)\sounds\e.wav \
$(SRCDIR)\sounds\f.wav \
$(SRCDIR)\tree.js \
$(SRCDIR)\useredit.js \
$(SRCDIR)\wiki.wiki
OBJ = $(OX)\add$O \
$(OX)\alerts$O \
$(OX)\allrepo$O \
| > | 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 |
$(SRCDIR)\sounds\9.wav \
$(SRCDIR)\sounds\a.wav \
$(SRCDIR)\sounds\b.wav \
$(SRCDIR)\sounds\c.wav \
$(SRCDIR)\sounds\d.wav \
$(SRCDIR)\sounds\e.wav \
$(SRCDIR)\sounds\f.wav \
$(SRCDIR)\style.admin_log.css \
$(SRCDIR)\tree.js \
$(SRCDIR)\useredit.js \
$(SRCDIR)\wiki.wiki
OBJ = $(OX)\add$O \
$(OX)\alerts$O \
$(OX)\allrepo$O \
|
| ︙ | ︙ |