-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcssframework.sty
66 lines (58 loc) · 1.24 KB
/
cssframework.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
\ProvidesPackage{cssframework}
\RequirePackage{include4ht}
\edef\css@curroutpufile{}
% open css file
\newcommand\cssstartoutput[1]{%
\xdef\css@curroutpufile{#1}%
\special{t4ht>\css@curroutpufile}%
}
% close css file
\newcommand\cssstopoutput{%
\special{t4ht<\css@curroutpufile}%
}
\newcommand\CssLink[1]{%
\Configure{@HEAD}%
{\HCode{<link rel="stylesheet" type="text/css" href="#1" />}}%
}
% #1 template name
% #2 css output file
\newcommand\processcss[2]{%
\CssLink{#2}
\AtBeginDocument{%
\cssstartoutput{#2}%
\NoFonts%
\input{#1}%
\EndNoFonts%
\cssstopoutput%
}
}
\newcommand\includecss[1]{%
\AddCss{#1}%
}
\edef\css@selectrpath{}
\def\hnl{\HCode{\Hnewline}}
%\def\finselectr{}
\newcommand\Selector[2]{%
\bgroup%
\edef\css@selectrpath{\css@selectrpath{} #1}
\hnl\unskip\css@selectrpath\{\hnl
#2
\hnl\}\hnl
\egroup%
}
% support for media queries
% default medium is all, #2 is rule, #3 is
\newcommand\MediaQuery[3][all]{%
@media #1 and (#2)\{\hnl
#3\hnl%
\}\hnl%
}
% Various helper functions
% default font size
\newcommand\emwidth{16}
% convert pt to rem
\newcommand\CalcRem[1]{\strip@pt\dimexpr(#1)/\emwidth}
% support for browsers without rem
\newcommand\RemProperty[2]{%
#1:\the\dimexpr #2\relax;#1:\CalcRem{#2}rem;
}