-
Notifications
You must be signed in to change notification settings - Fork 1
/
hepub.def
119 lines (99 loc) · 2.84 KB
/
hepub.def
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
% Hyperref driver for XHTML-style links
\ProvidesFile{hepub.def}
[2012/11/06 v6.83m %
Hyperref driver for ePub]
\makeatletter
\ExplSyntaxOn
\Hy@VersionCheck{hepub.def}
% Anchor syntax might vary considerably
% It depends on *where* we are in the document
\tl_set:Nn \l__xhtm_anchor_tl {plain}
\Hy@WrapperDef\hyper@anchor#1{%
\cs_if_exist:cTF {epub_anchor_\tl_use:N \l__epub_anchor_tl :n}
{
\use:c {epub_anchor_\tl_use:N \l__epub_anchor_tl :n}{#1}
}
{
\txt_only_chars:nn {name} {#1}
\epub_open_tag:nn {a} {id="\tl_use:N \l__txt_chars_tl"}
\epub_close_tag:n {a}
}
}
\Hy@WrapperDef\hyper@anchorstart#1{%
\cs_if_exist:cTF {epub_anchorstart_\tl_use:N \l__epub_anchor_tl :n}
{
\use:c {epub_anchorstart_\tl_use:N \l__epub_anchor_tl :n}{#1}
}
{
\txt_only_chars:nn {name} {#1}
\epub_open_tag:nn {a} {id="\tl_use:N \l__txt_chars_tl"}
}
}
\def\hyper@anchorend{%
\cs_if_exist:cTF {epub_anchorend_\tl_use:N \l__epub_anchor_tl :}
{
\use:c {epub_anchorend_\tl_use:N \l__epub_anchor_tl :}
}
{
\epub_close_tag:n {a}
}
}
\cs_new:Npn \epub_anchor_onnext:n #1
{
\txt_only_chars:nn {name} {#1}
\tl_gset_eq:NN \l__epub_nextid_tl \l__txt_chars_tl
}
\cs_new:Npn \epub_anchorstart_onnext:n #1
{
\txt_only_chars:nn {name} {#1}
\tl_gset_eq:NN \l__epub_nextid_tl \l__txt_chars_tl
}
\cs_new:Npn \epub_anchorend_onnext: {}
\Hy@WrapperDef\hyper@linkfile#1#2#3{#1}%
\Hy@WrapperDef\hyper@link#1#2#3{%
\use:c {epub_href_#1_hool}
\txt_only_chars:nn {name} {#2}
\epub_open_tag:nn {a} {href="\tl_use:N \l__epub_baseurl_tl\#\tl_use:N \l__txt_chars_tl"}
#3
\epub_close_tag:n {a}
}
%\Hy@WrapperDef
\cs_new_nopar:Npn \hyper@linkurl #1#2
{
\epub_open_tag:nn {a}{href="#2"}
#1
\epub_close_tag:n {a}
}
\Hy@WrapperDef\hyper@linkstart #1#2
{
\use:c {epub_href_#1_hook}
\txt_only_chars:nn {name} {#2}
\epub_open_tag:nn {a} {href="\tl_use:N \l__epub_baseurl_tl\#\tl_use:N \l__txt_chars_tl"}
}
\cs_new_nopar:Npn \hyper@linkend {\epub_close_tag:n {a}}
% Hyperref loads pd1enc which overwrites the accent macros,
% so we restore them here (if not using unicode)
\renewcommand{\"}[1]{\entity{#1uml}}
\renewcommand{\`}[1]{\entity{#1grave}}
\renewcommand{\'}[1]{\entity{#1acute}}
\renewcommand{\^}[1]{\entity{#1circ}}
\renewcommand{\~}[1]{\entity{#1tilde}}
\renewcommand{\c}[1]{\entity{#1cedil}}
\renewcommand{\v}[1]{\entity{#1caron}}
\renewcommand{\.}[1]{\entity{#1dot}}
\renewcommand{\ae}{\entity{aelig}}
\renewcommand{\AE}{\entity{AElig}}
\renewcommand{\oe}{\entity{oelig}}
\renewcommand{\OE}{\entity{OElig}}
\renewcommand{\aa}{\entity{aring}}
\renewcommand{\AA}{\entity{Aring}}
\renewcommand{\o}{\entity{oslash}}
\renewcommand{\O}{\entity{Oslash}}
\renewcommand{\ss}{\entity{szlig}}
\renewcommand{\P}{\entity{\#182}}
\ExplSyntaxOff
\makeatother
\endinput
% Local Variables:
% mode: latex3
% End: