using the C preprocessor to handle files ending in .h

This commit is contained in:
/dev/urandom 2020-04-14 17:06:17 +03:00
parent 2d228d9032
commit d5cd19d84d
2 changed files with 47 additions and 30 deletions

View file

@ -14,8 +14,9 @@ PAGES_HTML = $(patsubst $(PAGEDIR)/%.md,$(OUTDIR)/%.html,$(_PAGES))
_DIRECTORIES = $(shell find $(PAGEDIR)/* -type d) _DIRECTORIES = $(shell find $(PAGEDIR)/* -type d)
DIRECTORIES = $(patsubst $(PAGEDIR)/, $(OUTDIR)/, $(_PAGES)) DIRECTORIES = $(patsubst $(PAGEDIR)/, $(OUTDIR)/, $(_PAGES))
_STATIC = $(shell find -L static/ -type f -name \*) _STATIC_FILES = $(shell find -L static/ -type f -name \*i | grep -v \.h$)
OUT_STATIC = $(patsubst static/%,out/%,$(_STATIC)) _STATIC_HEADERS = $(shell find -L static/ -type f -name \*.h)
OUT_STATIC = $(patsubst static/%,out/%,$(_STATIC_FILES)) $(patsubst static/%.h,out/%,$(_STATIC_HEADERS))
.SUFFIXES: .SUFFIXES:
.PHONY: all upload .PHONY: all upload
@ -29,6 +30,10 @@ $(OUTDIR)/%.html: $(PAGEDIR)/%.md $(TPLDIR)/default.tpl
@mkdir -p $(@D) @mkdir -p $(@D)
theme -C style -t $(TPLDIR)/default.tpl -o $@ $< theme -C style -t $(TPLDIR)/default.tpl -o $@ $<
$(OUTDIR)/%: static/%.h
@mkdir -p $(@D)
cpp -E -P -o $@ $<
$(OUTDIR)/%: static/% $(OUTDIR)/%: static/%
@mkdir -p $(@D) @mkdir -p $(@D)
cp -r $< $@ cp -r $< $@

View file

@ -1,26 +1,41 @@
#define C_WHITE #ecf0f1
#define C_GRAY1 #bdc3c7
#define C_GRAY2 #95a5a6
#define C_GRAY3 #7f8c8d
#define C_BLACK #2c3e50
#define C_BLACK2 #34495e
#define C_RED1 #e74c3c
#define C_RED2 #c0392b
#define C_GRN1 #2ecc71
#define C_GRN2 #27ae60
#define C_YEL1 #f1c40f
#define C_YEL2 #f39c12
#define C_BLU1 #3498db
#define C_BLU2 #2980b9
html { html {
min-height: 100%; min-height: 100%;
} }
body { body {
background: #fefefe; background: C_WHITE;
color:#221f31; color:C_BLACK;
min-height: 100%; min-height: 100%;
margin: 0; margin: 0;
} }
body a, body a:visited { body a, body a:visited {
color: #404a68; color: C_BLU2;
} }
body a:visited { body a:visited {
color: #678fcb; color: C_BLU1;
} }
blockquote { blockquote {
margin: 6pt; margin: 6pt;
padding-inline: 1em; padding-inline: 1em;
border-inline-start: 4px solid #9a93b7; border-inline-start: 4px solid C_GRAY2;
} }
p { p {
@ -29,18 +44,18 @@ p {
table { table {
background: #fefefe; background: #fefefe;
border: 2px solid #9a93b7; border: 2px solid C_GRAY2;
border-collapse: collapse; border-collapse: collapse;
} }
th, td { th, td {
border: 1px solid #9a93b7; border: 1px solid C_GRAY1;
padding: 4pt; padding: 4pt;
} }
.header { .header {
background: #221f31; background: C_BLACK2;
color: #fefefe; color: C_WHITE;
font-family: sans-serif; font-family: sans-serif;
min-height: 1px; min-height: 1px;
padding-block: 1em; padding-block: 1em;
@ -48,7 +63,7 @@ th, td {
} }
.header a, .header a:visited { .header a, .header a:visited {
color: #fefefe; color: C_WHITE;
} }
.header h2, .header h3 { .header h2, .header h3 {
@ -56,8 +71,8 @@ th, td {
} }
.footer { .footer {
background: #404a68; background: C_GRAY3;
color: #fefefe; color: C_BLACK;
text-align: center; text-align: center;
font-family: sans-serif; font-family: sans-serif;
font-size: 0.8em; font-size: 0.8em;
@ -65,12 +80,12 @@ th, td {
} }
.footer a, .footer a:visited { .footer a, .footer a:visited {
color: #8be1e0; color: C_BLACK2;
} }
.content { .content {
margin: 0 6pt; margin: 0 6pt;
color: #221f31; color: C_BLACK;
font-family: serif; font-family: serif;
} }
@ -81,27 +96,24 @@ th, td {
} }
.info { .info {
border-inline-start: 4px solid #316f23; border-inline-start: 4px solid C_GRN1;
background:#7cc264; color: C_GRN2;
color: #316f23;
} }
.warning { .warning {
border-inline-start: 4px solid #9b6e2d; border-inline-start: 4px solid C_YEL1;
background:#f5ee9b; color: C_YEL2;
color:#543516;
} }
.error { .error {
border-inline-start: 4px solid #a14d3f; border-inline-start: 4px solid C_RED1;
background:#ea9182; color: C_RED2;
color:#543516;
} }
.spoiler { .spoiler {
border-inline-start: 4px solid #221f31; border-inline-start: 4px solid C_BLACK2;
background: #9a93b7; background: C_GRAY2;
color:#221f31; color:C_BLACK2;
visibility: hidden; visibility: hidden;
} }
@ -122,10 +134,10 @@ th, td {
@media screen and (min-width:720pt) { @media screen and (min-width:720pt) {
html { html {
background:#9a93b7; background:C_GRAY1;
} }
body { body {
box-shadow: 0 0 0 1px #404a68; box-shadow: 0 0 0 1px C_GRAY2;
max-width: 720pt; max-width: 720pt;
margin: auto; margin: auto;
} }