forked from AllenDowney/ThinkJava
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtrinket
79 lines (62 loc) · 2.37 KB
/
trinket
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
\newcommand{\adjustpage}[1]{}
\newcommand{\clearemptydoublepage}{}
\newcommand{\blankpage}{}
\newcommand{\spacing}{}
\newcommand{\endspacing}{}
\newcommand{\frontmatter}{}
\newcommand{\mainmatter}{}
\newcommand{\backmatter}{}
\newcommand{\theoremstyle}[1]{}
\newcommand{\newtheoremstyle}[1]{}
\newcommand{\vfill}{}
\newcommand{\href}{\ahref}
\htmlhead{\rawhtmlinput{header.html}}
\htmlfoot{\rawhtmlinput{footer.html}}
% these styles get translated into CSS
\newstyle{p+p}{margin-top:1em; margin-bottom:1em}
\newstyle{img}{border: 0px;}
% change the arrows
\setlinkstext
{\imgsrc[ALT="Previous"]{back.png}}
{\imgsrc[ALT="Up"]{up.png}}
{\imgsrc[ALT="Next"]{next.png}}
% colors for code listings and output
\usepackage{color}
\definecolor{bgcolor}{rgb}{0.982, 0.982, 0.982}
\definecolor{comment}{rgb}{0.000, 0.488, 0.000}
\definecolor{keyword}{rgb}{0.000, 0.000, 1.000}
\definecolor{strings}{rgb}{0.700, 0.000, 0.000}
% syntax highlighting in code listings
\usepackage{listings}
\lstset{
language=java,
basicstyle=\ttfamily,
backgroundcolor=\color{bgcolor},
commentstyle=\color{comment},
keywordstyle=\color{keyword},
stringstyle=\color{strings},
columns=fullflexible,
emph={label}, % keyword?
keepspaces=true,
showstringspaces=false
}
% code listing environments
\lstnewenvironment{code}
{}
{}
\lstnewenvironment{stdout}
{\lstset{commentstyle=\relax,keywordstyle=\relax,stringstyle=\relax}}
{}
% custom HTML for Trinket publisher tools
% see http://hevea.inria.fr/doc/manual018.html
\newenvironment{trinket}[1]
{\@print{<script type="text/javascript">(function(d,l,s,i,c){function n(e){e=e.nextSibling;return (!e||e.nodeType!=3)?e:n(e);};function r(f){/in/.test(d.readyState) ? setTimeout(function(){r(f);},9):f()};l=d.getElementsByTagName('script');s=l[l.length-1];r(function(){i=n(s),c=n(i);i.setAttribute('src','https://trinket.io/tools/1.0/jekyll/embed/java#code='+encodeURIComponent(c.nodeValue.replace(/^\s+|\s+$/g,'')));});})(document)</script><iframe width="100%" height="400" frameborder="0" marginwidth="0" marginheight="0" class="lazyload" allowfullscreen></iframe><!--}
[[[[ #1 ]]]]\rawhtml}
{\endrawhtml\@print{-->}}
% inline syntax formatting
\newcommand{\java}{\lstinline}%}
% CSS for code listings
\newstyle{.lstframe}{margin: 1em; width: calc(100\% - 1em);}
\newstyle{.lstlisting}{padding: 3pt;}
% make urls hyperlinks in html
\input{urlhref.hva}